Transaction optimization and security enhancement method based on long safety chain
By introducing optimistic parallel transaction execution algorithm, pre-execution technology and security audit mechanism on Changan Chain, the shortcomings of blockchain systems in high concurrent transaction processing and security have been solved, and transaction processing speed and security have been improved.
Patent Information
- Application Number
- CN202411492446.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-24
- Publication Date
- 2025-03-18
- Estimated Expiration
- 2044-10-24
AI Technical Summary
The existing blockchain systems have shortcomings in high concurrent transaction processing and security, resulting in slow processing speed, extended transaction confirmation time, large computing resource consumption and increased transaction costs.
We adopt the transaction optimization and security enhancement method based on Changan Chain, and by introducing optimistic parallel transaction execution algorithms, pre-execution technology and security audit mechanisms, we optimize the transaction processing order, improve the execution efficiency of smart contracts, and improve transaction processing speed and security.
It significantly improves transaction processing speed and security, optimizes transaction processing order, improves the execution efficiency of smart contracts, and solves the problems of high concurrent transaction processing inefficiency and smart contract security.
Smart Images

Figure CN119652898A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of blockchain technology, and in particular to a transaction optimization and security enhancement method based on Changan Chain. Background Art
[0002] In the field of blockchain technology, its original consensus mechanism shows obvious limitations in transaction processing speed, especially in cases of high transaction volume, such as EVM, which is very inefficient - on Ethereum L1, it cannot even handle more than about 20TPS.
[0003] The existing blockchain technology uses a consensus mechanism based on proof of work (PoW), which results in slow processing speed. Especially when the number of users increases significantly, the network is prone to congestion and transaction confirmation time is prolonged. This inefficient processing method not only consumes a lot of computing resources, but also increases transaction costs. Summary of the invention
[0004] In order to solve the shortcomings of the existing blockchain system in high-concurrency transaction processing and security, the present invention provides a transaction optimization and security enhancement method based on Chang'an Chain, which can optimize the transaction processing order, improve the execution efficiency of smart contracts, and enhance the transaction processing speed and security.
[0005] To achieve the above object, the present invention provides the following solutions:
[0006] A transaction optimization and security enhancement method based on Changan Chain, the method comprising:
[0007] Get multiple transactions to be agreed upon;
[0008] At preset intervals, the blockchain consensus master node determines a preset number of the pending consensus transactions as initial execution transactions, and applies an optimistic parallel transaction execution algorithm based on random conflict detection to each of the initial execution transactions for pre-execution operations to obtain multiple candidate blocks;
[0009] The blockchain consensus master node applies a block intelligent propagation method to send each of the candidate blocks to the consensus slave node;
[0010] The consensus slave node applies the optimistic consensus block processing method to perform transaction verification on each candidate block to obtain a verification result; the verification result includes passing the verification and failing the verification;
[0011] When the verification result of the candidate block is passed, the candidate block is a consensus block, and the consensus block is submitted;
[0012] When the verification result of the candidate block is that it fails the verification, the initial execution transaction represented by the candidate block is used as the transaction to be agreed upon, and the process returns to the step "every preset time, the blockchain consensus master node determines a preset number of the transactions to be agreed upon as initial execution transactions, and applies an optimistic parallel transaction execution algorithm based on random conflict detection to each of the initial execution transactions for pre-execution operations, thereby obtaining multiple candidate blocks" to continue execution.
[0013] Optionally, an optimistic parallel transaction execution algorithm based on random conflict detection is applied to each of the initial execution transactions to perform a pre-execution operation to obtain multiple candidate blocks, specifically including:
[0014] The blockchain consensus master node performs parallel execution operations on each of the initial execution transactions, records the write operations of all the initial execution transactions in a memory cache, and obtains multiple candidate blocks.
[0015] Optionally, all write operations of the initial transaction execution are recorded in a memory cache to obtain multiple candidate blocks, specifically including:
[0016] Determine whether the keys in the read set after and before the execution of each of the initial execution transactions are consistent;
[0017] When the key in the read set after the initial execution transaction is executed is consistent with the key in the read set before the execution is completed, all write operations of the initial execution transaction are recorded in the memory cache to obtain multiple candidate blocks;
[0018] When the key in the read set of the initial execution transaction is inconsistent after the execution is completed and before the execution is completed, the initial execution transaction is used as a pending consensus transaction, and the pending consensus transaction is updated, and the process returns to the step "every preset time, the blockchain consensus master node determines a preset number of the pending consensus transactions as the initial execution transactions, and applies the optimistic parallel transaction execution algorithm based on random conflict detection to each of the initial execution transactions for pre-execution operations to obtain multiple candidate blocks" to continue execution.
[0019] Optionally, the consensus slave node applies an optimistic consensus block processing method to perform transaction verification on each of the candidate blocks to obtain a verification result, which specifically includes:
[0020] The blockchain consensus receives the Proposal from the master node in the Prevote phase and uses the Proposal as a block in the Commit phase;
[0021] Executor processes the transactions in Proposal and obtains the processing block;
[0022] Executor receives the consensus block sent by Consensus;
[0023] Executor determines whether the processing block is consistent with the consensus block;
[0024] When the confirmation block is consistent with the consensus block, the verification result is passed;
[0025] When the confirmation block is inconsistent with the consensus block, the verification result is failure to pass the verification.
[0026] Optionally, the blockchain consensus master node applies a block intelligent propagation method to send each candidate block to the consensus slave node, specifically including:
[0027] The validator receives the candidate block and adds the candidate block to the local transaction pool;
[0028] The proposer proposes a block to be submitted based on the status of all local transaction pools; the block to be submitted contains all transaction contents existing in all local transaction pools;
[0029] The proposer sends the block to be submitted to the validator.
[0030] Optionally, the method further comprises:
[0031] Before deploying the smart contract to the blockchain, the source code of the smart contract is compiled and optimized to obtain a precompiled contract;
[0032] Before executing the precompiled contract, obtain the object of the precompiled contract according to the smart contract address;
[0033] Execute the corresponding precompiled contract on the object of the precompiled contract.
[0034] Optionally, after executing the step of “executing the corresponding precompiled contract on the object of the precompiled contract”, the method further includes:
[0035] Apply smart contract static analysis to the execution result of the precompiled contract to obtain a vulnerability detection report.
[0036] According to the specific embodiments provided by the present invention, the present invention discloses the following technical effects:
[0037] The present invention discloses a transaction optimization and security enhancement method based on Chang'an Chain. By introducing an optimized transaction execution parallel mechanism, pre-execution technology and security audit mechanism, the problems of low efficiency in high-concurrency transaction processing and security of smart contracts are solved, thereby optimizing the transaction processing sequence, improving the execution efficiency of smart contracts, and enhancing transaction processing speed and security. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0039] Figure 1 A schematic diagram of the process flow of the transaction optimization and security enhancement method based on Changan Chain provided in Example 1 of the present invention;
[0040] Figure 2 A schematic diagram of a parallel scheduling algorithm flow chart provided in Example 1 of the present invention;
[0041] Figure 3 This is a schematic diagram of the overall process provided by Example 1 of the present invention;
[0042] Figure 4 A schematic diagram of the block intelligent propagation process provided by Embodiment 1 of the present invention;
[0043] Figure 5 A schematic diagram of the optimistic consensus block processing flow provided by Example 1 of the present invention;
[0044] Figure 6 A schematic diagram of a block proposal process in a traditional consensus mechanism provided in Example 1 of the present invention;
[0045] Figure 7 A schematic diagram of the precompiled contract execution process provided in Example 1 of the present invention;
[0046] Figure 8 A schematic diagram of the static analysis process of a smart contract provided in Example 1 of the present invention. DETAILED DESCRIPTION
[0047] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0048] The purpose of this invention is to provide a transaction optimization and security enhancement method based on Changan Chain, aiming to improve transaction processing speed and security.
[0049] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0050] Example 1
[0051] Before introducing the solution of this embodiment, the technical terms involved are explained first:
[0052] Blockchain: Blockchain is a shared, immutable ledger designed to facilitate transaction records and asset tracking processes in business networks. Assets can be tangible (such as houses, cars, cash, land) or intangible (such as intellectual property, patents, copyrights, brands). Almost anything of value can be tracked and traded on a blockchain network, reducing risks and costs on all sides.
[0053] Smart Contracts: Smart contracts are simply programs stored on the blockchain that run when predetermined conditions are met. Smart contracts are often used to automate agreements so that all participants can determine the outcome immediately, without any middlemen or wasted time. Smart contracts can also automate workflows, triggering the next action when conditions are met.
[0054] Consensus algorithm: A mechanism in a distributed system where multiple participants reach a consensus on something. Even though these participants may hold different opinions, the algorithm ensures that they can eventually reach a consensus on a single source of truth. In short, the purpose of a consensus algorithm is to ensure that all agents in the system can eventually reach a consensus on a fact or action, even if some agents disagree.
[0055] like Figures 1 to 8 As shown, the transaction optimization and security enhancement method based on Changan Chain in this embodiment includes:
[0056] Step S1: Get multiple transactions to be agreed upon.
[0057] Step S2: At preset intervals, the blockchain consensus master node determines a preset number of the transactions to be agreed upon as initial execution transactions, and applies an optimistic parallel transaction execution algorithm based on random conflict detection to each of the initial execution transactions for pre-execution operations to obtain multiple candidate blocks.
[0058] Specifically, the blockchain consensus master node performs parallel execution operations on each of the initial execution transactions, records the write operations of all the initial execution transactions in a memory cache, and obtains multiple candidate blocks.
[0059] Furthermore, it is determined whether the keys in the read sets after and before the execution of each of the initial execution transactions are consistent; when the keys in the read sets after and before the execution of the initial execution transactions are consistent, the write operations of all the initial execution transactions are recorded in the memory cache to obtain multiple candidate blocks; when the keys in the read sets after and before the execution of the initial execution transactions are inconsistent, the initial execution transactions are treated as transactions to be agreed upon, and the transactions to be agreed upon are updated, and the process returns to step S2 to continue execution.
[0060] Step S3: The blockchain consensus master node applies the block intelligent propagation method to send each candidate block to the consensus slave node.
[0061] S3 specifically includes:
[0062] Step S31: The validator receives the candidate block and adds the candidate block to the local transaction pool.
[0063] Step S32: The proposer proposes a block to be submitted based on the status of all local transaction pools; the block to be submitted contains all transaction contents existing in all local transaction pools.
[0064] Step S33: The proposer sends the block to be submitted to the verifier.
[0065] Step S4: The consensus slave node applies the optimistic consensus block processing method to perform transaction verification on each candidate block to obtain a verification result; the verification result includes passed verification and failed verification.
[0066] S4 specifically includes:
[0067] Step S41: The blockchain consensus receives the Proposal from the master node in the Prevote phase and uses the Proposal as a block in the Commit phase.
[0068] Step S42: Executor processes the transaction in Proposal to obtain a processing block.
[0069] Step S43: Executor receives the consensus block sent by Consensus.
[0070] Step S44: Executor determines whether the processing block is consistent with the consensus block.
[0071] Step S45: When the confirmation block is consistent with the consensus block, the verification result is passed.
[0072] Step S46: When the confirmation block is inconsistent with the consensus block, the verification result is failure to pass the verification.
[0073] In the present invention, Proposal means the proposal stage, the leader node will package the block and broadcast it to the follower node; Prevote means the pre-voting stage, after the follower node receives the proposal and verifies that the proposal is legal, it broadcasts its prevote vote to other nodes; Precommit means the pre-committing stage, after the node receives more than two-thirds of the prevote votes for the proposal, it broadcasts its precommit vote to other nodes; Commit means the committing stage, after the node receives more than two-thirds of the precommit votes for the proposal, it submits the block in the proposal to the ledger. This is the TBFT consensus process, the master node initiates the block proposal and broadcasts it, which is the proposal stage, and then the slave node enters the prevote stage after receiving the broadcast, and the executor is used for transaction processing.
[0074] Step S5: When the verification result of the candidate block is passed, the candidate block is a consensus block, and the consensus block is submitted.
[0075] Step S6: When the verification result of the candidate block is that it fails the verification, the initial execution transaction represented by the candidate block is used as the transaction to be agreed upon, and the process returns to step S2 to continue execution.
[0076] In practical applications, the present invention is based on optimistic parallel transaction execution based on random conflict detection, wherein the principle of the parallel scheduling algorithm is different from the traditional mechanism of serial execution of transactions within a block. Parallel scheduling refers to the use of parallel scheduling algorithms by nodes to execute transactions within a block during the block generation and verification phases, which fully utilizes the advantages of multi-core CPUs and greatly accelerates the overall processing performance of the blockchain.
[0077] Changan Chain has provided a random scheduling algorithm since version 1.0.0. This algorithm determines the execution order of block transactions by generating a directed acyclic graph (DAG) through the proposed node, and ensures that the verification node can execute and obtain the same result. The nodes in the DAG represent transactions, and the edges represent the happens-before relationship between transactions. When verifying blocks, other nodes in the network can verify the transactions in the block in parallel based on this DAG, generate a read-write set of transactions, and then verify the validity of the proposed block based on the read-write set. Figure 2 shown.
[0078] like Figure 3As shown in the figure, the main idea of the Changan Chain parallel scheduling algorithm is that transactions are divided into two steps: execution and effective commit. If the read set of a transaction is not changed by other transactions during the execution period, the execution result of the transaction is considered valid and the commit operation can be performed; otherwise, the execution result of the transaction is considered invalid and the execution result of the transaction needs to be discarded and the transaction needs to be re-executed. The specific steps are as follows:
[0079] 1. The Changan Chain scheduling module executes all transactions in parallel and records all transaction write operations in the memory cache during execution.
[0080] 2. After each transaction is executed, check whether all the keys in the read set have been modified by other transactions. If not, make the transaction write set effective (ApplyTxSimContext). If modified by other transactions, re-add the transaction to the queue for execution and re-execute it.
[0081] 3. After all transactions are executed, DAG is constructed by analyzing the read-write sets of all transactions. If there are "read-write", "write-read", or "write-write" conflicts between transactions, the edges in DAG are constructed according to the order of execution.
[0082] Since the execution time of conflicting transactions is random, the final constructed DAG is also unpredictable, so this algorithm is a random scheduling algorithm. When performing conflict detection, Changan Chain uses data structures such as bitmaps for engineering optimization, which greatly improves the execution efficiency of transactions.
[0083] In the present invention, the transaction queue TxQueue contains two structures for caching transactions:
[0084] (1) Queue: Caches the queue of pending transactions that have passed the transaction validity check and anti-duplicate check. (2) Pending: Caches the queue of transactions that have been packaged into the block and are in the consensus process.
[0085] During the execution of received transactions, the transaction pool will process transactions from different sources differently. For transactions from RPC, valid transactions will be cached in the queue to be packaged and broadcast to other nodes. For events from P2P (Peer-to-Peer) or INTERNAL, they will only be placed in the Queue of the transaction pool after verification.
[0086] When constructing a block, the Core module of the master node will fetch a batch of transactions from the transaction pool for constructing a new block. At this time, the transaction pool will move the batch of transactions from the queue to be packaged to the packaged pending cache.
[0087] When verifying a block, the slave node will get the transactions in the block from the transaction pool. For transactions in the transaction pool of this node, the Core module only needs to compare whether the transaction hash in the block is consistent with the transaction hash in the transaction pool (because the transaction pool has already done relevant checks). For transactions that are not in the transaction pool of this node, the Core module needs to perform transaction validity checks and anti-duplicate checks. After verifying that the block is valid, the Core module will notify the transaction pool to move the transactions in the block from the queue to be packaged to the packaged pending cache.
[0088] After completing consensus and submitting the block, the master node and the slave node will prune other blocks at the same height, put the transactions in the pruned blocks back into the queue to be packaged, and remove the transactions in the submitted block from the transaction pool Pending and Queue.
[0089] The present invention adopts block intelligent propagation and optimistic consensus block processing, where Figure 4 As shown in the figure, the specific steps of block intelligent propagation are as follows:
[0090] 1. When a full node receives a transaction, it will randomly propagate the transaction to other nodes. The validator receives and verifies the transaction and adds it to the local transaction pool.
[0091] 2. The block proposer checks the current state of the transaction pool and proposes a block to be submitted. Since most transactions have been received by validators through propagation, the proposer includes a unique transaction identifier and a reference to the complete block in the block proposal.
[0092] 3. The proposer first sends the block proposal to other validators, and then transmits the complete block (including all transaction contents) to the network in blocks. If the validator already has all the transactions in the proposal in the local transaction pool, it will directly rebuild the entire block from the transaction pool without waiting for all the block parts to arrive. This reduces the time the validator needs to wait for the block to arrive.
[0093] The principle of optimistic consensus block processing means that in the actual consensus process, after the node receives and verifies the Proposal in the Prevote stage, the Proposal is likely to become the final committed block. Under normal network conditions, one round of consensus can usually complete the current height block. At this time, if the transaction in the Proposal is processed in advance, the second half of the consensus process will be carried out simultaneously with the execution of the transaction. After the Executor has processed it, it waits for Consensus to send the confirmed Block. At this time, the Executor only needs to determine whether this Proposal is a consensus Block. If it is, it will directly Finalize the processing result and notify Consensus to reach a new height consensus; if not, it will be reprocessed. This situation is consistent with the process without pre-execution, that is, it is executed in the traditional way. In the traditional Tendermint consensus mechanism, the block proposal needs to go through multiple steps before it can be finally submitted to the blockchain. These steps include prevoting, precommitting, and finally committing. In this process, the validator usually starts processing transactions after the pre-commit step, which may cause processing delays. If a block does not comply with the consensus rules, it may be rejected by validators.
[0094] In this way, in most cases, blocks can be processed in advance, bringing forward the time of transaction processing. Even in the worst case, when multiple rounds of consensus are carried out, Proposals can be compared according to timestamps, interrupting the current preprocessing and executing the updated Proposal. Figure 5 In the worst case, if no proposal is received or an incorrect proposal is received, the Executor will follow the same consensus process as before without any performance loss.
[0095] The application of optimistic consensus block processing is as follows:
[0096] The core idea of optimistic block processing is that validators process transactions in blocks in advance while waiting for the consensus process to complete, so that the processing results can be submitted quickly after consensus is reached. This can significantly reduce the total transaction processing time.
[0097] In the traditional Tendermint consensus mechanism, block proposals need to go through multiple steps before they can be finally submitted to the blockchain. These steps include prevote, precommit, and final commit. In this process, validators usually start processing transactions after the precommit step, which may cause processing delays. If the block does not meet the consensus rules, it may be rejected by the validator. The node will get the first block of any given height that the validator will receive, run a sanity check and start processing it simultaneously during the prevote and precommit. Optimistic block processing then writes the candidate state to the cache.
[0098] Validators can process transactions immediately upon receiving a valid block proposal, rather than waiting until the pre-commit step is complete. The logic behind this approach is that in most cases, the first proposed block at any given height is the block that is accepted after voting. Therefore, processing transactions immediately from the first block can take advantage of this possibility. If the block is accepted, the optimistic candidate state cache will be immediately committed to the blockchain. Figure 6 shown.
[0099] In addition, the method of the present invention further comprises:
[0100] Before deploying a smart contract to the blockchain, the source code of the smart contract is compiled and optimized to obtain a precompiled contract. Before executing the precompiled contract, the object of the precompiled contract is obtained according to the smart contract address. The corresponding precompiled contract is executed on the object of the precompiled contract. The smart contract static analysis is applied to the execution result of the precompiled contract to obtain a vulnerability detection report.
[0101] In practical applications, precompiled contracts refer to converting the source code of a smart contract into a form closer to machine language before it is deployed on the blockchain. This process usually includes compilation (converting high-level languages into low-level languages) and optimization (improving code execution efficiency) to generate an efficient executable code. The specific steps are as follows:
[0102] 1. When executing a precompiled contract, you first need to obtain the object of the precompiled contract according to the contract address.
[0103] 2. Each precompiled contract object will implement the call interface, and the specific logic of the precompiled contract is implemented in this interface. Figure 7 shown.
[0104] 3.Call obtains the Function Selector and parameters according to the transaction ABI code, and then executes the corresponding logic.
[0105] 4. Static analysis of smart contracts, including:
[0106] Step 1: The static analysis tool builds a control flow graph based on the Wasm bytecode, then loads, parses, instantiates the Wasm bytecode, and constructs the corresponding Wasm instance.
[0107] Step 2: The Wasm instance will be handed over to the symbolic execution engine for symbolic execution and collect the corresponding path information. In this stage, the Z3 solver will be used to assist symbolic execution.
[0108] Specifically, the Z3 solver can be used to perform constraint solving when encountering branch instructions to prune the symbolic execution process. The Z3 solver can also be used to perform reverse solving when discovering Rust application vulnerabilities to obtain the input value or input range that can enter the vulnerable branch.
[0109] Step 3: Generate a corresponding vulnerability detection report using the path information and vulnerability detection algorithm. The vulnerability analysis module and the symbolic execution module are executed crosswise. When the symbolic execution is completed, the overall vulnerability detection work is also completed, and a corresponding vulnerability detection report will be generated. Figure 8 shown.
[0110] The present invention has the following advantages:
[0111] At present, most blockchain platforms use serial transaction execution or parallel execution based on access status. The former has low execution efficiency, and the latter requires users to define the dependencies between transactions, which is cumbersome, and there is no audit and analysis of smart contracts. The present invention has made improvements in consensus and transaction execution, using optimistic parallel execution technology, smart block propagation and optimistic block execution to significantly improve the execution efficiency and block efficiency of transactions, and uses static analysis technology to convert smart contracts into binary bytecode files for static analysis in the form of symbolic execution, thereby improving the security of smart contracts.
[0112] For the optimistic parallel execution approach, there is also state access parallel execution. In the state access parallel execution model, the network starts by classifying transactions based on their impact on the network state. The various impacts include interactions with specific smart contracts or accounts, which helps determine which transactions can be processed in parallel without conflict. Transactions that do not interact can be executed simultaneously. Conversely, transactions that affect similar state factors are processed in a specific order, with the order priority determined by gas fees.
[0113] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0114] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the method and core idea of the present invention. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A transaction optimization and security enhancement method based on Changan Chain, characterized in that: The method comprises: Get multiple transactions to be agreed upon; At preset intervals, the blockchain consensus master node determines a preset number of the pending consensus transactions as initial execution transactions, and applies an optimistic parallel transaction execution algorithm based on random conflict detection to each of the initial execution transactions for pre-execution operations to obtain multiple candidate blocks; The blockchain consensus master node applies a block intelligent propagation method to send each of the candidate blocks to the consensus slave node; The consensus slave node applies the optimistic consensus block processing method to perform transaction verification on each candidate block to obtain a verification result; the verification result includes passing the verification and failing the verification; When the verification result of the candidate block is passed, the candidate block is a consensus block, and the consensus block is submitted; When the verification result of the candidate block is that it fails the verification, the initial execution transaction represented by the candidate block is used as the transaction to be agreed upon, and the process returns to the step "Every preset time, the blockchain consensus master node determines a preset number of the transactions to be agreed upon as initial execution transactions, and applies an optimistic parallel transaction execution algorithm based on random conflict detection to each of the initial execution transactions for pre-execution operations, thereby obtaining multiple candidate blocks" to continue execution.
2. The transaction optimization and security enhancement method based on Changan Chain according to claim 1 is characterized in that: The optimistic parallel transaction execution algorithm based on random conflict detection is applied to each of the initial execution transactions to perform a pre-execution operation to obtain multiple candidate blocks, specifically including: The blockchain consensus master node performs parallel execution operations on each of the initial execution transactions, records the write operations of all the initial execution transactions in a memory cache, and obtains multiple candidate blocks.
3. The transaction optimization and security enhancement method based on Changan Chain according to claim 2 is characterized in that: All write operations of the initial execution transaction are recorded in the memory cache to obtain multiple candidate blocks, including: Determine whether the keys in the read set after and before the execution of each of the initial execution transactions are consistent; When the key in the read set after the initial execution transaction is executed is consistent with the key in the read set before the execution is completed, all write operations of the initial execution transaction are recorded in the memory cache to obtain multiple candidate blocks; When the key in the read set of the initial execution transaction is inconsistent after the execution is completed and before the execution is completed, the initial execution transaction is used as a pending consensus transaction, and the pending consensus transaction is updated, and the process returns to the step "Every preset time, the blockchain consensus master node determines a preset number of pending consensus transactions as initial execution transactions, and applies an optimistic parallel transaction execution algorithm based on random conflict detection to each of the initial execution transactions for pre-execution operations to obtain multiple candidate blocks" to continue execution.
4. The transaction optimization and security enhancement method based on Changan Chain according to claim 1 is characterized in that: The consensus slave node applies the optimistic consensus block processing method to perform transaction verification on each candidate block to obtain a verification result, which specifically includes: The blockchain consensus receives the Proposal from the master node in the Prevote phase and uses the Proposal as a block in the Commit phase; Executor processes the transactions in Proposal and obtains the processing block; Executor receives the consensus block sent by Consensus; Executor determines whether the processing block is consistent with the consensus block; When the confirmation block is consistent with the consensus block, the verification result is passed; When the confirmation block is inconsistent with the consensus block, the verification result is failure to pass the verification.
5. The transaction optimization and security enhancement method based on Changan Chain according to claim 1 is characterized in that: The blockchain consensus master node applies a block intelligent propagation method to send each candidate block to the consensus slave node, specifically including: The validator receives the candidate block and adds the candidate block to the local transaction pool; The proposer proposes a block to be submitted based on the status of all local transaction pools; the block to be submitted contains all transaction contents existing in all local transaction pools; The proposer sends the block to be submitted to the validator.
6. The transaction optimization and security enhancement method based on Changan Chain according to claim 1 is characterized in that: The method further comprises: Before deploying the smart contract to the blockchain, the source code of the smart contract is compiled and optimized to obtain a precompiled contract; Before executing the precompiled contract, obtain the object of the precompiled contract according to the smart contract address; Execute the corresponding precompiled contract on the object of the precompiled contract.
7. The transaction optimization and security enhancement method based on Changan Chain according to claim 6 is characterized in that: After executing the step "executing the corresponding precompiled contract on the object of the precompiled contract", the method further includes: Apply smart contract static analysis to the execution result of the precompiled contract to obtain a vulnerability detection report.
Citation Information
Patent Citations
Alliance chain-oriented transaction parallel processing method and system
CN113205417A
Block chain transaction stepless prediction execution method and system
CN114416765A
Optimistic concurrency control method for fragmented block chain
CN117834153A
Two-stage parallel Byzantine consensus method and system and computer readable storage medium
CN118449677A
Block chain consensus method and device, computer equipment and storage medium
CN118474114A