Blockchain verification method, storage medium and device for realizing blockchain tamper-proof
By introducing national secret adapters and component configurations into the blockchain verification method, flexible verification of blockchain information is achieved, and the problem of inefficient verification in the existing technology is solved, and the system stability and applicability are improved.
Patent Information
- Application Number
- CN202111421426.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-26
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2041-11-26
AI Technical Summary
The existing blockchain verification methods have huge performance losses, resulting in low overall verification efficiency, which is not conducive to R&D efficiency and system stability.
A blockchain verification method was designed to achieve flexible verification of blockchain information through the national secret adapter and component configuration, support national secret algorithm and multi-file verification, reduce redundant steps, and improve verification efficiency.
It improves the efficiency of blockchain verification and the stability of the system, supports the application of more business scenarios, and realizes effective protection of blockchain tamper-proof.
Smart Images

Figure CN114021205B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of blockchain technology, and specifically relates to a blockchain verification method, storage medium and device for realizing blockchain tamper-proofing. Background Art
[0002] In order to ensure the legality of transactions and the security of the entire system, the blockchain will perform various checks during operation. Among them, the block anti-tampering check is the check of the integrity, signature, and signature chain of the block and its transactions.
[0003] The current block and transaction verification performance loss is huge, mainly reflected in the following: each block and each transaction and all its proposals and endorsements are subject to signature and identity certificate signature chain verification, resulting in low overall verification efficiency, which is not conducive to R&D efficiency and system stability.
[0004] Therefore, it is urgent to implement a new blockchain verification method to prevent blockchain tampering, realize flexible configuration of verification logic and application in more scenarios. Summary of the invention
[0005] Based on the above background and problems existing in the prior art, the present invention intends to design a blockchain verification method, storage medium and device to implement blockchain tamper-proofing, which can improve the verification performance after the verification logic is modified, adapt to the national secret algorithm and support multi-file verification, which is beneficial to improving the efficiency of the blockchain verification process and the stability of the system.
[0006] In the first aspect, in order to achieve these purposes and other advantages of the present invention, a blockchain verification method for realizing blockchain tamper-proofing is provided, and the specific implementation steps include:
[0007] The specified block ledger file is read through the national encryption adapter and its components with different national encryption algorithm verification directory configurations, and the ledger file is preliminarily verified to obtain the corresponding blockchain information; the blockchain information includes the block information, transaction information and signature information on the chain, and the signature information includes the signature of the block file and the certificate issuance chain associated with the block file;
[0008] Parse the blockchain information and select the specified chain type mode for verification; the verification process is adapted to the national secret algorithm, and the block ledger file is parsed into block information, transaction information and signature information to be verified; parse the blockchain information to obtain blocks and transactions, and verify the specified chain type mode, including verifying blocks and verifying transactions. Verifying blocks includes verifying the hash value, block number, signature and signature chain of the latest configuration block and metadata, and verifying transactions includes verifying the transaction certificate signature chain, transaction signature, transaction proposal certificate signature chain and endorsement certificate signature chain;
[0009] The national encryption adapter is configured with multiple plug-ins to obtain various types of verification results and compare them, and verify multiple files at the same time to ensure the integrity and correctness of blockchain information and realize blockchain tamper-proofing. The verification results are divided into multiple files due to the increase in the size of the account book, so they are obtained through multiple plug-ins, and each plug-in obtains the corresponding file.
[0010] In the above scheme, the block verification is specifically implemented by the following steps:
[0011] Initialize the parameters used for verification;
[0012] Start acquiring block information based on the parameters, initialize the server providing the block, and cache the information of the block to be verified;
[0013] Determine whether the block verification is legal, verify the cached information if the verification is legal, and return the verification result.
[0014] In the above scheme, the verification of the transaction is specifically implemented after the block is verified, and also includes multiple rounds of verification of the block verification results.
[0015] In the solution of the first aspect above, the verification of blockchain information includes the following specific implementation steps:
[0016] Get the hash value of the previous block of the block information to be verified on the chain for verification. If it is legal, perform the hash value verification of this block. If it is illegal, perform the metadata signature verification.
[0017] If the hash value of the block is legal, the verification result is output; if it is illegal, the transaction verification is started;
[0018] If the metadata signature verification is legal, the metadata signature chain verification is performed; if the metadata signature verification or metadata signature chain verification is illegal, the block abnormality verification result is output; if the metadata signature chain is legal, the transaction verification is performed;
[0019] The transaction verification includes verifying the legitimacy of the transaction signature. If it is legal, the transaction identity signature chain is verified. If it is illegal, the transaction abnormality verification result is output;
[0020] If the transaction identity signature chain verification is legal, the transaction proposal and endorsement verification are carried out; if it is illegal, the transaction abnormality verification result is output;
[0021] If the transaction proposal and endorsement verification pass, it is determined that the blockchain block to be verified and the transaction are normal.
[0022] In the solution of the first aspect above, each type of verification result is compared, and the specific implementation steps include:
[0023] Perform hash verification and comparison by comparing the current hash value with the calculated first hash value. If the two are the same, the verification passes or is legal;
[0024] Then the hash value of the current block is compared with the hash value calculated by the current block. If the two are the same, the verification passes or is legal;
[0025] If the block number of the latest configuration block of the current block is less than or equal to the block number of the current block, the verification is passed or legal;
[0026] Verify each signature of the metadata of the current block and verify its certificate signature chain. If the verification passes, the verification passes or is legal.
[0027] In a second aspect, the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and wherein the computer program implements the above-mentioned method steps when executed by a processor.
[0028] In a third aspect, the present invention also provides a blockchain verification device for realizing blockchain tamper-proofing, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method steps described above when executing the computer program.
[0029] Compared with the prior art, the present invention is based on the transformation and optimization of the verification logic of block chain anti-tampering, sets conditions in block verification, signature and signature chain verification, transaction signature and transaction identity signature chain verification to judge their legitimacy, reduces redundant steps, and improves verification efficiency; at the same time, it also supports national secret algorithm adaptation and multi-file verification, realizes the expansion of verification function, enables it to be applied to more business scenarios, and is beneficial to blockchain verification efficiency and system stability. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. It is obvious that the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. It is obvious that the specific implementation process can be used as a further specific embodiment of the present invention and fall within the protection scope of the present invention.
[0031] Figure 1 A flowchart of blockchain verification for implementing blockchain tamper-proofing in the present invention;
[0032] Figure 2 This is the overall logic diagram of the block and transaction verification of the present invention. DETAILED DESCRIPTION
[0033] In order to clearly explain the present invention and make the purpose, technical scheme and advantages of the embodiments of the present invention clearer, the technical scheme in the embodiments of the present invention is clearly and completely described below in combination with the drawings in the embodiments of the present invention, so that those skilled in the art can implement it according to the text of the specification.
[0034] Embodiment 1:
[0035] The following is a detailed description of the technology of the present invention in conjunction with the accompanying drawings. Figure 1 As shown, the present invention proposes a blockchain verification method for realizing blockchain tamper-proofing, and the specific implementation steps include:
[0036] Step 1: Read the specified block ledger file through the national encryption adapter and its components, configure different national encryption algorithm verification directory configurations, perform preliminary verification on the ledger file, and obtain the corresponding blockchain information. The blockchain information includes block information, transaction information and signature information on the chain. The signature information includes the signature of the block file and the certificate issuance chain associated with the block file;
[0037] Among them, the verification method also supports the national secret algorithm, which is a series of algorithms standardized by the State Cryptography Administration, including symmetric encryption algorithm, elliptic curve asymmetric encryption algorithm, hash algorithm, etc.
[0038] The verification method also includes supporting multi-file verification, wherein the multi-file verification refers to verifying the block files read by the directory configuration.
[0039] Step 2: Obtain the block source, parse the blockchain information and select the specified chain type mode for verification, select the fabric-block mode for block verification, the fabric-block mode refers to the specified chain type, and can also include verification of ledger files and intellectual property databases; parse the blockchain information to obtain blocks and transactions, verify the specified chain type mode, including verifying blocks and verifying transactions, verifying blocks including verifying the hash value, block number, signature and signature chain of the latest configuration block and metadata (metaData verification), verifying transactions including verifying the transaction certificate signature chain, transaction signature, transaction proposal certificate signature chain and endorsement certificate signature chain; wherein the hash value verification includes previousHash verification and Hash verification, the previousHash verification is used to verify whether the previousHash of the current block is equal to the hash value calculated by the previous block, and the Hash verification is used to verify whether the hash of the current block is equal to the hash calculated by the current block;
[0040] S21: In general, the verification of blockchain information includes the following specific steps:
[0041] S211: Obtain the hash value of the previous block of the block information to be verified on the chain for verification. If it is legal, perform the hash value verification of the current block; otherwise, perform the metadata signature verification;
[0042] S212: If the hash value verification of the block is legal, a verification pass result is output; if it is illegal, a transaction verification is started;
[0043] S213: If the metadata signature verification is legal, a metadata signature chain verification is performed; if the metadata signature verification or metadata signature chain verification is illegal, a block abnormality verification result is output; if the metadata signature chain is legal, a transaction verification is performed;
[0044] S214: The transaction verification includes verifying the legitimacy of the transaction signature. If it is legal, the transaction identity signature chain is verified. If it is illegal, the transaction abnormality verification result is output;
[0045] S215: If the transaction identity signature chain verification is legal, the transaction proposal and endorsement verification are performed; if it is illegal, the transaction abnormality verification result is output;
[0046] S216: If the transaction proposal and endorsement verification pass, it is determined that the blockchain block to be verified and the transaction are normal.
[0047] S22: The block is verified, and the specific implementation steps include:
[0048] S221: Initialize the parameters used for verification;
[0049] S222: Start acquiring block information based on the parameters, initialize the server providing the block, and cache the information of the block to be verified;
[0050] S223: Determine whether the block verification is legal, verify the cached information if the verification is legal, and return the verification result.
[0051] Step 3: The national encryption adapter is configured with multiple plug-ins to obtain various types of verification results and compare them. At the same time, multiple files are verified to ensure the integrity and correctness of blockchain information and realize blockchain tamper-proofing. The verification results are divided into multiple files due to the increase in the size of the ledger. Therefore, they are obtained through multiple plug-ins. Each plug-in obtains the corresponding file and returns its verification result; each type of verification result is compared. The specific implementation steps include:
[0052] S31: Perform hash verification and comparison by comparing the current hash value with the calculated first hash value. If the two are the same, the verification passes or is legal;
[0053] S32: Then compare the hash value of the current block with the hash value calculated by the current block, and if the two are the same, the verification passes or is legal;
[0054] S33: If the block number (blockNumber value) of the latest configuration block of the current block is less than or equal to the block number of the current block, the verification is passed or legal;
[0055] S34: Verify each signature of the metadata of the current block and verify its certificate signature chain. If the verification passes, the verification passes or is legal.
[0056] Embodiment 2:
[0057] The block verification includes:
[0058] 1) previousHash check: verify that the previousHash of the current block is equal to the hash value calculated from the previous block;
[0059] 2) Hash verification, verifying that the hash of the current block is equal to the hash value calculated by the current block;
[0060] 3) Check the latest configuration block to verify that the blockNumber value of the latest configuration block of the current block is less than or equal to the blockNumber value of the current block;
[0061] 4) MetaData (metadata) verification, verifying each signature of metaData[0] under the current block and verifying its certificate signature chain;
[0062] The transaction verification includes:
[0063] 1) Transaction certificate signature chain verification, verifying the certificate signature chain of each transaction;
[0064] 2) Transaction signature chain, verifying the signature of each transaction;
[0065] 3) Transaction proposal and multiple verification, verification of proposal identity certificate and endorsement identity certificate signature chain.
[0066] like Figure 2 As shown, the verification process of the integrity of blocks and transactions in the present invention is described, and the specific implementation steps include:
[0067] Step 1: The verification starts with block verification. First, the previousHash verification is performed to determine its legality. If it is legal, the Hash verification is performed. If it is illegal, the metaData signature verification is performed. Among them:
[0068] After judging the legitimacy of the previousHash check, there are two cases:
[0069] S11: Perform Hash verification to determine its legality. If it is legal, the result of successful verification is output and the verification is ended. If it is illegal, the transaction verification is started;
[0070] S12: The metaData signature is verified to determine its legality. If it is legal, the metaData signature chain is verified. If it is illegal, the verification abnormality result is output; wherein:
[0071] Verify the metaData signature chain to determine its legitimacy. If it is legal, start transaction verification. If it is illegal, output the verification abnormality result.
[0072] Step 3: Verify the transaction signature, transaction identity signature chain, transaction date and endorsement in the transaction verification respectively, and judge the legitimacy of each verification. If it is legal, continue to the next verification until the verification result is output. If it is illegal, terminate the verification and directly output the verification result;
[0073] The above description of the embodiments is to facilitate the understanding and application of the present invention by those skilled in the art. It should be understood that the present invention is not limited to the application of the above examples, and it is obvious that those familiar with the art can easily make various modifications to the above embodiments. The improvements and modifications made by those skilled in the art to the present invention based on the disclosure of the present invention should be within the scope of protection of the present invention.
Claims
1. A blockchain verification method for realizing blockchain tamper-proofing, characterized in that: The specific implementation steps include: Through the national encryption adapter and its components, different national encryption algorithm verification directory configurations are configured to read the specified block ledger file, perform preliminary verification on the ledger file, and obtain the corresponding blockchain information; Parse the blockchain information and select the specified chain type mode for verification to obtain verification results of each type; The national encryption adapter is configured with multiple plug-ins to obtain and compare verification results of various types, and verify multiple files corresponding to each type of designated chain at the same time; The specific implementation steps of verifying the specified chain type mode include: Get the hash value of the previous block of the block information to be verified on the chain for verification. If it is legal, perform the hash value verification of this block. If it is illegal, perform the metadata signature verification. If the hash value of the block is legal, the verification result is output; if it is illegal, the transaction verification is started; If the metadata signature verification is legal, a metadata signature chain verification is performed; if the metadata signature verification or metadata signature chain verification is illegal, a block abnormality verification result is output; if the metadata signature chain is legal, a transaction verification is performed; The transaction verification includes verifying the legitimacy of the transaction signature. If it is legal, the transaction identity signature chain is verified. If it is illegal, the transaction abnormality verification result is output; If the transaction identity signature chain verification is legal, the transaction proposal and endorsement verification are carried out; if it is illegal, the transaction abnormality verification result is output; If the transaction proposal and endorsement verification pass, it is determined that the blockchain block to be verified and the transaction are normal; Among them, the verification results of each type are compared, and the specific implementation steps include: Perform hash verification and comparison by comparing the current hash value with the calculated first hash value. If the two are the same, the verification passes or is legal; Then the hash value of the current block is compared with the hash value calculated by the current block. If the two are the same, the verification passes or is legal; If the block number of the latest configuration block of the current block is less than or equal to the block number of the current block, the verification is passed or legal; Verify each signature of the metadata of the current block and verify its certificate signature chain. If the verification passes, the verification passes or is legal.
2. The blockchain verification method for realizing blockchain tamper-proofing according to claim 1 is characterized in that: The blockchain information includes block information, transaction information and signature information on the chain, and the signature information includes the signature of the block ledger file and the certificate issuance chain associated with the block file.
3. The blockchain verification method for realizing blockchain tamper-proofing according to claim 1 is characterized in that: Parsing the blockchain information to obtain blocks and transactions, verifying the specified chain type mode, including verifying blocks and verifying transactions, verifying blocks including verifying hash values, block numbers, signatures and signature chains of the latest configuration blocks and metadata, and verifying transactions including verifying transaction certificate signature chains, transaction signatures, transaction proposal certificate signature chains, and endorsement certificate signature chains.
4. The blockchain verification method for realizing blockchain tamper-proofing according to claim 3 is characterized in that: The verification process is adapted to the national encryption algorithm, and the block ledger file is parsed into block information, transaction information and signature information to be verified.
5. The blockchain verification method for realizing blockchain tamper-proofing according to claim 3 is characterized in that: The specific implementation steps of verifying the block include: Initialize the parameters used for verification; Start acquiring block information based on the parameters, initialize the server providing the block, and cache the information of the block to be verified; Determine whether the block verification is legal, verify the cached information if the verification is legal, and return the verification result.
6. The blockchain verification method for realizing blockchain tamper-proofing according to claim 3 or 5, characterized in that: The verification of the transaction is specifically implemented after the block is verified, and also includes multiple rounds of verification of the block verification results.
7. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
8. A blockchain verification device for realizing blockchain tamper-proofing, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Block chain data verification method, device and system
CN111428277A
Block chain-based voting method, self-organizing management method and computer equipment
CN113037827A