To ensure the success of energy transition and achieve the target of reducing the carbon footprint of energy systems, the management of energy systems needs to be decentralized. Public blockchains offer favorable features to support energy sector democratization and reinforce citizens’ trust, such as tamper-proof energy data registration and sharing, decentralization, transparency, and support for peer-to-peer (P2P) energy trading. However, in blockchain-based P2P energy markets, transactional data are public and accessible, which raises privacy concerns related to prosumers’ energy profiles while lacking scalability and featuring high transactional costs. In this paper, we employ secure multi-party computation (MPC) to assure privacy on a P2P energy flexibility market implementation in Ethereum by combining the prosumers’ flexibility orders data and storing it safely on the chain. We provide an encoding mechanism for orders on the energy market to obfuscate the amount of energy traded by creating groups of prosumers, by splitting the amount of energy from bids and offers, and by creating group-level orders. The solution wraps around the smart contracts-based implementation of an energy flexibility marketplace, assuring privacy features on all market operations such as order submission, matching bids and offers, and commitment in trading and settlement. The experimental results show that the proposed solution is effective in supporting P2P energy flexibility trading, reducing the number of transactions, and gas consumption with a limited computational time overhead.