A transaction optimization and security enhancement method based on Changan Chain

By introducing optimistic parallel transaction execution and security audit mechanisms on the Changan Chain, the transaction processing order is optimized, the problem of low efficiency in high-concurrency transaction processing on the blockchain is solved, and the transaction processing speed and security are improved.

CN119652898BActive Publication Date: 2025-09-23BEIJING INFORMATION SCI & TECH UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411492446.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-24
Publication Date
2025-09-23
Estimated Expiration
2044-10-24

AI Technical Summary

Technical Problem

Existing blockchain technology is inefficient and insecure in processing high-concurrency transactions, especially in high-transaction volume situations, leading to network congestion and increased transaction costs.

Method used

A transaction optimization and security enhancement method based on Changan Chain is adopted, including the introduction of optimistic parallel transaction execution algorithm, pre-execution technology and security audit mechanism to optimize the transaction processing sequence and improve the execution efficiency and security of smart contracts.

Benefits of technology

Through parallel transaction execution and security audit mechanisms, the transaction processing speed and security are significantly improved, solving the problem of low efficiency in high-concurrency transaction processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119652898B_ABST
    Figure CN119652898B_ABST
Patent Text Reader

Abstract

The present invention discloses a transaction optimization and security enhancement method based on Changan Chain, which relates to the field of blockchain technology. The method includes: obtaining multiple transactions to be agreed upon; at preset intervals, the blockchain consensus master node determines a preset number of transactions to be agreed upon as initial execution transactions, and applies an optimistic parallel transaction execution algorithm based on random conflict detection to each initial execution transaction to perform pre-execution operations to obtain multiple candidate blocks; the blockchain consensus master node applies a block intelligent propagation method to send each candidate block to a consensus slave node; the consensus slave node applies an 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; when the verification result of a candidate block is passed verification, the candidate block is a consensus block, and the consensus block is submitted. The present invention can improve transaction processing speed and security.
Need to check novelty before this filing date? Find Prior Art

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] Existing blockchain technology, due to its Proof-of-Work (PoW) consensus mechanism, results in slow processing speeds. This is particularly true when the number of users increases significantly, leading to network congestion and prolonged transaction confirmation times. This inefficient processing method not only consumes significant computing resources but also increases transaction costs. Summary of the Invention

[0004] In order to solve the shortcomings of existing blockchain systems in high-concurrency transaction processing and security, the present invention provides a transaction optimization and security enhancement method based on Changan Chain, which can optimize the transaction processing sequence, improve the execution efficiency of smart contracts, and enhance 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 predetermined intervals, the blockchain consensus master node determines a predetermined 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 to perform a pre-execution operation to obtain multiple candidate blocks;

[0009] The blockchain consensus master node applies a block intelligent propagation method to send each candidate block 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 passed verification and failed verification;

[0011] When the verification result of the candidate block is passed, the candidate block is the consensus block, and the consensus block is submitted;

[0012] When the verification result of the candidate block is failure to pass the verification, the initial execution transaction represented by the candidate block is used as the pending consensus transaction, 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 operation to obtain multiple candidate blocks" to continue execution.

[0013] Optionally, a pre-execution operation is performed on each of the initially executed transactions using an optimistic parallel transaction execution algorithm based on random conflict detection 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 sets 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 completed 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 after the execution of the initial execution transaction is inconsistent with that 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 the optimistic parallel transaction execution algorithm based on random conflict detection to each of the initial execution transactions for pre-execution operation 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 candidate block to obtain a verification result, specifically including:

[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] The Executor determines whether the processed block is consistent with the consensus block;

[0024] When the processed block is consistent with the consensus block, the verification result is passed;

[0025] When the processing 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 it 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 in all local transaction pools.

[0029] The proposer sends the block to be submitted to the validator.

[0030] Optionally, the method further includes:

[0031] Before deploying a 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 Changan Chain. By introducing an optimized transaction execution parallel mechanism, pre-execution technology and security audit mechanism, it solves the problems of low efficiency in high-concurrency transaction processing and smart contract security, 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 following briefly introduces the drawings required for use in the embodiments. 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 any 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 the parallel scheduling algorithm flow 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 Schematic diagram of the block intelligent propagation process provided by Example 1 of the present invention;

[0043] Figure 5 Schematic diagram of the optimistic consensus block processing flow provided by Example 1 of the present invention;

[0044] Figure 6 A schematic diagram of the block proposal process in the traditional consensus mechanism provided in Example 1 of the present invention;

[0045] Figure 7 Schematic diagram of the precompiled contract execution process provided in Example 1 of the present invention;

[0046] Figure 8 Schematic diagram of the smart contract static analysis process provided in Example 1 of the present invention. DETAILED DESCRIPTION

[0047] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. 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 making creative efforts 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:

[0052] Blockchain: A blockchain is a shared, immutable ledger designed to facilitate transaction recording and asset tracking within a business network. Assets can be tangible (such as houses, cars, cash, and land) or intangible (such as intellectual property, patents, copyrights, and brands). Virtually anything of value can be tracked and traded on a blockchain network, reducing risks and costs across all aspects.

[0053] Smart contracts: Smart contracts are simply programs stored on a blockchain that execute when predetermined conditions are met. Smart contracts are often used to automate agreements so that all participants can instantly determine the outcome without the involvement of any middlemen or wasted time. Smart contracts can also automate workflows, triggering the next action when conditions are met.

[0054] Consensus algorithm: A mechanism for reaching consensus on a particular issue among multiple participants in a distributed system. Even if these participants may hold different opinions, the algorithm ensures that they ultimately agree on a single source of truth. Simply put, the goal of a consensus algorithm is to ensure that all agents in the system ultimately reach agreement 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: Obtain multiple transactions to be agreed upon.

[0057] Step S2: 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.

[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 validator.

[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 a 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: The Executor determines whether the processed block is consistent with the consensus block.

[0071] Step S45: When the processed block is consistent with the consensus block, the verification result is passed.

[0072] Step S46: When the processing block is inconsistent with the consensus block, the verification result is failure to pass the verification.

[0073] In this invention, Proposal represents the proposal phase, during which the leader node packages blocks and broadcasts them to follower nodes. Prevote represents the pre-voting phase, during which follower nodes, after receiving and verifying the validity of a proposal, broadcast their prevote votes to other nodes. Precommit represents the pre-committing phase, during which a node, after receiving more than two-thirds of the prevote votes for a proposal, broadcasts its precommit vote to other nodes. Commit represents the committing phase, during which a node, after receiving more than two-thirds of the precommit votes for a proposal, commits the blocks in the proposal to the ledger. This is the TBFT consensus process: the master node initiates a block proposal and broadcasts it, which is the proposal phase. After receiving the broadcast, the slave node enters the prevote phase, 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 the 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 pending consensus transaction, and the process returns to step S2 to continue execution.

[0076] In practical applications, the present invention is based on optimistic parallel transaction execution with random conflict detection. 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 stages, 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) by proposing nodes, and ensures that verification nodes can execute and obtain the same results. In the DAG, nodes represent transactions, and edges represent the happens-before relationship between transactions. When verifying blocks, other nodes in the network can verify 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, the main idea of ​​the Changan Chain parallel scheduling algorithm is that transactions are divided into two steps: execution and effectiveness. If the read set of the 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 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 keys in the read set have been modified by other transactions. If not, apply the write set of the transaction (ApplyTxSimContext). If modified by other transactions, add the transaction back to the queue for execution and re-execute.

[0081] 3. After all transactions are executed, a DAG is constructed by analyzing the read and write sets of all transactions. If there are read-write, write-read, or write-write conflicts between transactions, edges in the DAG are constructed based on the order in which they were executed.

[0082] Because 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 applies 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: This is a queue of transactions that have passed the transaction validity check and anti-duplicate check and are waiting to be packaged. (2) Pending Cache: This is a queue of transactions that have been packaged into blocks and are currently undergoing consensus.

[0085] During the execution of received transactions, the transaction pool handles 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 transaction pool's queue after verification.

[0086] When constructing a block, the Core module of the master node will fetch a batch of transactions from the transaction pool to construct a new block. At this time, the transaction pool will move the batch of transactions from the waiting queue to the packaged pending cache.

[0087] When verifying a block, a slave node retrieves the transactions in the block from the transaction pool. For transactions in the node's transaction pool, the Core module only needs to compare the hashes of the transactions in the block and the transaction pool (because the transaction pool has already performed relevant checks). For transactions not in the node's transaction pool, the Core module needs to perform transaction validity checks and anti-duplicate checks. After verifying the validity of the block, the Core module will notify the transaction pool to move the transactions in the block from the pending queue to the already packaged pending cache.

[0088] After reaching 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 pending queue, 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, for example, 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 randomly broadcasts it 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 already 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 transactions) to the network in chunks. If the validator already has all the transactions in the proposal in its local transaction pool, it will reconstruct the entire block directly from the transaction pool without waiting for all the partial blocks to arrive. This reduces the time validators need to wait for blocks to arrive.

[0093] The principle of optimistic consensus block processing is that, during the actual consensus process, after a node receives and validates a proposal during the prevote phase, it has a high probability of becoming the final committed block. Under normal network conditions, a single round of consensus typically completes the block at the current height. If transactions in the proposal are processed in advance, the second half of the consensus process occurs concurrently with transaction execution. After the executor completes processing, it waits for Consensus to send a confirmed block. At this point, the executor simply determines whether the proposal is a consensus block. If so, it directly finalizes the processing result and notifies Consensus to reach consensus at a new height. If not, it reprocesses the proposal. This scenario is consistent with the traditional process without pre-execution. In the traditional Tendermint consensus mechanism, block proposals undergo multiple steps before being submitted to the blockchain. These steps include pre-vote, pre-commit, and finally commit. During this process, validators typically begin processing transactions after the pre-commit step, which can 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 continue to 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 go through multiple steps before being submitted to the blockchain. These steps include prevote, precommit, and finally commit. During this process, validators typically begin processing transactions only after the precommit step, which can cause processing delays. If a block does not comply with the consensus rules, it may be rejected by validators. Nodes retrieve the first block of any given height that a validator will accept, run sanity checks, and begin processing it simultaneously during the prevote and precommit periods. Optimistic block processing then writes the candidate state to the cache.

[0098] Validators can process transactions immediately after 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 will be 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 submitted to the blockchain immediately. 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 is compiled and optimized to create a precompiled contract. Before executing the precompiled contract, the precompiled contract object is retrieved based on the smart contract address. The corresponding precompiled contract is executed against the precompiled contract object. Smart contract static analysis is applied to the execution results of the precompiled contract to generate a vulnerability detection report.

[0101] In practice, pre-compiling a contract means converting the source code of a smart contract into a form closer to machine language before deploying it to the blockchain. This process typically involves compilation (converting high-level language into low-level language) and optimization (improving code execution efficiency), resulting in an efficient executable code. The specific steps are as follows:

[0102] 1. When executing a precompiled contract, you first need to obtain the precompiled contract object based on 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 based on 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, and instantiates the Wasm bytecode and constructs the corresponding Wasm instance.

[0107] Step 2: The Wasm instance is handed over to the symbolic execution engine for symbolic execution and collection of corresponding path information. During this stage, the Z3 solver is 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 corresponding vulnerability detection reports using path information and vulnerability detection algorithms. The vulnerability analysis module and symbolic execution module are executed crosswise. When the symbolic execution is completed, the overall vulnerability detection work is also completed, and finally a corresponding vulnerability detection report will be generated. Figure 8 shown.

[0110] The present invention has the following advantages:

[0111] Currently, most blockchain platforms use serial transaction execution or access-state-based parallel execution. The former suffers from low execution efficiency, while the latter requires users to define dependencies between transactions, which is cumbersome and lacks auditing and analysis of smart contracts. This paper improves consensus and transaction execution by employing optimistic parallel transaction execution technology, intelligent block propagation, and optimistic block execution, significantly improving transaction execution efficiency and block generation efficiency. Furthermore, static analysis technology is used to convert smart contracts into binary bytecode files for static analysis via symbolic execution, enhancing the security of smart contracts.

[0112] Another approach to optimistic parallel execution is state access parallel execution. In this model, the network initially categorizes transactions based on their impact on the network state. This impact, including interactions with specific smart contracts or accounts, helps determine which transactions can be processed in parallel without conflict. Non-interacting transactions can be executed simultaneously. Conversely, transactions that affect similar state factors are processed in a specific order, with gas costs determining the priority.

[0113] The technical features of the above embodiments can 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] This document uses specific examples to illustrate the principles and implementation methods of the present invention. The above examples are only intended to help understand the method and core concept of the present invention. At the same time, those skilled in the art will find that the specific implementation methods and application scopes may vary based on the concept of the present invention. In summary, the contents of this specification should not be construed 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 predetermined intervals, the blockchain consensus master node determines a predetermined 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 to perform a pre-execution operation to obtain multiple candidate blocks; The blockchain consensus master node applies a block intelligent propagation method to send each candidate block 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 passed verification and failed verification; When the verification result of the candidate block is passed, the candidate block is the consensus block, and the consensus block is submitted; When the verification result of the candidate block is failure to pass the verification, the initial execution transaction represented by the candidate block is used as the pending consensus transaction, and the process returns to 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 to perform a pre-execution operation to obtain 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: 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, thereby obtaining 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 transaction execution are recorded in the memory cache to obtain multiple candidate blocks, including: Determine whether the keys in the read sets 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 completed 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 after the initial execution transaction is executed is inconsistent with the key in the read set 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 to perform a pre-execution operation 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; The Executor determines whether the processed block is consistent with the consensus block; When the processed block is consistent with the consensus block, the verification result is passed; When the processing 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 it 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 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 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, 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 of "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 consensus method and device, computer equipment and storage medium

    CN118474114A