Method for executing blockchain transactions
Background and problems:
Current technology: In traditional blockchain networks, nodes usually elect accounting nodes based on consensus algorithms, and accounting nodes package transactions into blocks and broadcast them to other nodes. Each node executes transactions in the block in sequence, which is called serialized transaction execution.
Existing problems: The serialized transaction execution method is inefficient when processing transactions that do not affect the update of multiple storage addresses.
Technical solution:
Method overview: A method for parallel execution of blockchain transactions is proposed, which organizes transactions in the block to be written into at least two transaction queues and executes transactions in each queue at the same time.
Specific steps: including obtaining the block to be written, organizing transactions into queues, executing transactions in the queues in parallel, and writing blocks to the blockchain.
Technical details: Ensure that the execution result of each transaction only affects one storage address, and realize parallel execution by configuring multiple virtual machine programs.
Device and system:
Device structure: A device for parallel execution of blockchain transactions is provided, including an acquisition module, an organization module, an execution module and a writing module.
System structure: A blockchain network composed of multiple nodes, each node executes a parallel transaction processing flow.
Virtual machine configuration: Multiple virtual machine programs are pre-configured on each node, corresponding to the transaction queues one by one to achieve parallel execution.
Implementation method and optimization:
Transaction classification: Transactions are divided into the first type of transactions that update storage address information and the second type of transactions that create storage addresses, and update transactions of the same storage address are processed first.
Queue balance: By sorting and evenly allocating processing units to transaction queues, the number of transactions in each queue is ensured to be similar, thereby improving execution efficiency.
Example description: Taking Ethereum as an example, the difference between serialization and parallelization of transaction execution methods and the advantages of parallelization are explained in detail.
Technical effect:
Improved transaction execution efficiency: Through parallel processing, nodes can execute more transactions per unit time.
Reduced load differences between execution processes: By evenly allocating transactions to each queue, it avoids the situation where some processes are idle while other processes are overloaded.
Short answer questions:
What is serialization transaction execution and what are the problems?
Serialization transaction execution: In traditional blockchain networks, nodes execute each transaction in a block one by one in the order in which the transactions are initiated.
Problem: When the transactions in the block do not involve updating the information on multiple storage addresses, the serial execution method will lead to low transaction execution efficiency.
What is the proposed method and what are the main steps?
Proposed method: A method for parallel execution of blockchain transactions.
Main steps:
Get the block to be written.
Organize the transactions in the block into at least two transaction queues.
Execute the transactions in each transaction queue at the same time.
Write the executed block to the blockchain.
What is the technical core of the method?
Technical core: Parallelize the transactions in the block to be written, and configure multiple virtual machine programs to execute transactions in multiple transaction queues at the same time, thereby improving transaction execution efficiency.
What types of blockchain transactions does the method apply to?
Applicable types: This method is applicable to transactions whose execution results only affect one storage address, including transactions that create new storage addresses and store information and transactions that update information on a single storage address.
How to achieve balanced distribution of transaction queues to improve execution efficiency?
Implementation method: By sorting and evenly distributing processing units (transactions or transaction subqueues) to each transaction queue, ensure that the number of transactions in each queue is similar, so as to avoid the situation where some execution processes are overloaded while other processes are idle, and improve the overall execution efficiency.
What are the advantages of this method compared with existing technologies?
Advantages:
Improve transaction execution efficiency: Through parallel processing, nodes can execute more transactions per unit time.
Reduce the load difference between execution processes: By evenly distributing transactions to each queue, resource utilization is optimized and uneven load between processes is avoided.
Adapt to specific blockchain application scenarios: Provides an efficient solution for application scenarios where the transaction execution results only affect one storage address.