A method for verifying transactions during downloading of new blocks based on blockchain
By using smart contracts to enable other blocks to verify and reach consensus on transaction information while downloading data in a new blockchain block, the problem of time-consuming downloading of transaction information in a new block is solved, and the efficiency of the blockchain is improved.
Patent Information
- Application Number
- CN202210373644.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-06
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2042-04-06
Smart Images

Figure CN114881776B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of blockchain technology, and in particular to a method for verifying transactions during downloading of new block data based on blockchain. Background Art
[0002] Blockchain technology is a distributed ledger technology. The data information of the blockchain is stored in each block on the blockchain. The blockchain blocks are connected by hash chains. Each block of the blockchain corresponds to an accounting node, and all the accounting nodes of the blockchain have the block information of all the blocks on the blockchain.
[0003] Blockchain blocks are formed one by one, and the time interval between the formation of two blocks is called a blockchain accounting cycle. New blocks will be formed in a blockchain accounting cycle. The new block must first download all transaction information of other blocks in the blockchain to work properly. When there is too much transaction information in the blockchain, it will take a lot of time for the new block to download all transaction information of other blocks, which reduces the efficiency of the blockchain. Summary of the Invention
[0004] To overcome the problems existing in the above technologies, the present invention provides a method for verifying transactions during the download of new block data based on blockchain, the method comprising:
[0005] Establish a smart contract for a new blockchain block to accept transaction information from other blockchain blocks;
[0006] The smart contract is as follows: when a new block of the blockchain is newly formed and the blockchain data is being downloaded, other blocks of the blockchain verify the transaction information that is occurring and reach a consensus on the verified transaction information;
[0007] After the newly formed block in the blockchain finishes downloading the data in the blockchain, it accepts the transaction information that other blocks in the blockchain have reached consensus on during the data download period. That is, it reaches a consensus on the transaction information together with other blocks, forming a consensus on the transaction information among all blocks in the blockchain.
[0008] The smart contract for establishing a new blockchain block to accept consensus on transaction information from other blockchain blocks includes: during the period when the new blockchain block downloads data, other blocks verify the transaction information occurring in the blockchain; after the new blockchain block completes downloading data, the new block accepts the joint verification result of the transaction information from other blocks on the blockchain, that is, the consensus result.
[0009] The other blocks of the blockchain verify the ongoing transaction information, including: the other blocks of the blockchain verify the legitimacy of the transaction information; if the blockchain block verifies that the balance of the transaction information is sufficient and the signature information is correct, then the block determines that the transaction information is legal; if the blockchain block verifies that the transaction information does not meet any one of the sufficient balance and correct signature information, then the block determines that the transaction information is illegal; after verifying the transaction information, each block of the blockchain broadcasts the verification results in the blockchain network.
[0010] The said reaching a consensus on the verified transaction information includes: the blockchain counts the number of blocks that determine the transaction information to be qualified, analyzes the number of blocks that determine the transaction information to be qualified and the total number of blocks involved in verifying whether the transaction information is qualified, and finally determines whether the transaction information is qualified through the blockchain consensus mechanism.
[0011] The consensus reached on the verified transaction information also includes: according to the blockchain consensus mechanism, the transaction information is qualified only when the ratio of the number of blocks that determine the transaction information is qualified to the total number of blocks involved in verifying whether the transaction information is qualified is greater than 1 / 2.
[0012] After the newly formed block of the blockchain completes downloading the data in the blockchain, the transaction information on which the other blocks of the blockchain reach consensus during the data download period is accepted, including: after the new block of the blockchain completes downloading the data, the consensus result of the other blocks on the transaction information data during the period of extracting the download data, and accepting the consensus, that is, the new block of the blockchain and the other blocks reach a consensus on the transaction information data together.
[0013] After the newly formed block of the blockchain completes downloading the data in the blockchain, the transaction information on which the other blocks of the blockchain reach consensus during the data downloading period also includes: after the newly formed block of the blockchain completes downloading the data in the blockchain, the new block of the blockchain and other blocks together verify the transaction information just obtained by the blockchain, and broadcast the verification results in the blockchain network. The blockchain system performs a consensus algorithm on the verification results of the transaction information of each block to reach a consensus on the transaction information of each block of the blockchain.
[0014] The beneficial effects of the present invention are:
[0015] The present invention establishes a smart contract when a new block of the blockchain is just formed and the historical data of the blockchain is downloaded. During the period when the new block is downloading data, other blocks on the blockchain reach a consensus on the newly received transaction information of the blockchain. After the new block has finished downloading data, the result of the consensus reached by other blocks on the blockchain on the transaction information is regarded as the consensus reached by the new block on the transaction information. That is, the new block does not need to verify such transaction information again and can directly reach a consensus on such transaction information. During the period when the new block is downloading data, other blocks on the blockchain replace the new block to work on the blockchain, thereby improving the performance of the blockchain. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 : A flowchart of a method for verifying transactions during downloading data of a new block based on blockchain.
[0017] Figure 2 : Workflow diagram of a new block in the blockchain.
[0018] Figure 3 : Flowchart of the method for reaching a network-wide consensus during the download of new block data. DETAILED DESCRIPTION
[0019] The following is a detailed description of the specific embodiments of the present invention in conjunction with the accompanying drawings. It should be understood that the specific embodiments given here are only used to illustrate and explain the present invention and cannot be used to limit the present invention.
[0020] like Figure 1 As shown: a flowchart of a method for verifying transactions during data downloading of a new block based on blockchain; the flowchart includes the following steps: step S100, establishing a smart contract for the new blockchain block to accept the consensus of transaction information reached by other blocks in the blockchain; step S101, the smart contract is: when a new block of the blockchain is just formed, during the period of downloading blockchain data, other blocks in the blockchain verify the ongoing transaction information and reach a consensus on the verified transaction information; step S102, after the newly formed block of the blockchain completes downloading the data in the blockchain, it accepts the transaction information reached by consensus by other blocks in the blockchain during the data downloading period, that is, reaches a consensus on the transaction information together with other blocks, and forms a consensus on the transaction information among all blocks in the blockchain.
[0021] Specifically, a smart contract is a string of code added to the blockchain encoding; when a new block of the blockchain is just formed, it needs to download the historical data information in the blockchain before it can work normally, which will greatly affect the working efficiency of the blockchain; the present invention first establishes a smart contract for the new blockchain block to accept the consensus of transaction information reached by other blocks in the blockchain, activates the smart contract, and enables the new blockchain block to download the historical data information in the blockchain while the other blocks analyze and verify the transaction information in the blockchain, and through the blockchain consensus mechanism, the nodes corresponding to each block reach a consensus on the transaction information, and broadcast the consensus result in the blockchain network; after the new blockchain block finishes downloading the data, the new block will accept the consensus result of the other blocks on the transaction information within the period, and reach a consensus with other blocks on the legitimacy of the transaction information, thereby achieving the purpose of achieving consensus across the entire network.
[0022] Step S100, establishing a smart contract for a new blockchain block to accept the consensus reached on transaction information by other blockchain blocks; specifically, adding a string of codes for a smart contract for a new blockchain block to accept the consensus reached on transaction information by other blockchain blocks to the coding program of the blockchain.
[0023] Preferably, the method for activating the smart contract is: activating the smart contract each time a new block is generated on the blockchain.
[0024] Step S101, the smart contract is: when a new block of the blockchain is newly formed and downloading blockchain data, other blocks on the blockchain verify the ongoing transaction information and reach a consensus on the verified transaction information; specifically, when the smart contract is activated, while the new block of the blockchain is downloading data, other blocks on the blockchain will replace the new block to analyze and verify the newly obtained transaction information data of the blockchain, and reach a consensus on the verification results through the blockchain consensus mechanism; when the new block of the blockchain completes downloading data, the new block will accept the consensus results of the other blocks on the transaction information.
[0025] Specifically, the method for other blocks of the blockchain to verify the transaction information that is occurring is as follows: other blocks of the blockchain verify the legitimacy of the transaction information. If the blockchain block verifies that the balance of the transaction information is sufficient and the signature information is correct, then the block determines that the transaction information is legal; if the blockchain block verifies that the transaction information does not meet any of the conditions of sufficient balance and correct signature information, then the block determines that the transaction information is illegal; after verifying the transaction information, each block of the blockchain broadcasts the verification results in the blockchain network.
[0026] Specifically, the method for reaching a consensus on the verified transaction information is as follows: the blockchain counts the number of blocks that determine the transaction information to be qualified, analyzes the number of blocks that determine the transaction information to be qualified and the total number of blocks that participate in verifying whether the transaction information is qualified, and finally determines whether the transaction information is qualified through the blockchain consensus mechanism; usually, according to the blockchain consensus mechanism, the transaction information is qualified only when the ratio of the number of blocks that determine the transaction information to the total number of blocks that participate in verifying whether the transaction information is qualified is greater than 1 / 2.
[0027] In step S102, after the newly formed block of the blockchain has completed downloading the data in the blockchain, it accepts the transaction information that has been agreed upon by other blocks in the blockchain during the data download period, that is, it reaches a consensus on the transaction information with other blocks, forming a consensus on the transaction information among all blocks in the blockchain. Specifically, the new block of the blockchain can only work normally after it has completed downloading the historical transaction information in the blockchain. At the same time, the new block of the blockchain will obtain the consensus verification result of the transaction information within the period of time during the data download period from other blocks. The new block of the blockchain will accept the consensus result, reach a consensus on the legitimacy of the transaction information with other blocks, write the legal transaction information into the new block of the blockchain, and deny further access to illegal transaction information.
[0028] Specifically, after the newly formed block of the blockchain completes downloading the data in the blockchain, the method for accepting the transaction information reached by consensus by other blocks of the blockchain during the data download period is as follows: after the new block of the blockchain completes downloading the data, the consensus results of the transaction information data within the period of downloading the data are extracted from other blocks, and the consensus results of the transaction information within the period of downloading the data are accepted by other blocks, that is, the new block of the blockchain and other blocks reach a consensus on the transaction information data together.
[0029] Preferably, after the newly formed block of the blockchain completes downloading the data in the blockchain, it accepts the transaction information on which consensus has been reached in other blocks of the blockchain during the data download period, and writes the consensus transaction information into the block of the blockchain. At the same time, the blockchain will enter a new accounting cycle. At this time, the new block of the blockchain and other blocks together verify the transaction information just obtained by the blockchain, and broadcast the verification results in the blockchain network. The blockchain system performs a consensus algorithm on the verification results of each block on the transaction information to reach a consensus on the transaction information among the blocks of the blockchain.
[0030] like Figure 2As shown: is a workflow diagram for a new block in the blockchain; the flowchart includes the following steps: Step S200, during the blockchain data download period, the new block is activated to accept the smart contract that reaches consensus on transaction information with other blocks in the blockchain; Step S201, other blocks other than the new block on the blockchain verify the transaction information and reach a consensus; Step S202, after the new block completes downloading data, it accepts the verification results of the transaction information from other blocks and reaches a consensus on the transaction information with other blocks; Step S203, after the new block completes downloading data, the new block verifies the newly received transaction information on the blockchain according to the blockchain block verification rules.
[0031] Step S200, during the blockchain data download period, activate the smart contract for the new block to accept the consensus reached on transaction information by other blocks in the blockchain; specifically, this step is the step of activating the blockchain smart contract; specifically, when the new blockchain block is just formed, activate the smart contract for the new block to accept the consensus reached on transaction information by other blocks in the blockchain, that is, the generation of the new blockchain block and the activation of the smart contract are carried out simultaneously.
[0032] In step S201, other blocks on the blockchain, except the new block, verify the transaction information and reach a consensus. Specifically, after activating the smart contract on the new block to accept the consensus reached on the transaction information by other blocks on the blockchain, the new block on the blockchain cannot work normally during the data download period. At this time, other blocks on the blockchain, except the new block, will work normally, verify the newly obtained transaction information on the blockchain, and broadcast the verification results in the blockchain. The blockchain processes the verification results of the transaction information by other blocks in combination with the blockchain consensus mechanism to reach a consensus on the transaction information by other blocks on the blockchain, and broadcasts the consensus results in the blockchain.
[0033] In step S202, after the new block has finished downloading the data, it accepts the verification results of the transaction information from other blocks and reaches a consensus on the transaction information with other blocks. Specifically, after the new block of the blockchain has finished downloading the blockchain historical data, it extracts the consensus results of the transaction information within the period from other blocks in the blockchain network. The new block will directly accept the consensus results and reach a consensus on the transaction information within the period with other blocks, and write the consensus transaction information into the block of the blockchain.
[0034] In step S203, after the new block has finished downloading data, it verifies the newly received transaction information of the blockchain according to the blockchain block verification rules. Specifically, after the new block finishes downloading data and writes the legal transaction information verified during the formation process and data downloading of the new block into the new block, the next accounting cycle of the blockchain will begin. In the new accounting cycle, the newly formed new block in the previous round will analyze and verify the transaction information of the new accounting cycle together with all other blocks, and send the verification results to the blockchain network for broadcast, thereby reaching the block node consensus of the entire blockchain.
[0035] like Figure 3 As shown: is a flow chart of a method for reaching a network-wide consensus during the downloading of data by a new block; the flow chart includes the following steps: Step S300, when a new block in the blockchain downloads transaction information, other blocks other than the new block reach a consensus on the transaction information; Step S301, after the new block downloads the information, it receives the consensus results of other blocks on the transaction information; Step S302, the new block and other blocks reach a consensus on the transaction information together, that is, reach a network-wide consensus.
[0036] In step S300, when a new block in the blockchain downloads transaction information, other blocks outside the new block reach a consensus on the transaction information. Specifically, when a new block in the blockchain downloads historical data information in the blockchain, other blocks in the blockchain verify the transaction information received by the blockchain during that period, and reach a consensus on the transaction information within that period among other blocks outside the new block in the blockchain through the blockchain consensus mechanism.
[0037] Step S301: After the new block downloads the information, it receives the consensus results of other blocks on the transaction information. Specifically, after the new block of the blockchain completes downloading the historical data information in the blockchain, it extracts the consensus results of other blocks in the blockchain on the transaction information within the period of downloading the data and obtains the consensus results.
[0038] In step S302, the new block and other blocks reach a consensus on the transaction information, that is, a network-wide consensus is reached. Specifically, the new block on the blockchain accepts the consensus results of other blocks on the blockchain on the transaction information that occurred during the data download period. That is, the new block on the blockchain and other blocks reach a consensus on the transaction information verified during the data download period, and a network-wide consensus on the transaction information is reached on the blockchain.
[0039] It should be understood that the above embodiments are one or more embodiments of the present invention, and there are many other embodiments and variations thereof based on the present invention; the variations and modifications made by ordinary technicians in this industry through the present invention without making groundbreaking innovations all fall within the scope of protection of the present invention.
Claims
1. A method for verifying transactions during downloading of new block data based on blockchain, characterized in that: The method comprises the following steps: Establish a smart contract for a new blockchain block to accept transaction information from other blockchain blocks; The smart contract is as follows: when a new block of the blockchain is newly formed and the blockchain data is being downloaded, other blocks of the blockchain verify the transaction information that is occurring and reach a consensus on the verified transaction information; After the newly formed block in the blockchain finishes downloading the data in the blockchain, it accepts the transaction information that other blocks in the blockchain have reached consensus on during the data download period. That is, it reaches a consensus on the transaction information together with other blocks, forming a consensus on the transaction information among all blocks in the blockchain.
2. A method for verifying transactions during downloading of new blocks based on blockchain according to claim 1, characterized in that: The smart contract for establishing a new blockchain block to accept consensus on transaction information from other blockchain blocks includes: during the period when the new blockchain block downloads data, other blocks verify the transaction information occurring in the blockchain; after the new blockchain block completes downloading data, the new block accepts the joint verification result of the transaction information from other blocks on the blockchain, that is, the consensus result.
3. A method for verifying transactions during downloading of new blocks based on blockchain according to claim 1, characterized in that: The other blocks of the blockchain verify the ongoing transaction information, including: if the other blocks of the blockchain verify that the balance of the transaction information is sufficient and the signature information is correct, then the transaction information is determined to be legal; if the transaction information verified by other blocks of the blockchain does not meet any of the conditions of sufficient balance and correct signature information, then the transaction information is illegal; after verifying the transaction information, each block of the blockchain broadcasts the verification results in the blockchain network.
4. A method for verifying transactions during downloading of new blocks based on blockchain according to claim 1, characterized in that: The said reaching a consensus on the verified transaction information includes: the blockchain counts the number of blocks that determine the transaction information to be qualified, analyzes the number of blocks that determine the transaction information to be qualified and the total number of blocks involved in verifying whether the transaction information is qualified, and finally determines whether the transaction information is qualified through the blockchain consensus mechanism.
5. A method for verifying transactions during downloading of new blocks based on blockchain according to claim 1, characterized in that: The reaching of consensus on the verified transaction information also includes: according to the blockchain consensus mechanism, the transaction information is qualified only when the ratio of the number of blocks that determine the transaction information is qualified to the total number of blocks involved in verifying whether the transaction information is qualified is greater than 1 / 2.
6. A method for verifying transactions during downloading of new blocks based on blockchain according to claim 1, characterized in that: After the newly formed block of the blockchain completes downloading the data in the blockchain, the transaction information on which the other blocks of the blockchain reach consensus during the data download period is accepted, including: after the new block of the blockchain completes downloading the data, the consensus result of the other blocks on the transaction information data during the data download period is extracted, and the consensus result is accepted, that is, the new block of the blockchain and the other blocks reach a consensus on the transaction information data together.
7. A method for verifying transactions during downloading of new blocks based on blockchain according to claim 1, characterized in that: After the newly formed block of the blockchain completes downloading the data in the blockchain, the transaction information on which the other blocks of the blockchain reach consensus during the data downloading period also includes: after the newly formed block of the blockchain completes downloading the data in the blockchain, the new block of the blockchain and other blocks together verify the transaction information just obtained by the blockchain, and broadcast the verification results in the blockchain network. The blockchain system performs a consensus algorithm on the verification results of the transaction information of each block to reach a consensus on the transaction information of each block of the blockchain.