Parallel Execution of Transactions in loopchain to Improve Blockchain Performance
Greetings from the PARAMETA Team,
Blockchain is a system that calls the code to be executed in the form of a transaction (TX), collects these transactions to create a block, executes the block on multiple nodes (Validator), and stores the result by a consensus. At this time, the transactions in the block are executed sequentially according to a set order and update the state data in the blockchain. Since all blocks are connected in a chain, the sequential execution of all transactions is inevitable, and this is the biggest obstacle to improving blockchain performance.
Sequential execution of transactions in a blockchain is one of the ways to ensure that the results of execution on all nodes are the same, because different execution order can lead to different results. Therefore, the selection of nodes (miners, namely validators) authorized to create blocks is very important in a blockchain. Ensuring that only one block can be created or selected at a time is a key feature of the blockchain consensus algorithm, and it is not easy to modify the sequential execution of transactions, which is one of the most important roles of the blockchain.
This sequential execution of transactions is an inherent feature of blockchain, but it is also true that it is difficult to expect a rapid improvement in blockchain performance without overcoming this limitation. Even for blockchains based on the PBFT (Practical Byzantine Fault Tolerance) consensus algorithm, which is characterized by fast consensus in practice, 2000 TPS (Transaction Per Second) is generally known to be the maximum theoretical performance, although there are differences depending on hardware and network performance.
The Solution to the Performance Problem is ‘Parallel Execution’
– Sharding, DAG, and Parallel Execution of Transactions in loopchain
For a dramatic increase in performance in any area, apply parallelization. Examples include running more buses and trains during the holidays when there’s a surge of homecoming travelers, or increasing the number of servers when selling tickets to a popular show with a high volume of instant access. The more ways you can process simultaneously, the more you can handle, and the faster you can perform.
Blockchains can also solve performance problems by applying parallelization. Let’s take a look at the representative parallel execution methods: Sharding, DAG (Directed Acyclic Graph), and the Parallel Execution of Transactions technology in loopchain developed by PARAMETA.
[Parallel Execution Method 1] Sharding
Ethereum is planning to apply Sharding to speed up transactions. Sharding refers to a technology for distributed storage and management of data or networks by dividing them into small pieces, and when applied to a blockchain, it is a method of dividing transactions or addresses based on them and recording and executing them on different chains. The fact that they are recorded on different chains is the basis for parallel execution of transactions. In general, it is sometimes implemented in the form of multi-channel, multi-chain, and side chain in other blockchains.
In these multi-chain approaches, state data is recorded separately for each chain, which eventually leads to incompatibility between chains. Blockchains are difficult to interoperate with because data validation is only valid within a chain and is equivalent to off-chain if it leaves that chain. Ethereum uses Beacon Chains to handle security and inter-chain communication for sharded chains, but performance is inevitably poor compared to a single chain.
* Source : Ethereum Sharding, https://github.com/ethereum/sharding
[Parallel Execution Method 2] DAG (Directed Acyclic Graph)
Another popular parallel execution method is the DAG (Directed Acyclic Graph), and one project that employs it is the Avalanche blockchain. DAG technology is characterized by the fact that all transactions are not connected sequentially, but are instead implemented in a partial order, with the order of the transactions pointing in one direction to clarify the antecedent and consequent relationships between them. This is an example of parallel execution because it allows multiple transactions to be executed independently at any given point in time. In general, it is known that DAG technology is easy to process asset transfers, but it is somewhat difficult to execute smart contracts.
DAG (Directed Acyclic Graph)
* Source : Avalanche Blockchain Consensus, https://docs.avax.network/overview/getting-started/avalanche-consensus#dags-directed-acyclic-graphs
[Parallel Execution Method 3] Parallel Execution of Transactions in loopchain, PARAMETA’s Self-Developed Parallel Execution Technology
PARAMETA is dramatically improving the performance of the blockchain by applying Parallel Execution of Transactions, a self-developed parallel execution technology, not Sharding or DAG, to loopchain, a self-developed blockchain core engine. Let’s take a closer look at this technology.
loopchain natively supports multi-channel. It can be designed to divide transactions and contracts into channels based on policies, which theoretically multiplies performance by the number of channels. Communication between channels can be performed using its own interchain technology, BTP (Blockchain Transmission Protocol), which allows organic connections between channels.
Multi-Channel in loopchain
However, communication using BTP is also between chains, which has an overhead, and in the case of smart contracts, it may be necessary to execute them on a single chain, so another approach is needed.
loopchain applies ‘Parallel Execution of Transactions’ technology, which allows each transaction to be executed in parallel if it can be executed independently. If a block contains TX1, TX2, and TX3, blockchain nodes would normally execute these transactions sequentially to update state data. However, if TX1 is a transfer from A to B and TX2 is a transfer from C to D, these are two independent transactions that do not need to be executed sequentially.
By applying processing technology that allows transactions to be executed in parallel when the accounts involved are independent of each other, loopchain allows TX1 and TX2 to be executed in parallel, dramatically reducing the time it takes to execute transactions in a block. The more TXs that can be executed in parallel, the less the overall execution time of that block will be. Not only for simple asset transfers, but also for smart contract execution, as long as the smart contract functions called by the TXs are independently executable, they can be executed in parallel. (loopchain uses the ‘isolated’ directive to specify that they are independently executable.)
They are also executed within one chain and processed within one state data, eliminating the overhead of communication between chains.
Parallel Execution of Transactions in loopchain
As a result of applying ‘Parallel Execution of Transactions’ technology, we found that performance (TPS) improves dramatically whenever we increase the number of parallel processes (Concurrency Level). For blockchains without the technology, performance does not improve as the number of processes increases, but for blockchains with the technology, performance improves noticeably as the number of processes increases.
Improving loopchain Performance with Parallel Execution of Transactions
Parallel execution methods are essential to overcome the performance limitations of blockchains, and various blockchains are applying parallel execution technology in different ways. PARAMETA has realized notable performance improvements by applying its own ‘Parallel Execution of Transactions’ technology along with multi-channel technology to loopchain.
If we add to this a technology that rearranges the transactions collected in the block generation stage to optimize parallel execution, we expect to achieve a significant level of performance improvement within a single chain.