Blockchain Node Concurrent Block Write and Consensus Execution
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current blockchain transaction processing methods are inefficient due to serial execution of consensus, execution, and block write stages, which hampers their applicability to high service concurrency scenarios.
Innovation Solution
Implementing a method where a blockchain node executes the block write operation for one round of consensus concurrently with the consensus protocol for the next round, using multiple threads to manage thread locks and ensure safe access to shared resources, and allowing for recovery and re-determination of transactions in case of failures.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If consensus, execution and block write are performed in serial manner, then system simplicity is maintained, but transaction processing efficiency is low
Solution Approach 1:
The patent divides the transaction processing system into multiple independent threads: a first thread for block write operations and a second thread for consensus protocol execution. This segmentation allows concurrent processing of different operations, transforming the serial execution model into a parallel one, thereby improving transaction processing efficiency while managing system complexity through modular thread design
Solution Approach 2:
The patent introduces a temporal dimension to the processing model by enabling overlapping execution of block write operations and consensus protocols across different time periods. The first thread handles block write for round N while the second thread executes consensus for round N+1, creating a pipelined architecture that improves throughput without requiring all operations to complete sequentially
2Productivity
If multiple threads are used for concurrent execution, then transaction processing efficiency is improved, but thread safety and resource access control become more complex
Solution Approach 1:
The patent introduces thread locks as intermediary mechanisms that mediate between the first and second threads when accessing shared blockchain variables. The lock ensures that only one thread can access shared resources at a time, preventing race conditions and data corruption while allowing concurrent execution to proceed, thus managing thread safety complexity through a well-defined locking protocol
3Adaptability or versatility
If concurrent execution is implemented, then service concurrency capability is improved, but failure recovery and data consistency become more difficult to maintain
Solution Approach 1:
The patent implements beforehand cushioning by requiring the second thread to wait for the first thread to complete its block write operation before initiating its consensus protocol execution. This sequential dependency within the concurrent architecture ensures that data is fully written and committed before the next round of consensus begins, preventing data loss or inconsistency in case of failures during concurrent processing
Data Source
AI summary
Embodiments of this specification provide a transaction processing method, apparatus, and electronic device for a blockchain. The method includes: executing, by a blockchain node in the blockchain, a consensus protocol for an N-th round of consensus, wherein the consensus protocol comprises reaching a consensus on a blockchain transaction of the N-th round of consensus and upon the consensus being reached, executing the blockchain transaction of the N-th round of consensus; writing, by the blockchain node after the execution of the blockchain transaction, a block comprising the blockchain transaction of the N-th round of consensus into the blockchain; and concurrently with the writing of the block, executing, by the blockchain node, the consensus protocol for an (N+1)-th round of consensus in the blockchain.

