Chains
BNB Beacon Chain
BNB ecosystem’s staking & governance layer
Developers
Ecosystem
Staking
Earn BNB and rewards effortlessly
Tokenization Solutions
Get Your Business Into Web3
Community
Parallel Ethereum Virtual Machine (EVM) promises to significantly enhance transaction processing and scalability. Since 2021, the core team at BNB Chain and NodeReal has been actively exploring and implementing parallel EVM solutions within the BNB Chain ecosystem, including the BNB Smart Chain (BSC) and opBNB.
This blog delves into the core principles of parallel EVM’s algorithms, showcases the specific solutions implemented in BNB Chain, and unveils our exciting roadmap for further development. Join us as we explore the full potential of this revolutionary technology!
EVM is a virtual instruction interpreter similar to the Java Virtual Machine (JVM). It executes bytecode, which is a series of specialized instructions packaged within transactions. These transactions, submitted by users, ultimately modify the state of the network.
Here’s how the EVM works:
Remember, interactions with the state database always occur through transactions and their embedded EVM opcodes, ensuring a secure and controlled environment.
In Web3 applications, the stateDB (state database) plays a crucial role in ensuring data integrity and accurate modification. To achieve this, the design prioritizes two key characteristics:
Example:
Alice sends 2 BNB to Bob, while simultaneously Danil sends 3 BNB to Eric. With sequential execution, the stateDB updates occur in the following order:
Given that transactions TX1 and TX2 modify distinct accounts, their execution order becomes inconsequential in this scenario. This opens the door to parallel execution, potentially enhancing system performance.However, the key lies in identifying and managing dependencies.
Dependencies arise when transactions share a common state, like Bob transferring to Danil before Danil transfers to Eric (TX3). In such cases, sequential execution is crucial. Executing TX3 before TX2 would fail due to insufficient funds in Danil's account, causing inconsistencies in the state.
The EVM faces challenges in executing transactions in parallel due to the difficulty of pre-determining dependencies between them before they are included in a block. This lack of visibility into potential conflicts necessitates sequential execution to ensure data integrity.
The sequential nature of transaction execution in EVM presents a fundamental hurdle to achieving high throughput and scalability, especially as blockchains experience surges in transaction volume. Notably, blockchains like BSC have recorded peak days exceeding 32M transactions/day, while opBNB reached an all-time high of 71M transactions/day.
Parallel EVM seeks to unlock the scalability potential of the EVM by enabling parallel transaction execution. This approach leverages the fact that independent transactions can be processed simultaneously, boosting throughput.
The core concept involves running multiple EVM instances concurrently on different threads. These instances execute transactions independently, and their results are later merged and submitted as a final state update. This parallelization significantly increases processing capacity, especially for high transaction volumes.
The diagram shows how a Parallel EVM executes transactions concurrently across four independent EVM instances, each on a separate thread.
Parallel EVM introduces exciting possibilities for improved scalability, but several questions need to be answered for its successful implementation:
The following sections will delve deeper into these challenges and explore proposed solutions from various approaches to parallel EVM architecture.
The Block STM (Software Transactional Memory) algorithm, and its accompanying paper are crucial for parallel transaction execution. The Block STM algorithm introduces key concepts to enable parallelism in EVMs:
This paper delves deeper into the technical intricacies of Block STM, offering detailed explanations of its implementation and addressing specific challenges encountered in parallel transaction execution.
Originally developed for the Aptos blockchain, the Block STM algorithm inspired projects like Polygon PoS, Monad Labs, and Sei V2 in the EVM community to adopt its parallel execution approach for enhanced transaction processing.
Since late 2021, the BNB Chain community has embarked on a journey to explore the realm of parallel EVM execution. Through two iterative development cycles, we've been actively investigating ways to unlock the performance potential of the BNB Chain. Recognizing the critical role of scalability, parallel EVM remains a central theme in our ongoing investment and innovation roadmap.
This blog serves as a retrospective, reflecting on our achievements and unveiling our future plans for the exciting frontiers of parallel EVM.
In early 2022, the BNB Chain community advanced towards parallel EVM execution with NodeReal's proposal of BEP-130. This proposal detailed the infrastructure for a parallel EVM solution, supported by a reference implementation in their BSC repository, moving beyond just theoretical concepts.
The Parallel EVM V1.0 solution tackled key challenges to enable efficient parallel transaction processing:
The Parallel EVM 1.0 solution offers a complete framework for executing transactions in parallel on the BNB Chain. NodeReal contributed a full implementation, thorough documentation, and detailed analysis of real-world on-chain activities, laying a strong foundation for further enhancements and the development of Parallel EVM 2.0.
(Please refer to the Parallel Transaction Execution (BEP-130) for more detail.)
Parallel EVM 2.0 is more about performance enhancement.
Building upon the foundation of Parallel EVM 1.0, the 2.0 iteration introduces a series of performance-enhancing innovations:
Beyond these highlights, numerous other optimizations contribute to the enhanced performance of Parallel EVM 2.0. For a detailed exploration, refer to the official repository.
Parallel EVM 2.0 delivers tangible performance improvements, as documented in their repository. Their findings reveal a significant reduction in total block processing cost, ranging from approximately 20% to 50%, with variability depending on specific block patterns.
Following the performance advancements achieved in Parallel EVM 2.0, the BNB Chain community is now actively developing Parallel EVM 3.0 with two ambitious goals:
The parallel solution till v2.0 can be summarized as following:
A dispatcher assigns TXs (from pool or re-execution) to slots, and slots execute the transactions in parallel and state access is recorded in slotDB, then the conflict detector decides which transactions need re-run and which can submit the result to stateDB.
However, with the entire solution implemented, one problem remains:
The cost of re-execution wastes the resources and causes performance degradation.
Is there a way to reduce, or ideally, eliminate it?
Re-execution in Parallel EVM, while necessary for ensuring data integrity, significantly impacts performance and resource utilization. Analysis suggests the primary reason is the conflict detector's inability to predict state access conflicts before dispatching transactions.
In other words, the dispatcher currently lacks knowledge of whether newly dispatched transactions conflict with those already assigned to other instances. This leads to situations where conflicting transactions land in different slots, necessitating re-execution even if they ultimately access the same state concurrently. So the problem goes to:
How can the dispatcher be made aware of transaction conflict information before execution?
Our proposed solution introduces a hint-based dispatcher that leverages external hint providers. These providers analyze transactions and generate predictions about potential state access conflicts. By incorporating these hints into the scheduling process, the dispatcher can:
This approach aims to significantly reduce re-execution by enabling conflict-aware scheduling, ultimately boosting Parallel EVM performance without compromising data integrity.
Key Components of the Hint-Based Parallel EVM:
1. Hints:
2. Hints Generator:
3. Modified Dispatcher:
4. Conflict Detector:
The introduction of a hint-based system would offer several benefits:
Our ambitious goal extends beyond conflict elimination; we aim to seamlessly integrate Parallel EVM into the BNB Chain ecosystem, potentially within both BSC and opBNB. To achieve this, we are implementing several key strategies:
This comprehensive approach aims to transform Parallel EVM into a production-ready solution poised to significantly enhance the performance and scalability of the BNB Chain ecosystem.
Several exciting projects have recently emerged, exploring innovative solutions for parallel EVM:
Additionally, several projects are developing optimized or customized database solutions to further enhance parallel EVM performance.
In summary, while Parallel EVM solutions are unified in their core principle of executing transactions in parallel and managing the inherent conflict risks from dependencies, they differ in their approaches to conflict reduction and state access optimization, each presenting unique strengths and trade-offs.
For example, Polygon employs a "minimal metadata approach" to identify conflicts during block building, which accelerates the validation process, whereas Sei V2 enhances the developer experience by removing the necessity for manual state access specification.
These varying methodologies underscore the continuous innovation in this field, with each solution offering distinct advantages depending on the particular use cases and priorities.
Moving forward, the evolution of parallel EVM technology is likely to be influenced by further developments in conflict detection, state management, and cross-chain interoperability.
This blog delves into the exciting world of parallel EVM technology. We explore leading solutions and projects, along with BNB Chain's own dynamic efforts in this space.
Our unwavering commitment to innovation will ensure BNB Chain remains at the forefront of blockchain infrastructure, delivering the most robust parallel EVM solution.
Moreover, the parallel EVM is just one piece of our comprehensive strategy to optimize EVM performance. We're actively exploring and developing additional innovative solutions that attack performance bottlenecks at the execution engine level:
Beyond EVM-centric approaches, we're also actively researching and tracking alternative parallel transaction execution methods, such as:
This comprehensive outlook ensures we're constantly evaluating and exploring the most promising solutions to cater to diverse user needs and deliver the best possible blockchain experience.
Website | Twitter | Telegram | Facebook | dApp Store | YouTube | Discord | LinkedIn | Build N' Build Forum