CN-121997380-A - Block chain processing method, related device and medium
Abstract
The present disclosure provides a blockchain processing method, related apparatus, and medium. The method comprises the steps of obtaining a target block to be recorded on a blockchain, determining that the target blockchain node is a non-full storage node of the target block based on a predetermined non-full storage node determination rule, storing partial data of the target block in the target blockchain node, obtaining the target block from the full storage node in a blockchain network in response to receiving a block obtaining request of the target block, and verifying the obtained target block by utilizing target block verification data, wherein the full storage node is the blockchain node storing all data of the target block. The embodiment of the disclosure can reduce the occupation of the storage space in the blockchain network on the premise of not reducing the security of the blockchain data. The embodiment of the disclosure is applied to the scenes of adding blocks in a block chain network, inquiring blocks in the block chain network and the like.
Inventors
- SHAO ZHUGUANG
- WANG CHUNXIANG
- LIU JINGBO
- LIU KEMENG
Assignees
- 腾讯科技(深圳)有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20241107
Claims (20)
- 1. A blockchain processing method performed by a target blockchain link point in a blockchain network, the blockchain processing method comprising: Acquiring a target block to be recorded on a block chain; determining that the target blockchain node is a non-full storage node of the target block based on a predetermined non-full storage node determination rule, wherein the non-full storage node is a blockchain node that stores only partial data of the target block, the partial data including target block verification data; storing, at the target blockchain node, the partial data of the target block; And in response to receiving a block acquisition request of the target block, acquiring the target block from a full-scale storage node in the blockchain network, and verifying the acquired target block by utilizing the target block verification data, wherein the full-scale storage node is a blockchain node for storing all data of the target block.
- 2. The blockchain processing method of claim 1, wherein the number of blockchain nodes in the blockchain network is 3f+1, wherein f is a positive integer; the determining that the target blockchain node is a non-full storage node of the target block based on a predetermined non-full storage node determination rule includes: Determining a starting non-full storage node in the blockchain network based on a predetermined non-full storage node determination rule; Counting 2f blockchain nodes in the blockchain network starting from the starting non-full storage node; If the target blockchain node belongs to the 2f blockchain nodes, determining that the target blockchain node is the non-full storage node of the target block.
- 3. The blockchain processing method of claim 2, wherein the determining a starting non-full storage node in the blockchain network based on predetermined non-full storage node determination rules comprises: acquiring the target block height of the target block; determining a block link point index based on a remainder of the target block height modulo a first number, wherein the first number is a number of block chain nodes in the block chain network; And determining a blockchain node corresponding to the blockchain link point index in the blockchain network as the initial non-full storage node.
- 4. The blockchain processing method of any of claims 1-3, wherein the target block verification data includes a first target block digest value; the verifying the obtained target block by using the target block verification data includes: Calculating the obtained total transaction summary value of each transaction in the target block; Calculating the obtained total state data abstract value of each transaction in the target block; calculating a second target block digest value for the target block based on the total transaction digest value, the total status data digest value, and block header full data in the target block; And verifying the acquired target block based on the comparison of the first target block digest value and the second target block digest value.
- 5. The blockchain processing method of claim 4, wherein the target blockverification data includes first uplink originating node information; the verifying the obtained target block based on the comparison of the first target block digest value and the second target block digest value includes: if the first target block digest value is consistent with the second target block digest value, extracting second uplink initiating node information from the acquired target block; And verifying the obtained target block based on the comparison of the first uplink initiating node information and the second uplink initiating node information.
- 6. The blockchain processing method of claim 5, wherein the verifying the obtained target block based on the comparison of the first and second uplink originating node information includes: If the first uplink initiating node information is consistent with the second uplink initiating node information, acquiring a first signature reserved by the uplink initiating node; Extracting a second signature of the uplink initiating node from the obtained target block; And verifying the acquired target block based on the comparison of the first signature and the second signature.
- 7. The blockchain processing method of any of claims 1-6, wherein the storing the portion of the data of the target block at the target blockchain node includes: Storing a first key value pair at the target blockchain node, wherein the first key value pair indicates a correspondence between a target blocksummary value and a target blockheight; And storing a second key value pair at the target blockchain node, wherein the second key value pair indicates a corresponding relation between the target blockheight and blockhead key data, and the blockhead key data comprises the target blockverification data.
- 8. The blockchain processing method of claim 7, wherein the blockget request includes a target blockdigest value of the target block; The obtaining the target block from a full-scale storage node in the blockchain network in response to receiving a block obtaining request of the target block, and verifying the obtained target block by using the target block verification data, including: determining a target block height based on the target block digest value and the first key value pair; obtaining the target block of the target block height from the full storage node in the blockchain network; acquiring the block head key data based on the target block height and the second key value pair, and extracting the target block verification data from the block head key data; And verifying the acquired target block by using the target block verification data.
- 9. The blockchain processing method of any of claims 1-8, wherein the partial data further includes target transaction verification data; After the target blockchain node stores the portion of the data of the target block, the blockchain processing method further includes: In response to a transaction acquisition request for a target transaction in the target block, the target transaction for the target block is acquired from the full-scale storage node in the blockchain network and the acquired target transaction is validated using the target transaction validation data.
- 10. The blockchain processing method of claim 9, wherein the storing the portion of the data of the target block at the target blockchain node includes: At the target blockchain node, a third key-value pair is stored, wherein the third key-value pair indicates a correspondence between a target transaction identification, a target blockheight, and a target transaction index.
- 11. The blockchain processing method of claim 10, wherein the transaction acquisition request contains the target transaction identification of the target transaction; the obtaining the target transaction for the target block from the full-scale storage node in the blockchain network in response to a transaction obtaining request for the target transaction in the target block, and verifying the obtained target transaction using the target transaction verification data, comprising: determining the target block height and a target transaction index based on the target transaction identification and the third key value pair; Acquiring the target block of the target block height from the full-scale storage node in the blockchain network, and acquiring the target transaction of the target transaction index in the target block; And verifying the acquired target transaction by utilizing the target transaction verification data.
- 12. The blockchain processing method of claim 11, wherein the target transaction verification data includes a first target transaction digest value and a first target transaction state data digest value; The storing, at the target blockchain node, the portion of the data of the target block includes: storing a fourth key value pair at the target blockchain node, wherein the fourth key value pair indicates a correspondence between the target transaction identifier and the first target transaction digest value; and storing a fifth key value pair at the target blockchain node, wherein the fifth key value pair indicates the corresponding relation between the target transaction identifier and the first target transaction state data digest value.
- 13. The blockchain processing method of claim 12, wherein validating the acquired target transaction using the target transaction validation data comprises: acquiring the first target transaction summary value based on the target transaction identifier and the fourth key value pair; performing abstract operation on the target transaction to obtain a second target transaction abstract value; acquiring the first target transaction state data abstract value based on the target transaction identifier and the fifth key value pair; performing summary operation on the state data after the target transaction is executed to obtain a second target transaction state data summary value; And verifying the acquired target transaction based on the comparison of the first target transaction digest value and the second target transaction digest value and the comparison of the first target transaction state data digest value and the second target transaction state data digest value.
- 14. The blockchain processing method of claim 11, wherein the target transaction verification data includes a first target transaction digest value and a first target transaction state data digest value; The storing, at the target blockchain node, the portion of the data of the target block includes: and storing a sixth key value pair at the target blockchain node, wherein the sixth key value pair indicates a correspondence of the target transaction identifier, the first target transaction digest value, and the first target transaction state data digest value.
- 15. The blockchain processing method of claim 14, wherein validating the acquired target transaction using the target transaction validation data comprises: Acquiring the first target transaction digest value and the first target transaction state data digest value based on the target transaction identifier and the sixth key value pair; performing abstract operation on the target transaction to obtain a second target transaction abstract value; performing summary operation on the state data after the target transaction is executed to obtain a second target transaction state data summary value; And verifying the acquired target transaction based on the comparison of the first target transaction digest value and the second target transaction digest value and the comparison of the first target transaction state data digest value and the second target transaction state data digest value.
- 16. The blockchain processing method of any of claims 1-15, wherein after acquiring the target block to be recorded onto the blockchain, the blockchain processing method further comprises: Determining that the target blockchain node is the full storage node of the target block based on a predetermined non-full storage node determination rule; Storing a key value pair table of the target block at the target block chain node; And generating the target block by using the key value pair table in response to receiving the block acquisition request of the target block.
- 17. A blockchain processing device located at a target blockchain node in a blockchain network, the blockchain processing device comprising: The acquisition unit is used for acquiring a target block to be recorded on the block chain; A first determining unit configured to determine, based on a predetermined non-full-size storage node determining rule, that the target blockchain node is a non-full-size storage node of the target block, wherein the non-full-size storage node is a blockchain node that stores only partial data of the target block, the partial data including target block verification data; a first storage unit configured to store, at the target blockchain node, the partial data of the target block; And the first verification unit is used for responding to the received block acquisition request of the target block, acquiring the target block from a full-quantity storage node in the blockchain network, and verifying the acquired target block by utilizing the target block verification data, wherein the full-quantity storage node is a blockchain node for storing all data of the target block.
- 18. An electronic device comprising a memory and a processor, the memory storing a computer program, wherein the processor, when executing the computer program, implements the blockchain processing method of any of claims 1 to 16.
- 19. A computer readable storage medium storing a computer program, wherein the computer program when executed by a processor implements the blockchain processing method according to any of claims 1 to 16.
- 20. A computer program product comprising a computer program that is read and executed by a processor of a computer device to cause the computer device to perform the blockchain processing method of any of claims 1 to 16.
Description
Block chain processing method, related device and medium Technical Field The present disclosure relates to the field of blockchain technologies, and in particular, to a blockchain processing method, a related device, and a medium. Background A blockchain network is a distributed architecture that includes a very large number of blockchain nodes. Each blockchain node maintains the same blockchain in its own memory space. That is, every time a block is added to a blockchain, the storage space of all blockchain nodes in the blockchain network is increased by the same block, and a large amount of storage space is occupied. It is generally believed that verifiable blockchain data can be achieved only if each blockchain node maintains a full amount of blockchain data, thereby guaranteeing blockchain data security. Disclosure of Invention The embodiment of the disclosure provides a blockchain processing method, a related device and a medium, which can reduce the occupation of storage space in a blockchain network on the premise of not reducing the security of blockchain data. According to an aspect of the present disclosure, there is provided a blockchain processing method performed by a target blockchain link point in a blockchain network, the blockchain processing method including: Acquiring a target block to be recorded on a block chain; determining that the target blockchain node is a non-full storage node of the target block based on a predetermined non-full storage node determination rule, wherein the non-full storage node is a blockchain node that stores only partial data of the target block, the partial data including target block verification data; storing, at the target blockchain node, the partial data of the target block; And in response to receiving a block acquisition request of the target block, acquiring the target block from a full-scale storage node in the blockchain network, and verifying the acquired target block by utilizing the target block verification data, wherein the full-scale storage node is a blockchain node for storing all data of the target block. According to an aspect of the present disclosure, there is provided a blockchain data processing device located at a target blockchain node in a blockchain network, the blockchain processing device comprising: The acquisition unit is used for acquiring a target block to be recorded on the block chain; A first determining unit configured to determine, based on a predetermined non-full-size storage node determining rule, that the target blockchain node is a non-full-size storage node of the target block, wherein the non-full-size storage node is a blockchain node that stores only partial data of the target block, the partial data including target block verification data; a first storage unit configured to store, at the target blockchain node, the partial data of the target block; And the first verification unit is used for responding to the received block acquisition request of the target block, acquiring the target block from a full-quantity storage node in the blockchain network, and verifying the acquired target block by utilizing the target block verification data, wherein the full-quantity storage node is a blockchain node for storing all data of the target block. Optionally, the number of blockchain nodes in the blockchain network is 3f+1, wherein f is a positive integer; the first determining unit is specifically configured to: Determining a starting non-full storage node in the blockchain network based on a predetermined non-full storage node determination rule; Counting 2f blockchain nodes in the blockchain network starting from the starting non-full storage node; If the target blockchain node belongs to the 2f blockchain nodes, determining that the target blockchain node is the non-full storage node of the target block. Optionally, the first determining unit is specifically further configured to: acquiring the target block height of the target block; determining a block link point index based on a remainder of the target block height modulo a first number, wherein the first number is a number of block chain nodes in the block chain network; And determining a blockchain node corresponding to the blockchain link point index in the blockchain network as the initial non-full storage node. Optionally, the full-scale storage node is a plurality of full-scale storage nodes; The first verification unit is specifically configured to: respectively acquiring channel states between each full-quantity storage node and the target blockchain node; determining a target full-scale storage node from the respective full-scale storage nodes based on the channel state; the target block is obtained from the target full storage node. Optionally, the target block verification data includes a first target block digest value; The first verification unit is specifically configured to: Calculating the obtained total transaction summary value of each transactio