From ed41eeaf41777998f4046f5806db0ddc86ddb8b5 Mon Sep 17 00:00:00 2001 From: Tatu Date: Tue, 15 Apr 2025 20:36:48 +0300 Subject: [PATCH] Create BEP-547.md Encrypted Mempool for Binance Smart Chain --- BEPs/BEP-547.md | 416 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 416 insertions(+) create mode 100644 BEPs/BEP-547.md diff --git a/BEPs/BEP-547.md b/BEPs/BEP-547.md new file mode 100644 index 00000000..95e91c68 --- /dev/null +++ b/BEPs/BEP-547.md @@ -0,0 +1,416 @@ +
+  BEP: 547
+  Title: Encrypted Mempool for Binance Smart Chain
+  Status: Proposed
+  Type: Standards & Improvements
+  Created: 2025-04-15
+
+ +# Summary + +**Summary/TL;DR** + +This proposal outlines an initiative to implement a distributed (threshold) encrypted mempool for the Binance Chain, aimed at thwarting front-running and adding a robust layer of real-time censorship resistance. Motivated by the ethical vision of the BNB Good Will Alliance---which seeks to foster best practices and safeguard user interests---this proposal suggests that validators on Binance Chain can take a practical step by committing to include encrypted transactions in block proposals. These encrypted transactions are ordered and committed before decryption, ensuring that transaction details remain hidden until after the block is finalized, effectively eliminating the opportunity for front-running, as has already been demonstrated on the Gnosis Chain. + +At a high level, the system allows users to submit transactions in an encrypted format while validators process them without decryption. Once the transaction order is locked in, the transactions are decrypted and executed using a distributed threshold encryption/decryption mechanism. The threshold decryption can be performed either by the Binance validators themselves or by a dedicated Shutter Keyper set, which is selected by a purpose-built DAO (Shutter DAO 0x36). This ensures that no single entity can control or manipulate the transaction order to their advantage or insert transactions with knowledge that they gained through unfair advantage. + +On an implementation level, validators that will use the upcoming Erigon v3 client on Binance Chain are going to have the option to register for processing encrypted transactions. This process integrates this feature without disrupting the existing workflow. Erigon is actively developing a second client implementation for this specific purpose so that a version of Erigon v3 will be capable of processing encrypted transactions. The new release and feature will soon be available for BSC.  + +Importantly, this mechanism is entirely opt-in: regular transactions will continue to be supported while users and RPCs gain the added choice of utilizing enhanced privacy features. + +This proposal is a joint effort by brainbot GmbH, Erigon, and NodeReal, reflecting our collective commitment to advancing the Binance ecosystem and supporting its validator community. While we are excited about the potential of an encrypted mempool to enhance transaction fairness, improve censorship resistance, and deter malicious MEV activities, this document does not yet commit to specific assignments, milestones or resources. Detailed implementation tasks and deliverables will be defined in subsequent phases, ensuring that the transition is smooth and leverages existing technology already proven on networks like the Gnosis Chain. + +## Motivation + +### Community Trust and Ethical Standards + +In recent years, challenges like front-running and sandwich attacks have eroded trust in blockchain transaction ordering. The BNB Good Will Alliance was established to address such challenges by driving off-chain best practices and ethical standards for the benefit of all ecosystem participants. This proposal is a natural extension of those efforts, ensuring that transaction ordering is transparent, secure, and fair. + +### Mitigating Malicious MEV and Front-Running + +Front-running exploits the order of transactions to yield undue profit, destabilizing market fairness. By committing to an encrypted mempool, validators secure transaction ordering by: + +- **Pre-Decryption Ordering**: Locking in the order of transactions without exposure to plaintext data. + +- **Decentralized Decryption Authority**: Requiring a threshold amount of parties to collaborate to perform decryption ensures that no single party can control or manipulate the transaction order for their own benefit or insert transactions using information obtained through unfair means. + +- **Proven Technology**: Deployments on chains like Gnosis have showcased the effectiveness of such approaches in eliminating front-running. + +### Ecosystem Growth and Long-Term Vision + +Implementing this proposal will: + +- **Enhance User Confidence**: A secure, censorship-resistant transaction order process will attract more users and developers. + +- **Pave the Way for Advanced Integrations**: By aligning with the existing Proposer-Builder Separation supply chain standards and eventual Ethereum L1 integration, the encrypted mempool supports broader cross-chain innovations. + +- **Mitigate Regulatory Risks**: By managing MEV responsibly, Binance Chain validators might be able to avoid regulatory classifications that might otherwise label validators or sequencers as financial intermediaries and require extensive monitoring/reporting of market abuse. See the latest ESMA regulation in this regard. The analogy here is that a provider of an end-to-end encrypted messaging provider can also not be held liable for malicious activity happening on its encrypted technical infrastructure. + +### Real-Time Censorship Resistance and Builder Decentralization + +Increasing centralization of block builders is a growing concern on blockchain platforms, notably on Ethereum, where centralized builder models can lead to real-time censorship and unfair transaction ordering. Although Binance Chain has not yet experienced severe centralization issues, this proposal proactively addresses potential future risks by: + +- **Enhancing Censorship Resistance**: Encrypted transactions remain concealed until inclusion, preventing centralized actors from selectively censoring or reordering transactions based on their contents. + +- **Reducing Builder Centralization**: By decentralizing both transaction ordering (which is already the case on BSC) and decryption through threshold encryption/decryption, the power to curate transactions is distributed among a broad set of validators or Keypers. This discourages the formation of centralized builder pools and mitigates any risk of undue influence over transaction inclusion. + +- **Fostering Fairness**: A distributed and transparent ordering mechanism ensures that no single entity can dominate transaction sequencing, paving the way for a more equitable ecosystem. + +## Specification + +### Client Integration and Upgrade Path + +Validators on the Binance Chain can opt-in to encrypted transaction processing by upgrading to the latest Erigon v3 client. Key aspects include: + +- **Optional Registration**: Validators may register to support and include encrypted transactions while also continuing to process regular transactions. + +- **Seamless Transition**: The protocol remains backward-compatible, enabling a gradual and safe transition process. + +- **Multi-Client Support**: In addition to Erigon v3, similar support is anticipated from other clients like Nethermind, ensuring broad validator participation. Nethermind was the first client to support the encrypted mempool on the Gnosis Chain, so it is highly likely that it'll be trivial for them to support an implementation on BSC as well. + +### Threshold Encryption Workflow + +The heart of this proposal is the threshold encryption mechanism, which unfolds as follows: + +1. **Transaction Submission:** + + Users encrypt transactions using a public key tied to the threshold committee, ensuring all submissions remain indistinguishable from one another. + +2. **Validator Commitment:** + + Validators commit to including encrypted transactions in blocks while they are still encrypted. Each validator cryptographically commits to the transaction order. + +3. **Decentralized Decryption:** + + Once a validator has committed to a bloc, a threshold decryption process is initiated. A committee---either composed of Binance validators or a dedicated Shutter Keyper set (managed by Shutter DAO 0x36)---collaborates to decrypt the transactions only when the required threshold is reached. + +This workflow decentralizes trust, ensuring that even if a subset of participants is compromised, the encrypted contents remain secure. + +### Integration with PBS and Cross-Chain Protocols + +Drawing insights from proposals like[ The Road Towards a Distributed Encrypted Mempool on Ethereum](https://ethresear.ch/t/the-road-towards-a-distributed-encrypted-mempool-on-ethereum/21717), our design ensures future interoperability with an out-of-protocol PBS transaction supply chain as is used on the Ethereum mainnet. + +## Security Considerations + +### Threat Model + +Key threats addressed include: + +- **Front-Running Attacks:** + + By locking in transaction order before decryption, the risk of manipulative reordering is eliminated. + +- **Censorship Resistance:** + + The distributed decryption process prevents any single entity from censoring or reordering transactions. + +- **Collusion:** + + Threshold encryption minimizes risks as an honest majority consensus is required for decryption. + +### Cryptographic Assumptions + +The proposal relies on: + +- **Threshold Encryption Schemes:** + + Distributing the decryption key shares across multiple parties ensures no unilateral access. + +- **Commitment Schemes:** + Validators commit to a transaction order through cryptographic proofs. + +- **Signature Verification:** + + All decryption-related messages are signed to guarantee authenticity and integrity. + +## Performance, Latency, and Scalability + +**Throughput:** + +Overall throughput remains largely unaffected by the integration of encrypted transactions. This is due to the decryption process introducing minimal computational overhead and requiring minimal bandwidth resources. Importantly, no computation is performed over encrypted data---transactions are decrypted prior to execution---ensuring that block production and transaction processing rates remain on par with current operations. + +**Latency:** + +A slight increase in latency may be experienced for encrypted transactions. This is due to the additional step of waiting for inclusion in a Shutterized transaction slot. However, the impact on latency is expected to be minimal. As more validators opt-in to processing encrypted transactions, the probability of these transactions being included in a Shutterized slot increases, effectively reducing the latency in any potential transaction delays. + +**Scalability:** + +The minimal overhead of the decryption process ensures that the network's scalability is not compromised. Both standard and encrypted transactions can be processed in parallel, and the modular nature of the protocol allows for the seamless integration of additional validators or cryptographic accelerators if required. + +## Call for Validators + +### Validator Incentives + +Validators are paramount to the security and performance of the Binance Chain. By participating, they will: + +- **Enhance Network Integrity:** + + Contribute to a more secure and fair transaction ordering process. + +- **Improve Ecosystem Reputation:** + + Demonstrate commitment to ethical practices as championed by the BNB Good Will Alliance. + +- **Unlock New Revenue Streams:** + + Potential integration with advanced MEV mitigation and PBS protocols may offer additional financial incentives. + +### Integration with Existing Policies + +Validators are encouraged to: + +- **Upgrade to Erigon v3:** + + Seamlessly support both encrypted and regular transactions. + +- **Adopt Best Practices:** + + Implement security recommendations and operational guidelines detailed in this proposal. + +- **Engage in Governance:** + + Actively participate in community discussions, audits, and feedback loops to refine the encrypted mempool system. + +## Deployment Roadmap and Next Steps + +This proposal is a joint initiative by brainbot GmbH, Erigon, and NodeReal, reflecting our shared commitment to supporting the Binance and validator communities. While we are enthusiastic about advancing the implementation of an encrypted mempool on the Binance Chain, this document should not be interpreted as a formal commitment to specific assignments, milestones or resources at this stage. Detailed tasks and deliverables will be defined in subsequent phases of the project. Given that a similar system is already operational on the Gnosis Chain and that Erigon v3 will natively support encrypted transaction processing, the required implementation efforts are expected to be straightforward. Together, we look forward to collaborating with the broader community to enhance network fairness and security. An implementation plan could look like the following: + +### Testnet Deployment + +- **Phase 1:** + + Deploy an isolated testnet environment where validators can opt-in to encrypted transaction processing. Monitor performance, security, stability, and system resilience. + +- **Phase 2:** + + Run extensive simulations and stress tests to ensure robust threshold decryption under varied network conditions. + +### Mainnet Integration + +- **Pilot Phase:** + + Introduce an encrypted mempool as an opt-in feature on the BSC mainnet with comprehensive monitoring and logging. + +- **Full Rollout:** + + Based on pilot results and community feedback, progressively enable encrypted transaction processing across the entire network. + +### Community and Developer Engagement + +- **Open-Source Collaboration:** + + Launch and maintain GitHub repositories for public review, contributions, and transparent documentation. + +- **Workshops and Hackathons:** + + Organize events to educate and empower developers and validators on encrypted transaction processing best practices. + +- **Feedback Integration:** + + Establish structured channels for continuous community input to refine the protocol. + +## Potential Future Work + +### Extended Functionality + +Beyond mitigating front-running and sandwich attacks, an encrypted mempool could be extended to support: + +- **Enhanced Privacy Features** + + Integration of zero-knowledge proofs or confidential transaction protocols. + +- **Interoperability Enhancements** + + Broader compatibility with other chains and emerging EVM L1 protocols. + +### Research and Development + +Future research directions include: + +- **Dynamic Threshold Adjustments** + + Adaptive mechanisms that modify threshold requirements based on network conditions. + +- **Improved Cryptographic Primitives** + + Evaluating and integrating next-generation algorithms to boost security and performance. + +- **Economic Incentive Models** + + Developing novel incentive schemes to reward validators for participating in secure encrypted transaction processing. + +## Governance and Community Involvement + +### Role of the BNB Good Will Alliance + +The BNB Good Will Alliance is central to coordinating best practices and ethical standards within the ecosystem. This proposal embodies the alliance's commitment to: + +- **Establishing Ethical Guidelines** + + Promoting secure and fair transaction ordering practices. + +- **Fostering Community Consensus** + + Encouraging transparent, public debate and iterative improvements. + +- **Enhancing Transparency** + + Ensuring that all protocol changes are subject to community review and open audits. + +### Transparent Decision-Making + +The proposal will be developed and maintained through: + +- **Regular Updates** + + Periodic reports, open meetings, and publicly accessible documentation. + +- **Collaborative Documentation** + + Open-source repositories that allow for community contributions and review. + +- **Feedback Mechanisms** + + Formal channels to incorporate community and validator feedback in future revisions. + +## Regulatory Implications + +The evolving regulatory landscape presents significant challenges. Regulatory bodies worldwide are increasingly scrutinizing entities that extract malicious MEV. In some jurisdictions, validators or sequencers involved in such activities could be categorized as financial intermediaries rather than purely technical operators. This categorization subjects them to stringent regulatory requirements, potentially complicating compliance and increasing operational risks. By proactively managing MEV through encrypted transaction ordering, the Binance Chain can: + +- **Avoid Regulatory Reclassification** + + Maintain a status as a technical protocol rather than a financial intermediary. + +- **Reduce Compliance Burdens** + + Mitigate the risk of strict regulatory oversight that could deter user adoption and inhibit growth. + +- **Foster a Safer Ecosystem** + + Promote a compliant, fair, and transparent network that aligns with global regulatory expectations. + +## brainbot GmbH Background + +brainbot GmbH has been at the forefront of developing Ethereum core infrastructure since 2014, achieving key milestones such as deploying one of the first minimum viable Proof-of-Stake side-chains in 2019. Our extensive involvement in MEV research began in 2020, which was marked by the deployment of the Shutter Network to combat malicious MEV. Through collaborations with Gnosis Chain and Nethermind, brainbot GmbH has focused on integrating MEV solutions into diverse infrastructures. Recognized by Optimism with a grant, our expertise in MEV strategies continues to drive advancements that underpin the technology described in this proposal. + +## Erigon Background + +Erigon is a high-performance Ethereum execution client, originally known as TurboGeth, renowned for its efficiency and optimized data handling. Its development team has consistently pushed the boundaries of blockchain performance and scalability. With the upcoming Erigon v3 release, which introduces native support for encrypted transaction processing, Erigon is set to play a pivotal role in enhancing Binance Smart Chain's validator infrastructure. This upgrade will enable validators to process encrypted transactions with minimal computational overhead, directly supporting the goals of this proposal. + +## NodeReal Background + +NodeReal is a leading blockchain infrastructure provider specializing in node and API solutions across multiple blockchain networks, including Binance Smart Chain. Recognized for its reliable and scalable infrastructure services, NodeReal contributes significantly to maintaining network robustness and operational efficiency. Their technical expertise and commitment to innovation are instrumental in integrating advanced features---such as the encrypted mempool mechanism proposed in this BEP---ensuring that BSC remains competitive and resilient against emerging challenges like front-running and centralized builder risks. + +## Comparison of Technologies Enabling the Encrypted Mempool + +Several cryptographic approaches have been proposed to enable encrypted mempools. Here we compare the primary technologies: + +### 12.1 Timed Cryptography + +Timed Cryptography, often implemented via Verifiable Delay Functions (VDFs), conceals transaction content until a predetermined time---typically when the transaction's block position is fixed. However, drawbacks include: + +- **Specialized Hardware Requirements** + + Parties with specialized hardware may compute delays faster, risking premature decryption. + +- **Resource Intensity** + + Delay functions are computationally expensive and potentially wasteful. + +- **Network Inconsistencies** + + Variations in transaction reception times may lead to inequities. + +- **Parameter Sensitivity** + + Setting the optimal difficulty parameter is challenging and critical. + +- **Risk of Front-Running** + + If a transaction is not included in a block, its content may be revealed, enabling front-running. + +### Fully Homomorphic Encryption (FHE) + +FHE allows arbitrary computation over encrypted data, preserving confidentiality throughout processing. While promising for preventing malicious MEV and allowing beneficial backrunning: + +- **High Computational Overhead** + + FHE currently imposes extreme computational constraints, making it impractical for real-time blockchain applications. + +- **Efficiency Limitations** + + The cost in terms of processing power and latency remains prohibitive for current use cases. + +### Trusted Execution Environments (TEEs) + +TEEs, such as Intel SGX, offer a secure enclave for executing code even on compromised hosts. While TEEs can mitigate malicious MEV by ensuring secure transaction ordering: + +- **Historical Vulnerabilities** + + Past attacks have raised concerns about the security guarantees of TEEs. + +- **Trust Dependencies** + + Reliance on hardware manufacturers introduces centralized trust points, which can be problematic in decentralized environments. + +### Witness Encryption + +Witness encryption encrypts data under a particular statement, with decryption possible only if a valid witness is provided. For MEV protection: + +- **Complexity of Relations** + + Constructing practical encryption schemes for conditions like "transaction included in a finalized block" remains a research challenge. + +- **Limited Practical Use** + + Despite promising concepts, witness encryption is not yet viable for the dynamic requirements of blockchain transactions. + +### Threshold Encryption + +Threshold encryption splits the decryption key into shares and distributes those among multiple parties, requiring collaboration from a minimum amount to decrypt a message. Its benefits include: + +- **Decentralization of Trust** + + No single party holds the complete decryption key, mitigating risks of premature decryption. + +- **Timely Decryption Guarantees** + + With thresholds set appropriately, timely decryption is ensured even with adversarial activity. + +- **Robust Security Assumptions** + + The system relies on the assumption that fewer than the threshold amount of parties behave maliciously---a trust assumption that can be further minimized through ongoing research. + +In our view, threshold encryption is the most promising candidate for an encrypted mempool, providing a practical balance between security, efficiency, and decentralization. + +## Links and Resources + +- **Gnosis Chain Encrypted Mempool Beta Release:** + [Shutterized Gnosis Chain is Live]() + +- **Explorer/Dashboard:** + [Shutter Network Explorer]() + +- **High-Level Specification:** + [Shutter High-Level Spec]() + +- **Low-Level Specification:** + [Shutter Low-Level Spec]() + +- **Cryptography Paper:** + [IACR ePrint Archive -- Paper on Threshold Encryption]() + +- **PBS and Ethereum L1 Integration Proposal:** + [The Road Towards a Distributed Encrypted Mempool on Ethereum]() + +- **Shutter DAO & Keyper Information:** + [Shutter Network Tweet]() + +- **GitHub Repositories:** + To be updated with the relevant code repositories for further reference. + +## License + +This proposal is licensed under[ CC0](https://creativecommons.org/publicdomain/zero/1.0/). + +This BEP aims to create a more equitable and secure transaction environment on Binance Chain by leveraging advanced cryptographic techniques, a decentralized governance model, and proactive regulatory foresight. Through the implementation of an encrypted mempool, Binance Chain can effectively mitigate front-running and malicious MEV attacks, safeguard user interests, and foster long-term ecosystem growth---all while positioning itself as a leader in ethical and compliant blockchain innovation.