WO2020073246A1 - Blockchain-based transaction data processing method and device, and storage medium - Google Patents

Blockchain-based transaction data processing method and device, and storage medium Download PDF

Info

Publication number
WO2020073246A1
WO2020073246A1 PCT/CN2018/109701 CN2018109701W WO2020073246A1 WO 2020073246 A1 WO2020073246 A1 WO 2020073246A1 CN 2018109701 W CN2018109701 W CN 2018109701W WO 2020073246 A1 WO2020073246 A1 WO 2020073246A1
Authority
WO
WIPO (PCT)
Prior art keywords
block
blockchain
block header
account group
node
Prior art date
Application number
PCT/CN2018/109701
Other languages
French (fr)
Chinese (zh)
Inventor
王成
Original Assignee
王成
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 王成 filed Critical 王成
Priority to PCT/CN2018/109701 priority Critical patent/WO2020073246A1/en
Priority to CN201880017223.5A priority patent/CN110692078B/en
Publication of WO2020073246A1 publication Critical patent/WO2020073246A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/08Payment architectures
    • G06Q20/10Payment architectures specially adapted for electronic funds transfer [EFT] systems; specially adapted for home banking systems
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the present invention relates to the field of blockchain technology, and in particular to a blockchain-based transaction data processing method, device, and storage medium.
  • the classic blockchain technology is a decentralized public ledger technology.
  • a blockchain is generally composed of infinitely ordered transaction blocks arranged in time. Blockchain technology ensures that the ledger does not have double spending issues, the ledger cannot be changed, and all nodes in the network can reach a consensus and have a common ledger.
  • the invention provides a transaction data processing method, equipment and storage medium based on a blockchain to improve the transaction speed per unit time of the blockchain system.
  • the present invention provides a blockchain-based transaction data processing method, including:
  • the method is applied to a first node.
  • the first node is a node corresponding to a first account group in a blockchain network.
  • the blockchain network includes G account groups and G ⁇ G blockchains.
  • One account group to another any of the account groups corresponds to a blockchain, the first account group is any account group in the blockchain network, and G is an integer greater than 1;
  • Methods include:
  • the first node receives first transaction information; the first transaction information is formed by a transaction between accounts in the first account group to a second account group; the second account group is the block Any account group in the chain network;
  • the first node generates a first block based on the first transaction information, and adds the first block to the first blockchain; the first blockchain sets the first account group to The blockchain corresponding to the second account group.
  • an electronic device including:
  • a memory for storing executable instructions of the processor
  • the processor is configured to execute the method of any one of the first aspects via execution of the executable instructions.
  • an embodiment of the present invention provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the method according to any one of the first aspect is implemented.
  • the first node receives first transaction information; the first transaction information is from the first account group to the second account group The transaction between the accounts is formed; the first account group and the second account group are any account groups in the blockchain network; the first node generates a first block based on the first transaction information, and converts The first block is added to the first blockchain; the first block is the block corresponding to the first account group to the second account group.
  • the first node is the first The node corresponding to the account group, the first node only needs to save the historical transactions related to it, and only needs to save all the transaction information related to the first account group to know the balance of all accounts in the first account group, that is, only need to save The blocks of the blockchain related to the first account group, and different blockchains can be traded in parallel. Under the condition of limited network capacity, the transaction time per unit time of the blockchain system is increased.
  • FIG. 1 is a schematic flowchart of an embodiment of a transaction data processing method based on blockchain provided by the present invention
  • FIG. 2 is a block diagram of an embodiment of a transaction data processing method based on blockchain provided by the present invention
  • FIG. 3 is a block flow diagram of an embodiment of a transaction data processing method based on blockchain provided by the present invention.
  • FIG. 4 is a block diagram of another embodiment of a blockchain-based transaction data processing method provided by the present invention.
  • FIG. 5 is a schematic diagram of an embodiment of an electronic device provided by the present invention.
  • the transaction data processing method based on the blockchain provided in the embodiments of the present invention is applied to a blockchain network, which corresponds to a scalable decentralized cryptocurrency system.
  • the blockchain network includes multiple nodes, G account groups and G ⁇ G blockchains. Any account group corresponds to at least one node, and any blockchain is an account from one account group to another account group.
  • the blocks generated by the transaction between are linked.
  • the above two account groups can be the same or different, and they are any of the G account groups, and G is an integer greater than 1.
  • the nodes corresponding to each account group only need to save 2G-1 block chain blocks, and for other chains only need to save the block header of the block.
  • FIG. 1 is a schematic flowchart of an embodiment of a transaction data processing method based on a blockchain provided by the present invention.
  • the execution subject of this embodiment is a first node, which is a node corresponding to a first account group in the blockchain network, and the first account group is any account group in the blockchain network.
  • the method provided in this embodiment includes:
  • Step 101 The first node receives first transaction information; the first transaction information is formed by a transaction between the accounts of the first account group and the second account group; the second account group is the area Any account group in the blockchain network.
  • Step 102 The first node generates a first block according to the first transaction information and adds the first block to the first blockchain; the first blockchain is the first account group To the blockchain corresponding to the second account group.
  • the method in the embodiment of the present invention may first define the number of account groups, for example, G account groups, and a hash algorithm may be used to divide the account addresses corresponding to the accounts into corresponding account groups. For example, modulo the hash of the account address and G can obtain the account group corresponding to the account.
  • the blocks generated by transactions between accounts from one account group to another account group form a blockchain, with a total of G ⁇ G chains.
  • UTXO Unspent Transaction Output
  • every two account groups correspond to a blockchain (the relationship between the two account groups is an orderly account group pair, that is, from one account group to another account group corresponds to a blockchain, the two Account groups can be the same account group), the input in each block of this blockchain comes from the same account group UTXO, the account group UTXO comes from all accounts to this account group transaction .
  • the node corresponding to each account group only needs to save all the input and output transactions related to this account group to know the balance of all accounts in the account group, so the node corresponding to each account group only needs to save some historical transaction records, that is Only need to save the block of the blockchain related to the account group.
  • the related blockchain includes any other account group to the corresponding blockchain of the account group, and the account group to any other account group (can be removed This account group) corresponds to the blockchain, that is, 2G-1 blockchains.
  • the account balance in account group A depends on 2G-1 blockchains, that is, G blockchains corresponding to transactions from all account groups to account group A, and transactions from account group A to all account groups except account group A Corresponding G-1 blockchain.
  • G 2 that is, there are two account groups, denoted as account group 0 and account group 1.
  • the chain L (0,0) represents the blockchain corresponding to account group 0 to account group 0.
  • L (0,1) represents the blockchain corresponding to account group 0 to account group 1
  • chain L (1,0) represents the blockchain corresponding to account group 1 to account group 0
  • chain L (1,1) represents the account Blockchain corresponding to Group 1 to Account Group 1.
  • the height 2 block is generated later than the height 1 block.
  • the blockchain network has only G ⁇ G initial blocks, that is, each blockchain has an initial block.
  • the accounts in the blockchain network begin to form their own transactions and broadcast to the blockchain network.
  • the nodes in the blockchain network package the transaction information into blocks on different blockchains according to the input account group and output account group of the transaction. Assuming that the transaction is a transaction between accounts in account group A and account group B, the input account group is account group A, and the output account group is account group B. These blocks are eventually broadcast to the entire blockchain network, and the nodes in the blockchain network will verify and then choose to receive new blocks or reject blocks that do not meet the protocol rules.
  • the first node selects the blockchain corresponding to the first account group to the second account group (that is, the first blockchain) for mining.
  • the first node packages the transaction information that has not been added to the first blockchain, namely the first
  • the node receives the first transaction information, which is formed by the transaction between the accounts of the first account group and the second account group.
  • the first node generates a first block based on the first transaction information, and adds the first block to the first blockchain.
  • the method further includes:
  • the first node broadcasts the block header of the first block to all nodes in the blockchain network, and broadcasts the block body of the first block to the first account group or The node corresponding to the second account group, so that other nodes in the blockchain network can verify the received block header and / or block body of the first block.
  • the first node may broadcast the first block to other nodes in the blockchain network, and may specifically broadcast the first block to the first account group or the second
  • the node corresponding to the account group for example, can split the block header and block body of the first block and broadcast it to the node corresponding to the first account group or the second account group, or the block head and block body as a whole
  • the block header may be broadcast before the block body, or the block header and the block body may be broadcast at the same time, which is not limited in the present invention.
  • block header of the first block may also be broadcast to other nodes, that is, nodes that are not corresponding to the first account group and the second account group.
  • the first node receives the first transaction information; the first transaction information is formed by transactions between the accounts of the first account group to the second account group; the first account group and the second The account group is any account group in the blockchain network; the first node generates a first block based on the first transaction information, and adds the first block to the first blockchain; The first blockchain is the blockchain corresponding to the first account group to the second account group.
  • the first node is the node corresponding to the first account group, and the first node only needs to save its related Of historical transactions, you only need to save all transaction information related to the first account group to know the balance of all accounts in the first account group, that is, only need to save the block of the blockchain related to the first account group, At the same time, different blockchains can be traded in parallel. In the case of limited network capacity, the transaction speed of the blockchain system per unit time is increased.
  • step 102 further includes:
  • the first node obtains the hash value of the block header that the first block depends on;
  • the block header that the first block depends on is a block header that can determine all the blockchains in the blockchain network;
  • step 102 can be implemented in the following manner:
  • the first node generates a first block based on the first transaction information and the hash value of the block header that the first block depends on.
  • the block between the blockchain and the blockchain in the embodiment of the present invention is closely dependent, and each new block will depend on multiple blockchains, so it must include multiple previously generated
  • the hash of the block header that is, the generated first block contains the hash value of the block header of multiple dependent blockchains.
  • the block headers of all blockchains in the blockchain network can be determined, that is, through the dependent block headers, all blockchains in the entire blockchain network can be determined.
  • the first node generates the first block based on the received first transaction information and the hash value of the block header that the first block depends on.
  • the latest block header may be the block header with the most determined blocks or the block header with the latest creation time, which is not limited in this embodiment of the present invention.
  • the first blockchain is L (i, j); the i and j are integers greater than or equal to 0 and less than or equal to G-1, respectively.
  • i represents a first account group
  • j represents a second account group
  • the first node obtains the hash value of the block header that the first block depends on, including:
  • the first node selects an initial block header from the verified block headers according to the first preset condition
  • the first node selects an up-to-date second block header B (i, m) from the G blockchains L (i, m), so that the second block header B (i, m) determines
  • the latest block header of each blockchain is compatible with the latest block header of the corresponding blockchain determined by the initial block header;
  • the value of m is an integer from 0 to G-1;
  • m represents any account group in the blockchain network;
  • the first node selects the latest third block header B (k, l_k) from the G blockchains L (k, l_k), so that the third block header B (k, l_k)
  • the latest block header of each block chain determined is compatible with the latest block header of the corresponding block chain determined by the initial block header;
  • the value range of k is an integer from 0 to G-1 ,
  • k is not equal to i, the value range of l_k is an integer from 0 to G-1;
  • the k represents any account group in the blockchain network except the first account group, the l_k represents any account group in the blockchain network;
  • the first node uses the initial block header, the second block header, and the third block header as the block header that the first block depends on, and calculates the block header that the first block depends on Hash value.
  • the first node selects the block header that the first block depends on. First, it can obtain a verified block header as the initial block header and add it to the block header that the first block depends on.
  • the initial block header may be a block header that satisfies the first preset condition, and the first preset condition may be the maximum number of blocks determined based on the initial block header, or determined based on the initial block header
  • the total block difficulty is the highest, which is not limited in the embodiment of the present invention.
  • the latest fourth block header Z (r, s) of the blockchain L (r, s) is determined according to the initial block header; where r and s are respectively An integer greater than or equal to 0 and less than or equal to G-1;
  • the blockchain L (r, s) is any blockchain in the blockchain network.
  • the first node selects from L (i, 0), L (i, 1), ..., L (i, G-1), among the G blockchains L (i, m) choose a newest second block header B (i, m), so that the latest block header and the initial block header of each blockchain determined by the second block header B (i, m) are determined
  • L (i, 0), L (i, 1), ..., L (i, G-1), among the G blockchains L (i, m) choose a newest second block header B (i, m), so that the latest block header and the initial block header of each blockchain determined by the second block header B (i, m) are determined
  • the latest block header corresponding to the corresponding blockchain is compatible.
  • Step a The first node selects a newest second block header B (i, m) from the blockchain L (i, m), so that the second block header B (i, m) determines the The latest fifth block header Z '(r, s) of the blockchain L (r, s) and the fourth block header Z (r, s) are the same in the blockchain L (r, s) On a fork, and if the fifth block header Z '(r, s) is newer than the fourth block header Z (r, s), then the latest of the blockchain L (r, s) The fourth block header Z (r, s) is updated to the fifth block header Z '(r, s);
  • the old and new here refers to the old and new in time, that is, the later the time generated on the same blockchain, the new
  • Add one to m, and repeat step a that is, first select the latest second block header B (i, 1) from L (i, 1), so that the second block header B (i, 1) determines
  • the latest fifth block header Z '(r, s) and fourth block header Z (r, s) of the blockchain L (r, s) are on the same fork of the blockchain L (r, s), If the fifth block header Z '(r, s) is newer than the fourth block header Z (r, s) (in this case, the fourth block header may be an updated block header), then the blockchain L (r, s)
  • the latest fourth block header Z (r, s) is updated to the fifth block header Z '(r, s), if the fifth block header Z' (r, s) is higher than the fourth block header Z (r, s) Old, then the latest fourth block header Z (r, s) of the blockchain L (r, s) remains unchanged.
  • Increase m by one and repeat step a until
  • the first node starts from L (k, 0), L (k, 1), ..., L (k, G-1), and these G blockchains L (k , l_k) select the latest third block header B (k, l_k), so that the third block header B (k, l_k) determines the latest block header of each blockchain and the initial area
  • the block header determines the latest block header compatible with the corresponding blockchain.
  • the first node selects the latest third block header B (k, l_k) from the G blockchains L (k, l_k), which can be implemented in the following manner:
  • Step b The first node selects the latest third block header B (k, l_k) from the blockchain L (k, l_k), so that the third block header B (k, l_k) determines the The latest sixth block header Z ′′ (r, s) of the blockchain L (r, s) and the fourth block header Z (r, s) are on the same blockchain L (r, s), And if the sixth block header Z ′′ (r, s) is newer than the fourth block header Z (r, s), then the latest fourth block header of the blockchain L (r, s) Z (r, s) is updated to the sixth block header Z ′′ (r, s);
  • the G blockchains L ( 0, l_k) selects the latest third block header B (0, l_k), so that the third block header B (0, l_k) determines the latest sixth of the blockchain L (r, s) Block header Z ′′ (r, s) and the fourth block header Z (r, s) (the fourth block header at this time may have been updated in step a) in the blockchain L (r, s)
  • the blockchain L (r, s) The latest fourth block header Z (r, s) is updated to the sixth block header Z ′′ (r, s), if the sixth block header Z ′′ (r, s) is higher than the fourth block header Z (r, s ) Old, then
  • the block where the initial block header is located is block L (p, q), if i is equal to p, then m is not equal to q;
  • an optimized solution is to select 2G-1 block headers that the first block depends on, that is, in G
  • the block where the original block header is located is removed, that is, if the block where the initial block header is located Is blockchain L (p, q), when i is equal to p, m is not equal to q, further, if L (i, m) does not include blockchain L (p, q), then for different k
  • the first node selects the latest third block header B (k, l_k) from the G block chains L (k, l_k)
  • the block where the initial block header is located is removed, that is, k does not Is equal to p, that is, the block header is not selected from the G blockchains of L (p, l_k).
  • the hash value of the block header that the first block depends on is placed in the block header of the first block to determine the status of all blockchains in the blockchain network.
  • step 102 the following operations may also be performed:
  • the first node determines whether the transaction input corresponding to the first transaction information is from the account of the third account group to the first account group according to the blockchain corresponding to the first account group from the third account group The transaction output corresponding to the transaction between;
  • the first node verifies the transaction output according to the blockchain corresponding to the first account group to the fourth account group.
  • Use of transactions between; the third account group and the fourth account group are respectively any account group in the blockchain network;
  • the received first transaction information is valid, that is, whether the transaction corresponding to the first transaction information is valid.
  • each block of the block chain in the block chain network can be determined, thereby determining all historical transactions, that is, determining a ledger.
  • the transaction information included in the block in the blockchain corresponding to the first account group to any account group verify whether the transaction output is not used by the transaction between the accounts of the first account group and other account groups, that is, the The transaction output is not consumed by other transactions.
  • the node corresponding to each account group only needs to save all input and output transactions related to this account group to know the balance of all accounts in the account group, so the node corresponding to each account group only needs to save some historical transaction records , That is, only the blocks of the blockchain related to the account group need to be saved.
  • the related blockchain includes any other account group to the corresponding blockchain of the account group, and the account group to any other account group ( The corresponding blockchain of the account group can be removed, that is, 2G-1 blockchains. For the blockchain that is not related to the account group, only the block header needs to be saved.
  • the first node generates the first block according to the first transaction information and the hash value of the block header that the first block depends on, which may be specifically implemented as follows:
  • the first node determines the random number by using the proof-of-work algorithm according to the second preset condition
  • the first node generates the block header of the first block according to the preset block header data structure according to the hash value of the block header that the first block depends on and the random number;
  • the first node generates the block body of the first block according to the preset data structure of the block body of the valid first transaction information
  • the first node combines the block header and the block body to form the first block.
  • the first block includes a block header and a block body.
  • the block header of the first block further includes: the hash value of the previous block in the first block chain, the first area The hash value and time stamp of the block body of the block.
  • the first node when generating the first block, the first node needs to find a random number through a proof-of-work algorithm, and the random number satisfies the second preset condition. For example, the hash value of the block generated by the random number satisfies certain conditions, such as less than a preset threshold.
  • the hash value of the main body (ie, payload) and other information constitute the block header of the first block.
  • the validated first transaction information is used to generate the block body of the first block, and then the block header and block body are generated into the final first block.
  • the block header can also include the following information: description information (such as: version information, payload size, hash of all dependent block header hashes, the hash value of the root node of the transaction Merkle tree, the target value of the proof of work algorithm, etc. ).
  • description information such as: version information, payload size, hash of all dependent block header hashes, the hash value of the root node of the transaction Merkle tree, the target value of the proof of work algorithm, etc. ).
  • the block body (that is, the payload) can also include any other data that can be stored.
  • the above hash can be calculated by any hash function, including MD5, SHA-1, SHA-224, SHA-256, SHA-384, SHA-512, SHA-512 / 224, SHA-512 / 256, SHA- 3 etc.
  • the first block of the first blockchain is related to 2G-1 blockchains, that is, all account groups G blockchains corresponding to transactions in the first account group, G-1 blockchains corresponding to transactions in all account groups except the first account group, so according to the
  • the transaction information of the account group that is, the blockchain related to the first blockchain, can determine whether the first transaction information is valid.
  • the method in this embodiment further includes:
  • the first node receives a block body on the second blockchain sent by a node corresponding to the fifth account group, the block body includes: second transaction information associated with the first account group; the second The blockchain is the blockchain corresponding to the first account group from the fifth account group; the second transaction information is formed by the transaction between the accounts of the fifth account group and the first account group ;
  • the first node verifies whether the data format of the block body is correct
  • the block body is added to the second block chain stored by the first node.
  • the first node receives the block body sent by other nodes, for example, the block body on the second block chain sent by the node corresponding to the fifth account group.
  • the block body includes second transaction information related to the first account group, and the second transaction information is formed by transactions between the fifth account group and the accounts of the first account group.
  • the second blockchain is the corresponding blockchain from the fifth account group to the first account group.
  • the first node verifies whether the data format of the block is correct; if it is correct, add In the second blockchain stored by the first node, the block body is forwarded to the nodes corresponding to the fifth account group and the first account group in the P2P network, and then the block header is forwarded to other nodes in the blockchain network. All nodes; if it is incorrect, the block is discarded without any processing.
  • the method of this embodiment further includes:
  • the first node receives a block body on a third blockchain sent by a node corresponding to the first account group, the block body includes: third transaction information associated with the first account group; the third The blockchain is the blockchain corresponding to the first account group to the sixth account group; the third transaction information is formed by transactions between the accounts of the first account group to the sixth account group;
  • the first node verifies whether the third transaction information is valid
  • the block body is added to the third block chain stored by the first node.
  • the first node receives the block body sent by other nodes, for example, the block body on the third block chain sent by other nodes corresponding to the first account group.
  • the block body includes third transaction information related to the first account group, and the second transaction information is formed by transactions between the accounts of the first account group to the sixth account group.
  • the third blockchain is the blockchain corresponding to the first account group to the sixth account group.
  • the first node verifies that the data format of the block body is correct; if it is correct, and If the third transaction information is valid, it is added to the third blockchain stored by the first node, and the block body is forwarded to the nodes corresponding to the sixth account group and the first account group in the P2P network, and then the block header is forwarded Forward to all other nodes in the blockchain network to other nodes in the P2P network; if it is not correct, the block is discarded without any processing.
  • the first node verifies whether the third transaction information is valid, which may be specifically implemented as follows:
  • the first node determines whether the transaction input corresponding to the third transaction information is from the seventh account group to the first account group according to the blockchain corresponding to the first account group from the seventh account group The transaction output corresponding to the transaction between the accounts;
  • the first node verifies the transaction output according to the blockchain corresponding to the first account group to the eighth account group, and is not used by the transaction between the accounts of the first account group to the eighth account group ;
  • the seventh account group and the eighth account group are respectively any account group in the blockchain network;
  • the process of verifying whether the third transaction information is valid is similar to the process of verifying whether the first transaction information is valid in the foregoing embodiment, and details are not described here.
  • the method in this embodiment further includes:
  • the first node receives the block header in the fourth blockchain sent by the second node, the block header includes: a hash value of the latest block that the block header depends on; the fourth blockchain is a zone Any blockchain in the blockchain network;
  • the first node verifies whether the block dependency of the block header in the fourth block chain is reasonable
  • the block header is added to the fourth block chain stored by the first node.
  • the first node will also receive all the block headers of the blockchain, specifically the block headers in the fourth blockchain sent by the second node.
  • the second node may be a node corresponding to any account group in the blockchain network.
  • the fourth blockchain is any blockchain in the blockchain network.
  • the block header includes: the hash value of the latest block header that the block header depends on.
  • the first node needs to verify whether the block dependency of the block header is reasonable; if it is reasonable, the block header is added to the fourth block chain stored by the first node and forwarded to other nodes in the P2P network; if unreasonable, Discard this block header without doing anything.
  • the fourth blockchain is L (i1, j1)
  • the block header of the received fourth blockchain is L (i1, j1) is B (i1, j1)
  • the i1 j1 is an integer greater than or equal to 0 and less than or equal to G-1
  • the i1 and the j1 represent any account group in the blockchain network
  • the first node verifies the fourth block Whether the block dependency of the block header in the chain is reasonable can be achieved in the following ways:
  • Step c The first node determines the latest seventh block header Z (r1, s1) of any block chain L (r1, s1) according to the block header B (i1, j1); wherein, the r1 and s1 are integers greater than or equal to 0 and less than or equal to G-1;
  • Step d The first node determines the blockchain L (r1, according to the block header B i2 corresponding to the hash value of the i2th block header B i2 included in the block header B (i1, j1) s1) the latest eighth block header Z '(r1, s1);
  • Step e The first node determines whether the seventh block header Z (r1, s1) and the eighth block header Z '(r1, s1) are the same in the blockchain L (r, s) Bifurcation
  • the first node determines the latest seventh block header Z (r1, s1) of any blockchain L (r1, s1) according to the block header B (i1, j1), and then header B (i1, j1) includes a first header region B corresponding to the hash value of a header region B 1, determining that the block chains L (r1, s1) of the latest header eighth region Z '( r1, s1), determine whether the seventh block header Z (r1, s1) and the eighth block header Z '(r1, s1) are on the same fork of the blockchain L (r, s); Block header B 1 is reasonable. If the eighth block header Z '(r1, s1) is newer than the seventh block header Z (r1, s1), update the seventh block header Z (r1, s1) to the eighth block header Z '(r1, s1);
  • the seventh block header Z (r1, s1) and the eighth block header Z '(r1, s1) are not on the same fork of the blockchain L (r, s), it means that the block header's dependence is problematic and cannot be When a correct ledger is formed, the verification is interrupted and the verification fails.
  • the final determined Z (r1, s1) is the latest block of the blockchain, that is, each blockchain is finally determined.
  • the maximum value of i2 is 2G-1.
  • the fork of a blockchain is determined by the latest block. Generally, there is only one fork and no fork. During the formation of the blockchain, short forks are eventually abandoned , Keep the longest fork as the blockchain.
  • An embodiment of the present invention also provides a transaction data processing device based on a blockchain.
  • the device is provided at a first node.
  • the first node is a node corresponding to a first account group in a blockchain network.
  • the blockchain includes G account groups and G ⁇ G blockchains, any one of the account groups to another any of the account groups corresponds to a blockchain, and the first account group is the blockchain
  • G is an integer greater than 1
  • the transaction data processing device based on the blockchain includes:
  • a receiving module configured to receive first transaction information; the first transaction information is formed by a transaction between accounts in the first account group to a second account group; the second account group is the block Any account group in the chain network;
  • the processing module is configured to generate a first block according to the first transaction information and add the first block to the first blockchain; the first blockchain is the first account group to The blockchain corresponding to the second account group.
  • processing module is specifically used for:
  • the block header that the first block depends on can determine the blockchain Block headers of all blockchains in the network;
  • the first node generates a first block based on the first transaction information and the hash value of the block header that the first block depends on.
  • the processing module is specifically used to:
  • the latest third block header B (k, l_k) For different k, select the latest third block header B (k, l_k) from the G blockchains L (k, l_k), so that each item determined by the third block header B (k, l_k)
  • the latest block header of the blockchain is compatible with the latest block header of the corresponding blockchain determined by the initial block header;
  • the value of k is an integer from 0 to G-1, and k is not equal to i
  • l_k is an integer ranging from 0 to G-1;
  • the k represents any account group except the first account group in the blockchain network, and the l_k represents the area Any account group in the blockchain network;
  • the initial block header, the second block header, and the third block header are used as the block header that the first block depends on, and the hash value of the block header that the first block depends on is calculated.
  • the block where the initial block header is located is block L (p, q), if i is equal to p, then m is not equal to q;
  • processing module is specifically used to perform the following steps:
  • the latest fourth block header Z (r of the blockchain L (r, s) is determined according to the initial block header , s); wherein, r and s are integers greater than or equal to 0 and less than or equal to G-1, respectively;
  • Step a Select a newest second block header B (i, m) from the block chain L (i, m), so that the second block header B (i, m) determines the block chain L ( r, s) the latest fifth block header Z '(r, s) and the fourth block header Z (r, s) are on the same fork of the blockchain L (r, s), and If the fifth block header Z '(r, s) is newer than the fourth block header Z (r, s), then the latest fourth block header Z of the blockchain L (r, s) (r, s) is updated to the fifth block header Z '(r, s);
  • Step b Select the latest third block header B (k, l_k) from the block chain L (k, l_k), so that the block chain L () determined by the third block header B (k, l_k) r, s)
  • the latest sixth block header Z ′′ (r, s) and the fourth block header Z (r, s) are on the same fork of the blockchain L (r, s), and If the sixth block header Z ′′ (r, s) is newer than the fourth block header Z (r, s), then the latest fourth block header Z of the blockchain L (r, s) (r, s) is updated to the sixth block header Z ′′ (r, s);
  • processing module is also used to:
  • the third account group and the fourth account group are respectively any account group in the blockchain network
  • processing module is specifically used for:
  • the first node determines the random number by using the proof-of-work algorithm according to the second preset condition
  • the first node generates the block header of the first block according to the preset block header data structure according to the hash value of the block header that the first block depends on and the random number;
  • the first node generates the block body of the first block according to the preset data structure of the block body of the valid first transaction information
  • the first node combines the block header and the block body to form the first block.
  • the receiving module is also used to:
  • the block body on the second blockchain sent by the node corresponding to the fifth account group including: second transaction information associated with the first account group; the second block chain is the first Blockchain corresponding to the first account group from the five account groups; the second transaction information is formed by transactions between the accounts of the fifth account group and the first account group;
  • the processing module is also used to:
  • the first node verifies whether the data format of the block body is correct
  • the block body is added to the second block chain stored by the first node.
  • the receiving module is also used to:
  • the first node receives a block body on a third blockchain sent by a node corresponding to the first account group, the block body includes: third transaction information associated with the first account group; the third The blockchain is the blockchain corresponding to the first account group to the sixth account group; the third transaction information is formed by transactions between the accounts of the first account group to the sixth account group;
  • the processing module is also used to:
  • the first node verifies whether the third transaction information is valid
  • the block body is added to the third block chain stored by the first node.
  • processing module is specifically used for:
  • the seventh account group and the eighth account group are the blocks respectively Any account group in the chain network;
  • the receiving module is also used to:
  • the block header including: the hash value of the latest block header that the block header depends on; the fourth blockchain is any of the blockchain networks A blockchain;
  • processing module is specifically used for:
  • the block header is added to the fourth block chain stored by the first node.
  • the fourth blockchain is L (i1, j1)
  • the block header of the received fourth blockchain is L (i1, j1) is B (i1, j1)
  • the i1 j1 is an integer greater than or equal to 0 and less than or equal to G-1
  • the i1 and the j1 represent any account group in the blockchain network
  • the processing module is specifically used to perform the following steps:
  • Step c The first node determines the latest seventh block header Z (r1, s1) of any block chain L (r1, s1) according to the block header B (i1, j1); wherein, the r1 and s1 are integers greater than or equal to 0 and less than or equal to G-1;
  • Step d The first node determines the blockchain L (r1, according to the block header B i2 corresponding to the hash value of the i2th block header B i2 included in the block header B (i1, j1) s1) the latest eighth block header Z '(r1, s1);
  • Step e The first node determines whether the seventh block header Z (r1, s1) and the eighth block header Z '(r1, s1) are the same in the blockchain L (r, s) Bifurcation
  • the block header of the first block further includes: a hash value of the previous block in the first block chain, a hash value of the block body of the first block, and a time stamp .
  • processing module is also used to:
  • the block header of the first block is broadcast to all nodes in the blockchain network, and the block body of the first block Broadcast to the node corresponding to the first account group or the second account group, so that other nodes in the blockchain network can perform the received block header and / or block body of the first block verification.
  • the device of this embodiment may be used to execute the technical solutions of the above method embodiments, and its implementation principles and technical effects are similar, and are not repeated here.
  • FIG. 5 is a structural diagram of an embodiment of an electronic device provided by the present invention. As shown in FIG. 5, the electronic device includes:
  • a processor 501 and a memory 502 for storing executable instructions of the processor 501.
  • it may further include: a communication interface 503 for communicating with other devices.
  • the above components can communicate through one or more buses.
  • the processor 501 is configured to execute the corresponding method in the foregoing method embodiments by executing the executable instructions.
  • the processor 501 is configured to execute the corresponding method in the foregoing method embodiments by executing the executable instructions.
  • the processor 501 is configured to execute the corresponding method in the foregoing method embodiments by executing the executable instructions.
  • the executable instructions For the specific implementation process, reference may be made to the foregoing method embodiments, and details are not described herein again.
  • An embodiment of the present invention also provides a computer-readable storage medium on which a computer program is stored.
  • the computer program is executed by a processor, the corresponding method in the foregoing method embodiment is implemented.
  • the specific implementation process refer to the foregoing method implementation
  • the implementation principles and technical effects are similar, and will not be repeated here.

Abstract

A blockchain-based transaction data processing method and device, and a storage medium. Said method is applied to a first node corresponding to a first account group in a blockchain network, the blockchain network comprising G account groups and G x G blockchains, a blockchain correspondingly connecting any one of the account groups and another one of the account groups. Said method comprises: the first node receiving first transaction information formed by a transaction between accounts of the first account group and a second account group, the first account group or the second account group being any one of the account groups in the blockchain network; the first node generating a first block according to the first transaction information, and adding the first block to a first blockchain; and the first blockchain being the blockchain correspondingly connecting the first account group and the second account group (102). In said method, the first node only needs to save blocks of the blockchain that is associated with the first account group.

Description

基于区块链的交易数据处理方法、设备和存储介质Blockchain-based transaction data processing method, equipment and storage medium 技术领域Technical field
本发明涉及区块链技术领域,尤其涉及一种基于区块链的交易数据处理方法、设备和存储介质。The present invention relates to the field of blockchain technology, and in particular to a blockchain-based transaction data processing method, device, and storage medium.
背景技术Background technique
经典的区块链技术是一种去中心化的公共账本技术。一条区块链一般是无限个有序的按时间排列的交易区块组成。区块链技术确保账本没有双花问题,账本不可以更改,以及网络里面所有节点能达成共识拥有共同的账本。The classic blockchain technology is a decentralized public ledger technology. A blockchain is generally composed of infinitely ordered transaction blocks arranged in time. Blockchain technology ensures that the ledger does not have double spending issues, the ledger cannot be changed, and all nodes in the network can reach a consensus and have a common ledger.
现有的区块链技术里,采用的是单区块链结构,所有的交易都在一条区块链上记录,网络里的每个节点都需要保存一条完整的区块链,也就是需要保存所有的历史交易。由于每个节点的网络容量是有限的,这极大的限制了当前区块链的单位时间交易数量。In the existing blockchain technology, a single blockchain structure is adopted. All transactions are recorded on a blockchain. Each node in the network needs to save a complete blockchain, that is, it needs to be saved. All historical transactions. Since the network capacity of each node is limited, this greatly limits the number of transactions per unit time of the current blockchain.
发明内容Summary of the invention
本发明提供一种基于区块链的交易数据处理方法、设备和存储介质,以提高区块链系统单位时间交易速度。The invention provides a transaction data processing method, equipment and storage medium based on a blockchain to improve the transaction speed per unit time of the blockchain system.
第一方面,本发明提供一种基于区块链的交易数据处理方法,包括:In a first aspect, the present invention provides a blockchain-based transaction data processing method, including:
所述方法应用于第一节点,所述第一节点为区块链网络中第一账户组对应的节点,所述区块链网络中包括G个账户组和G×G个区块链,任一所述账户组到另一个任一所述账户组对应于一条区块链,所述第一账户组为所述区块链网络中的任一账户组,G为大于1的整数;所述方法包括:The method is applied to a first node. The first node is a node corresponding to a first account group in a blockchain network. The blockchain network includes G account groups and G × G blockchains. One account group to another any of the account groups corresponds to a blockchain, the first account group is any account group in the blockchain network, and G is an integer greater than 1; Methods include:
所述第一节点接收第一交易信息;所述第一交易信息是由所述第一账户组到第二账户组的账户之间的交易形成的;所述第二账户组为所述区块链网络中的任一账户组;The first node receives first transaction information; the first transaction information is formed by a transaction between accounts in the first account group to a second account group; the second account group is the block Any account group in the chain network;
所述第一节点根据所述第一交易信息生成第一区块,并将所述第一区块加入到第一区块链上;所述第一区块链为所述第一账户组到所述第二账户组 对应的区块链。The first node generates a first block based on the first transaction information, and adds the first block to the first blockchain; the first blockchain sets the first account group to The blockchain corresponding to the second account group.
第二方面,本发明实施例提供一种电子设备,包括:In a second aspect, an embodiment of the present invention provides an electronic device, including:
处理器;以及Processor; and
存储器,用于存储所述处理器的可执行指令;A memory for storing executable instructions of the processor;
其中,所述处理器配置为经由执行所述可执行指令来执行第一方面中任一项所述的方法。Wherein, the processor is configured to execute the method of any one of the first aspects via execution of the executable instructions.
第三方面,本发明实施例提供一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现第一方面中任一项所述的方法。In a third aspect, an embodiment of the present invention provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the method according to any one of the first aspect is implemented.
本发明实施例提供的基于区块链的交易数据处理方法、设备和存储介质,第一节点接收第一交易信息;所述第一交易信息是由所述第一账户组到第二账户组的账户之间的交易形成的;第一账户组和第二账户组为所述区块链网络中的任一账户组;第一节点根据所述第一交易信息生成第一区块,并将所述第一区块加入到第一区块链上;所述第一区块链为所述第一账户组到所述第二账户组对应的区块链由于账户组,第一节点为第一账户组对应的节点,该第一节点仅需保存与其相关的历史交易,只需要保存所有和第一账户组相关的交易信息即可知道该第一账户组内所有账户的余额,即只需要保存与该第一账户组相关的区块链的区块,同时不同的区块链可以并行交易,在网络容量有限的情况下,提高了区块链系统的单位时间交易速度。In the blockchain-based transaction data processing method, device, and storage medium provided by the embodiments of the present invention, the first node receives first transaction information; the first transaction information is from the first account group to the second account group The transaction between the accounts is formed; the first account group and the second account group are any account groups in the blockchain network; the first node generates a first block based on the first transaction information, and converts The first block is added to the first blockchain; the first block is the block corresponding to the first account group to the second account group. Due to the account group, the first node is the first The node corresponding to the account group, the first node only needs to save the historical transactions related to it, and only needs to save all the transaction information related to the first account group to know the balance of all accounts in the first account group, that is, only need to save The blocks of the blockchain related to the first account group, and different blockchains can be traded in parallel. Under the condition of limited network capacity, the transaction time per unit time of the blockchain system is increased.
附图说明BRIEF DESCRIPTION
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本公开的实施例,并与说明书一起用于解释本公开的原理。The drawings herein are incorporated into and constitute a part of this specification, show embodiments consistent with this disclosure, and are used together with the specification to explain the principles of this disclosure.
图1是本发明提供的基于区块链的交易数据处理方法一实施例的流程示意图;1 is a schematic flowchart of an embodiment of a transaction data processing method based on blockchain provided by the present invention;
图2是本发明提供的基于区块链的交易数据处理方法一实施例的区块链示意图;2 is a block diagram of an embodiment of a transaction data processing method based on blockchain provided by the present invention;
图3是本发明提供的基于区块链的交易数据处理方法一实施例的区块流示意图;3 is a block flow diagram of an embodiment of a transaction data processing method based on blockchain provided by the present invention;
图4是本发明提供的基于区块链的交易数据处理方法另一实施例的区块 链示意图;4 is a block diagram of another embodiment of a blockchain-based transaction data processing method provided by the present invention;
图5是本发明提供的电子设备实施例的示意图。5 is a schematic diagram of an embodiment of an electronic device provided by the present invention.
通过上述附图,已示出本公开明确的实施例,后文中将有更详细的描述。这些附图和文字描述并不是为了通过任何方式限制本公开构思的范围,而是通过参考特定实施例为本领域技术人员说明本公开的概念。Through the above drawings, a clear embodiment of the present disclosure has been shown, which will be described in more detail later. These drawings and textual descriptions are not intended to limit the scope of the concept of the present disclosure in any way, but to explain the concept of the present disclosure to those skilled in the art by referring to specific embodiments.
具体实施方式detailed description
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本公开相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本公开的一些方面相一致的装置和方法的例子。Exemplary embodiments will be described in detail here, examples of which are shown in the drawings. When the following description refers to the accompanying drawings, unless otherwise indicated, the same numerals in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Rather, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
本发明的说明书和权利要求书及所述附图中的术语“包括”和“具有”以及它们任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或单元的过程、方法、系统、产品或设备没有限定于已列出的步骤或单元,而是可选地还包括没有列出的步骤或单元,或可选地还包括对于这些过程、方法、产品或设备固有的其它步骤或单元。The terms "including" and "having" and any variations thereof in the description and claims of the present invention and the accompanying drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally also includes Other steps or units inherent to these processes, methods, products or equipment.
首先对本发明所涉及的应用场景进行介绍:First, the application scenarios involved in the present invention are introduced:
本发明实施例提供的基于区块链的交易数据处理方法,应用于区块链网络中,该区块链网络对应一种可扩展的去中心化密码币系统。该区块链网络中包括多个节点,G个账户组和G×G个区块链,任一个账户组对应至少一个节点,任一条区块链为一个账户组到另一账户组的账户之间的交易生成的区块链接而成的,其中上述两个账户组可以相同,或不同,分别为G个账户组中任一账户组,G为大于1的整数。The transaction data processing method based on the blockchain provided in the embodiments of the present invention is applied to a blockchain network, which corresponds to a scalable decentralized cryptocurrency system. The blockchain network includes multiple nodes, G account groups and G × G blockchains. Any account group corresponds to at least one node, and any blockchain is an account from one account group to another account group. The blocks generated by the transaction between are linked. The above two account groups can be the same or different, and they are any of the G account groups, and G is an integer greater than 1.
每个账户组对应的节点只需要保存2G-1条区块链的区块,对于其他的链只需要保存区块的区块头。The nodes corresponding to each account group only need to save 2G-1 block chain blocks, and for other chains only need to save the block header of the block.
下面以具体的实施例对本发明的技术方案进行详细说明。下面这几个具体的实施例可以相互结合,对于相同或相似的概念或过程可能在某些实施例不再赘述。The technical solutions of the present invention are described in detail below with specific examples. The following specific embodiments may be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments.
图1是本发明提供的基于区块链的交易数据处理方法一实施例的流程示 意图。本实施例的执行主体为第一节点,该第一节点为区块链网络中第一账户组对应的节点,所述第一账户组为所述区块链网络中的任一账户组。如图1所示,本实施例提供的方法,包括:FIG. 1 is a schematic flowchart of an embodiment of a transaction data processing method based on a blockchain provided by the present invention. The execution subject of this embodiment is a first node, which is a node corresponding to a first account group in the blockchain network, and the first account group is any account group in the blockchain network. As shown in FIG. 1, the method provided in this embodiment includes:
步骤101、第一节点接收第一交易信息;所述第一交易信息是由所述第一账户组到第二账户组的账户之间的交易形成的;所述第二账户组为所述区块链网络中的任一账户组。Step 101: The first node receives first transaction information; the first transaction information is formed by a transaction between the accounts of the first account group and the second account group; the second account group is the area Any account group in the blockchain network.
步骤102、第一节点根据所述第一交易信息生成第一区块,并将所述第一区块加入到第一区块链上;所述第一区块链为所述第一账户组到所述第二账户组对应的区块链。Step 102: The first node generates a first block according to the first transaction information and adds the first block to the first blockchain; the first blockchain is the first account group To the blockchain corresponding to the second account group.
具体的,本发明实施例中的方法,可以首先定义账户组的个数,例如为G个账户组,可以通过哈希算法,将账户对应的账户地址分到对应的账户组中。例如将账户地址的哈希值与G取模可以得到该账户对应的账户组。从一个账户组到另一个账户组的账户之间的交易生成的区块形成一条区块链,总共有G×G条链。Specifically, the method in the embodiment of the present invention may first define the number of account groups, for example, G account groups, and a hash algorithm may be used to divide the account addresses corresponding to the accounts into corresponding account groups. For example, modulo the hash of the account address and G can obtain the account group corresponding to the account. The blocks generated by transactions between accounts from one account group to another account group form a blockchain, with a total of G × G chains.
所有的交易都采用未花费交易输出(Unspent Transaction Output,简称UTXO)模型,即每一个交易消耗一个UTXO作为输入,并产生一个新的UTXO作为输出。如图2所示,每两个账户组对应一条区块链(该两个账户组的关系为有序的账户组对,即从一个账户组到另一个账户组对应一条区块链,该两个账户组可以是相同的账户组),这条区块链里的每一个区块里的输入都来自于同一个账户组的UTXO,这个账户组的UTXO来自于所有账户到这个账户组的交易。每一个账户组对应的节点只需要保存所有和这个账户组相关的输入和输出交易即可知道该账户组内所有账户的余额,因此每个账户组对应的节点只需要保存部分历史交易记录,即只需要保存与该账户组相关的区块链的区块,相关的区块链包括其他任一账户组到该账户组对应的区块链,以及该账户组到其他任一账户组(可以去除该账户组)对应的区块链,即2G-1条区块链。All transactions use the Unspent Transaction Output (UTXO) model, that is, each transaction consumes a UTXO as input and generates a new UTXO as output. As shown in Figure 2, every two account groups correspond to a blockchain (the relationship between the two account groups is an orderly account group pair, that is, from one account group to another account group corresponds to a blockchain, the two Account groups can be the same account group), the input in each block of this blockchain comes from the same account group UTXO, the account group UTXO comes from all accounts to this account group transaction . The node corresponding to each account group only needs to save all the input and output transactions related to this account group to know the balance of all accounts in the account group, so the node corresponding to each account group only needs to save some historical transaction records, that is Only need to save the block of the blockchain related to the account group. The related blockchain includes any other account group to the corresponding blockchain of the account group, and the account group to any other account group (can be removed This account group) corresponds to the blockchain, that is, 2G-1 blockchains.
例如账户组A中的账户余额取决于2G-1条区块链,即所有账户组到账户组A的交易对应的G条区块链,账户组A到除了账户组A的所有账户组的交易对应的G-1条区块链。For example, the account balance in account group A depends on 2G-1 blockchains, that is, G blockchains corresponding to transactions from all account groups to account group A, and transactions from account group A to all account groups except account group A Corresponding G-1 blockchain.
所有的G×G条区块链加上区块之间的依赖形成一个类似于网络流的结构, 本发明实施例中称之为区块流,如图3所示。例如G=2,即有两个账户组,记为账户组0和账户组1,图2、图3中链L(0,0)表示账户组0到账户组0对应的区块链,链L(0,1)表示账户组0到账户组1对应的区块链,链L(1,0)表示账户组1到账户组0对应的区块链,链L(1,1)表示账户组1到账户组1对应的区块链。图3中高度2区块比高度1区块生成的时间晚。All G × G blockchains plus the dependencies between the blocks form a network flow-like structure, which is called a block flow in the embodiment of the present invention, as shown in FIG. 3. For example, G = 2, that is, there are two account groups, denoted as account group 0 and account group 1. In FIGS. 2 and 3, the chain L (0,0) represents the blockchain corresponding to account group 0 to account group 0. L (0,1) represents the blockchain corresponding to account group 0 to account group 1, chain L (1,0) represents the blockchain corresponding to account group 1 to account group 0, and chain L (1,1) represents the account Blockchain corresponding to Group 1 to Account Group 1. In Figure 3, the height 2 block is generated later than the height 1 block.
区块链网络在最初时刻只有G×G个初始区块,即每个区块链都有一个初始区块。然后,区块链网络里的账户开始形成各自的交易,并广播到区块链网络里。区块链网络里面的节点根据交易的输入账户组和输出账户组把交易信息打包成不同区块链上的区块。假设交易是账户组A到账户组B的账户之间的交易,则输入账户组为账户组A,输出账户组为账户组B。这些区块最终广播到整个区块链网络,区块链网络里的节点会验证然后选择接收新的区块或者拒绝不符合协议规则的区块。At the initial moment, the blockchain network has only G × G initial blocks, that is, each blockchain has an initial block. Then, the accounts in the blockchain network begin to form their own transactions and broadcast to the blockchain network. The nodes in the blockchain network package the transaction information into blocks on different blockchains according to the input account group and output account group of the transaction. Assuming that the transaction is a transaction between accounts in account group A and account group B, the input account group is account group A, and the output account group is account group B. These blocks are eventually broadcast to the entire blockchain network, and the nodes in the blockchain network will verify and then choose to receive new blocks or reject blocks that do not meet the protocol rules.
以G=2为例,假设所有的账户地址为自然数:0,1,2,3,4…。账户地址n1对应的账户组为n1%2。总共有4条链,L(0,0),L(0,1),L(1,0),L(1,1)。一个从账户地址n1到账户地址n2的交易信息最后需要提交到区块链L(n1%2,n2%2)上去。区块链网络里的账户交易的时候把交易广播到P2P网络里。区块链网络里有大量的挖矿节点,这些挖矿节点缓存某个节点(对应一个账户)提交的交易信息。挖矿节点的作用是把交易信息打包成区块,然后加到该交易信息的输入账户组到输出账户组对应的区块链上去。Taking G = 2 as an example, assume that all account addresses are natural numbers: 0, 1, 2, 3, 4 ... The account group corresponding to the account address n1 is n1% 2. There are 4 chains in total, L (0,0), L (0,1), L (1,0), L (1,1). A transaction from the account address n1 to the account address n2 needs to be submitted to the blockchain L (n1% 2, n2% 2). Account transactions in the blockchain network broadcast the transactions to the P2P network. There are a large number of mining nodes in the blockchain network, and these mining nodes cache the transaction information submitted by a certain node (corresponding to an account). The function of the mining node is to package the transaction information into blocks, and then add the input account group of the transaction information to the corresponding blockchain of the output account group.
以下以第一节点为挖矿节点为例进行说明:The following takes the first node as a mining node for example:
第一节点选择第一账户组到第二账户组对应的区块链(即第一区块链)进行挖矿,第一节点把没有加入到第一区块链的交易信息打包,即第一节点接收第一交易信息,该第一交易信息是由第一账户组到第二账户组的账户之间的交易形成的。The first node selects the blockchain corresponding to the first account group to the second account group (that is, the first blockchain) for mining. The first node packages the transaction information that has not been added to the first blockchain, namely the first The node receives the first transaction information, which is formed by the transaction between the accounts of the first account group and the second account group.
第一节点根据第一交易信息生成第一区块,并将第一区块加入到第一区块链上。The first node generates a first block based on the first transaction information, and adds the first block to the first blockchain.
可选的,将所述第一区块加入第一区块链之后,还包括:Optionally, after adding the first block to the first blockchain, the method further includes:
所述第一节点将所述第一区块的区块头广播至所述区块链网络中的所有节点,并将所述第一区块的区块主体广播至与所述第一账户组或者第二账户组对应的节点,以使所述区块链网络中的其他节点对接收到的所述第一区块 的区块头和/或区块主体进行验证。The first node broadcasts the block header of the first block to all nodes in the blockchain network, and broadcasts the block body of the first block to the first account group or The node corresponding to the second account group, so that other nodes in the blockchain network can verify the received block header and / or block body of the first block.
具体的,第一节点在生成第一区块之后,可以将该第一区块广播至区块链网络中的其他节点,具体可以是将第一区块广播至与第一账户组或者第二账户组对应的节点,例如可以将第一区块的区块头和区块主体拆分开广播至第一账户组或者第二账户组对应的节点,也可以将区块头和区块主体作为一个整体进行广播,也可以先广播区块头再广播区块主体,或者同时广播区块头和区块主体,本发明对此并不限定。Specifically, after generating the first block, the first node may broadcast the first block to other nodes in the blockchain network, and may specifically broadcast the first block to the first account group or the second The node corresponding to the account group, for example, can split the block header and block body of the first block and broadcast it to the node corresponding to the first account group or the second account group, or the block head and block body as a whole For broadcasting, the block header may be broadcast before the block body, or the block header and the block body may be broadcast at the same time, which is not limited in the present invention.
进一步,还可以将第一区块的区块头广播至其他节点,即不是第一账户组和第二账户组对应的节点。Further, the block header of the first block may also be broadcast to other nodes, that is, nodes that are not corresponding to the first account group and the second account group.
本实施例的方法,第一节点接收第一交易信息;所述第一交易信息是由所述第一账户组到第二账户组的账户之间的交易形成的;第一账户组和第二账户组为所述区块链网络中的任一账户组;第一节点根据所述第一交易信息生成第一区块,并将所述第一区块加入到第一区块链上;所述第一区块链为所述第一账户组到所述第二账户组对应的区块链由于账户组,第一节点为第一账户组对应的节点,该第一节点仅需保存与其相关的历史交易,只需要保存所有和第一账户组相关的交易信息即可知道该第一账户组内所有账户的余额,即只需要保存与该第一账户组相关的区块链的区块,同时不同的区块链可以并行交易,在网络容量有限的情况下,提高了区块链系统的单位时间交易速度。In the method of this embodiment, the first node receives the first transaction information; the first transaction information is formed by transactions between the accounts of the first account group to the second account group; the first account group and the second The account group is any account group in the blockchain network; the first node generates a first block based on the first transaction information, and adds the first block to the first blockchain; The first blockchain is the blockchain corresponding to the first account group to the second account group. Due to the account group, the first node is the node corresponding to the first account group, and the first node only needs to save its related Of historical transactions, you only need to save all transaction information related to the first account group to know the balance of all accounts in the first account group, that is, only need to save the block of the blockchain related to the first account group, At the same time, different blockchains can be traded in parallel. In the case of limited network capacity, the transaction speed of the blockchain system per unit time is increased.
在上述实施例的基础上,可选的,步骤102之前,还包括:Based on the above embodiment, optionally, before step 102, it further includes:
所述第一节点获取所述第一区块依赖的区块头的哈希值;所述第一区块依赖的区块头为能确定出所述区块链网络中所有区块链的区块头;The first node obtains the hash value of the block header that the first block depends on; the block header that the first block depends on is a block header that can determine all the blockchains in the blockchain network;
相应的,步骤102,具体可以采用如下方式实现:Correspondingly, step 102 can be implemented in the following manner:
所述第一节点根据所述第一交易信息和所述第一区块依赖的区块头的哈希值,生成第一区块。The first node generates a first block based on the first transaction information and the hash value of the block header that the first block depends on.
具体的,本发明实施例中的区块链与区块链之间的区块是有紧密的依赖的,每一个新的区块会依赖于多条区块链,所以要包含多个先前产生的区块头的哈希,即生成的第一区块中要包含多个依赖的区块链的区块头的哈希值。通过该些依赖的区块头为能确定出区块链网络中所有区块链的区块头,即通过 该些依赖的区块头能确定出整个区块链网络中的所有区块链。在确定第一区块依赖的区块头时要确保每一个新产生的区块是符合预期的。Specifically, the block between the blockchain and the blockchain in the embodiment of the present invention is closely dependent, and each new block will depend on multiple blockchains, so it must include multiple previously generated The hash of the block header, that is, the generated first block contains the hash value of the block header of multiple dependent blockchains. Through these dependent block headers, the block headers of all blockchains in the blockchain network can be determined, that is, through the dependent block headers, all blockchains in the entire blockchain network can be determined. When determining the block header that the first block depends on, make sure that each newly generated block is as expected.
第一节点根据接收到的第一交易信息和第一区块依赖的区块头的哈希值,生成第一区块。The first node generates the first block based on the received first transaction information and the hash value of the block header that the first block depends on.
我们希望每一个新的第一区块都能确定G×G条区块链链的状态。最简单的办法是把所有区块链链的最新的区块头的哈希值保存到新产生的第一区块的区块头中,但是这种做法无疑是低效的,需要存储G×G个哈希值。We hope that each new first block can determine the state of the G × G blockchain chain. The easiest way is to save the hash value of the latest block header of all blockchains in the newly generated block header of the first block, but this method is undoubtedly inefficient and requires the storage of G × G Hash value.
其中,最新的区块头可以是确定区块最多的区块头,也可以是创建时间最晚的区块头,本发明实施例对此并不限定。Among them, the latest block header may be the block header with the most determined blocks or the block header with the latest creation time, which is not limited in this embodiment of the present invention.
进一步的,作为一种优化的方案,若所述第一区块链为L(i,j);所述i、j分别为大于或等于0,且小于或等于G-1的整数,所述i表示第一账户组,所述j表示第二账户组,所述第一节点获取所述第一区块依赖的区块头的哈希值,包括:Further, as an optimized solution, if the first blockchain is L (i, j); the i and j are integers greater than or equal to 0 and less than or equal to G-1, respectively. i represents a first account group, j represents a second account group, and the first node obtains the hash value of the block header that the first block depends on, including:
所述第一节点根据第一预设条件,从已验证的区块头中选择一个初始的区块头;The first node selects an initial block header from the verified block headers according to the first preset condition;
所述第一节点从G个区块链L(i,m)中各选一个最新的第二区块头B(i,m),使得所述第二区块头B(i,m)确定出的每一条区块链的最新的区块头和所述初始的区块头确定出的对应区块链的最新的区块头兼容;所述m的取值范围为从0到G-1的整数;所述m表示所述区块链网络中的任一账户组;The first node selects an up-to-date second block header B (i, m) from the G blockchains L (i, m), so that the second block header B (i, m) determines The latest block header of each blockchain is compatible with the latest block header of the corresponding blockchain determined by the initial block header; the value of m is an integer from 0 to G-1; m represents any account group in the blockchain network;
对于不同的k,所述第一节点从G个区块链L(k,l_k)中选一个最新的第三区块头B(k,l_k),使得所述第三区块头B(k,l_k)确定出的每一条区块链的最新的区块头和所述初始的区块头确定出的对应区块链的最新的区块头兼容;所述k的取值范围为从0到G-1的整数,且k不等于i,l_k的取值范围为从0到G-1的整数;所述k表示所述区块链网络中除所述第一账户组之外的任一账户组,所述l_k表示所述区块链网络中任一账户组;For different k, the first node selects the latest third block header B (k, l_k) from the G blockchains L (k, l_k), so that the third block header B (k, l_k) The latest block header of each block chain determined is compatible with the latest block header of the corresponding block chain determined by the initial block header; the value range of k is an integer from 0 to G-1 , And k is not equal to i, the value range of l_k is an integer from 0 to G-1; the k represents any account group in the blockchain network except the first account group, the l_k represents any account group in the blockchain network;
所述第一节点将初始的区块头、所述第二区块头和所述第三区块头,作为所述第一区块依赖的区块头,并计算所述第一区块依赖的区块头的哈希值。The first node uses the initial block header, the second block header, and the third block header as the block header that the first block depends on, and calculates the block header that the first block depends on Hash value.
具体的,第一节点挑选第一区块依赖的区块头,首先可以获取一个已经验证过的区块头作为初始的区块头,加入第一区块依赖的区块头中。Specifically, the first node selects the block header that the first block depends on. First, it can obtain a verified block header as the initial block header and add it to the block header that the first block depends on.
该初始的区块头可以是满足第一预设条件的区块头,第一预设条件可以 是以该初始的区块头出发确定的区块的数目最多,或者,以该初始的区块头出发确定的总的区块难度最高,本发明实施例对此并不限定。The initial block header may be a block header that satisfies the first preset condition, and the first preset condition may be the maximum number of blocks determined based on the initial block header, or determined based on the initial block header The total block difficulty is the highest, which is not limited in the embodiment of the present invention.
可选的,确定出初始的区块头之后,根据初始的区块头确定区块链L(r,s)的最新的第四区块头Z(r,s);其中,所述r、s分别为大于或等于0,且小于或等于G-1的整数;Optionally, after the initial block header is determined, the latest fourth block header Z (r, s) of the blockchain L (r, s) is determined according to the initial block header; where r and s are respectively An integer greater than or equal to 0 and less than or equal to G-1;
其中,区块链L(r,s)为区块链网络中任一条区块链。Among them, the blockchain L (r, s) is any blockchain in the blockchain network.
挑选出初始的区块头后,第一节点从L(i,0)、L(i,1)、…、L(i,G-1),这G个区块链L(i,m)中各选一个最新的第二区块头B(i,m),使得所述第二区块头B(i,m)确定出的每一条区块链的最新的区块头和所述初始的区块头确定出的对应区块链的最新的区块头兼容。After selecting the initial block header, the first node selects from L (i, 0), L (i, 1), ..., L (i, G-1), among the G blockchains L (i, m) Choose a newest second block header B (i, m), so that the latest block header and the initial block header of each blockchain determined by the second block header B (i, m) are determined The latest block header corresponding to the corresponding blockchain is compatible.
从G个区块链L(i,m)中各选一个最新的第二区块头B(i,m),具体可以采用如下方式实现:Select the latest second block header B (i, m) from the G blockchains L (i, m), which can be implemented in the following manner:
步骤a、所述第一节点从区块链L(i,m)中选一个最新的第二区块头B(i,m),使得所述第二区块头B(i,m)确定的所述区块链L(r,s)的最新的第五区块头Z'(r,s)和所述第四区块头Z(r,s)在所述区块链L(r,s)的相同分叉上,且若所述第五区块头Z'(r,s)比所述第四区块头Z(r,s)新,则将所述区块链L(r,s)的最新的第四区块头Z(r,s)更新为所述第五区块头Z'(r,s);Step a. The first node selects a newest second block header B (i, m) from the blockchain L (i, m), so that the second block header B (i, m) determines the The latest fifth block header Z '(r, s) of the blockchain L (r, s) and the fourth block header Z (r, s) are the same in the blockchain L (r, s) On a fork, and if the fifth block header Z '(r, s) is newer than the fourth block header Z (r, s), then the latest of the blockchain L (r, s) The fourth block header Z (r, s) is updated to the fifth block header Z '(r, s);
将m加一,重复执行步骤a,直至m达到G-1;其中,所述m的初始值为0。Add one to m and repeat step a until m reaches G-1; where the initial value of m is 0.
具体的,先从L(i,0)中先选一个最新的第二区块头B(i,0),使得第二区块头B(i,0)确定出的区块链L(r,s)的最新的第五区块头Z'(r,s)和初始的区块头确定出的第四区块头Z(r,s)在区块链L(r,s)的相同分叉上,若第五区块头Z'(r,s)比第四区块头Z(r,s)新,则将区块链L(r,s)的最新的第四区块头Z(r,s)更新为第五区块头Z'(r,s),若第五区块头Z'(r,s)比第四区块头Z(r,s)旧,那么区块链L(r,s)的最新的第四区块头Z(r,s)保持不变。这里新旧指的是时间上的新旧,即同一条区块链上生成的时间越晚越新。Specifically, first select a newest second block header B (i, 0) from L (i, 0), so that the blockchain L (r, s determined by the second block header B (i, 0) ) 'S latest fifth block header Z' (r, s) and the fourth block header Z (r, s) determined by the initial block header are on the same fork of the blockchain L (r, s), if The fifth block header Z '(r, s) is newer than the fourth block header Z (r, s), then the latest fourth block header Z (r, s) of the blockchain L (r, s) is updated to The fifth block header Z '(r, s), if the fifth block header Z' (r, s) is older than the fourth block header Z (r, s), then the newest block chain L (r, s) The fourth block header Z (r, s) remains unchanged. The old and new here refers to the old and new in time, that is, the later the time generated on the same blockchain, the newer.
将m加一,重复执行步骤a,即再从L(i,1)中先选一个最新的第二区块头B(i,1),使得第二区块头B(i,1)确定出的区块链L(r,s)的最新的第五区块头Z'(r,s)和第四区块头Z(r,s)在区块链L(r,s)的相同分叉上,若第五区块头Z'(r,s)比第四区块头Z(r,s)(此时第四区块头可能是已经更新过的区块头)新,则将区块链 L(r,s)的最新的第四区块头Z(r,s)更新为第五区块头Z'(r,s),若第五区块头Z'(r,s)比第四区块头Z(r,s)旧,那么区块链L(r,s)的最新的第四区块头Z(r,s)保持不变。将m加一,重复执行步骤a,直至m达到G-1。Add one to m, and repeat step a, that is, first select the latest second block header B (i, 1) from L (i, 1), so that the second block header B (i, 1) determines The latest fifth block header Z '(r, s) and fourth block header Z (r, s) of the blockchain L (r, s) are on the same fork of the blockchain L (r, s), If the fifth block header Z '(r, s) is newer than the fourth block header Z (r, s) (in this case, the fourth block header may be an updated block header), then the blockchain L (r, s) The latest fourth block header Z (r, s) is updated to the fifth block header Z '(r, s), if the fifth block header Z' (r, s) is higher than the fourth block header Z (r, s) Old, then the latest fourth block header Z (r, s) of the blockchain L (r, s) remains unchanged. Increase m by one and repeat step a until m reaches G-1.
此时挑选出1(初始的区块头)+G个第一区块依赖的区块头。At this time, select 1 (initial block header) + G block headers that the first block depends on.
然后,再挑选G-1个第一区块依赖的区块头。Then, select G-1 block headers that the first block depends on.
对于每一个k(k≠i)来说,第一节点从L(k,0)、L(k,1)、…、L(k,G-1),这G个区块链L(k,l_k)中选一个最新的第三区块头B(k,l_k),使得所述第三区块头B(k,l_k)确定出的每一条区块链的最新的区块头和所述初始的区块头确定出的对应区块链的最新的区块头兼容。For each k (k ≠ i), the first node starts from L (k, 0), L (k, 1), ..., L (k, G-1), and these G blockchains L (k , l_k) select the latest third block header B (k, l_k), so that the third block header B (k, l_k) determines the latest block header of each blockchain and the initial area The block header determines the latest block header compatible with the corresponding blockchain.
对于不同的k,所述第一节点从G个区块链L(k,l_k)中选一个最新的第三区块头B(k,l_k),具体可以采用如下方式实现:For different k, the first node selects the latest third block header B (k, l_k) from the G blockchains L (k, l_k), which can be implemented in the following manner:
步骤b、所述第一节点从区块链L(k,l_k)中选一个最新的第三区块头B(k,l_k),使得所述第三区块头B(k,l_k)确定的所述区块链L(r,s)的最新的第六区块头Z″(r,s)和所述第四区块头Z(r,s)在相同的区块链L(r,s)上,且若所述第六区块头Z″(r,s)比所述第四区块头Z(r,s)新,则将所述区块链L(r,s)的最新的第四区块头Z(r,s)更新为所述第六区块头Z″(r,s);Step b. The first node selects the latest third block header B (k, l_k) from the blockchain L (k, l_k), so that the third block header B (k, l_k) determines the The latest sixth block header Z ″ (r, s) of the blockchain L (r, s) and the fourth block header Z (r, s) are on the same blockchain L (r, s), And if the sixth block header Z ″ (r, s) is newer than the fourth block header Z (r, s), then the latest fourth block header of the blockchain L (r, s) Z (r, s) is updated to the sixth block header Z ″ (r, s);
将k加一,重复执行步骤b,直至k达到G-1;其中,所述k的初始值为0,且k不等于i。Add one to k and repeat step b until k reaches G-1; where the initial value of k is 0 and k is not equal to i.
具体的,若i等于0,则k的初始值为1。Specifically, if i is equal to 0, the initial value of k is 1.
假设i不等于0,对于k=0来说,第一节点从L(0,0)、L(0,1)、…、L(0,G-1),这G个区块链L(0,l_k)中选一个最新的第三区块头B(0,l_k),使得所述第三区块头B(0,l_k)确定的所述区块链L(r,s)的最新的第六区块头Z″(r,s)和所述第四区块头Z(r,s)(此时的第四区块头可能已经在步骤a中进行了更新)在区块链L(r,s)的相同分叉上,且若所述第六区块头Z″(r,s)比所述第四区块头Z(r,s)新,则将所述区块链L(r,s)的最新的第四区块头Z(r,s)更新为所述第六区块头Z″(r,s),若第六区块头Z″(r,s)比第四区块头Z(r,s)旧,那么区块链L(r,s)的最新的第四区块头Z(r,s)保持不变。将i加一,重复执行步骤b,直至k达到G-1。Assuming that i is not equal to 0, for k = 0, the first node starts from L (0,0), L (0,1), ..., L (0, G-1), the G blockchains L ( 0, l_k) selects the latest third block header B (0, l_k), so that the third block header B (0, l_k) determines the latest sixth of the blockchain L (r, s) Block header Z ″ (r, s) and the fourth block header Z (r, s) (the fourth block header at this time may have been updated in step a) in the blockchain L (r, s) On the same fork, and if the sixth block header Z ″ (r, s) is newer than the fourth block header Z (r, s), then the blockchain L (r, s) The latest fourth block header Z (r, s) is updated to the sixth block header Z ″ (r, s), if the sixth block header Z ″ (r, s) is higher than the fourth block header Z (r, s ) Old, then the latest fourth block header Z (r, s) of the blockchain L (r, s) remains unchanged. Increase i by one and repeat step b until k reaches G-1.
其中,在一些实施例中,若所述初始的区块头所在的区块链为区块链L(p,q),则若所述i等于所述p,则所述m不等于q;Wherein, in some embodiments, if the block where the initial block header is located is block L (p, q), if i is equal to p, then m is not equal to q;
若所述i不等于所述p,则k不等于p。If the i is not equal to the p, k is not equal to p.
具体的,为了减少第一区块的区块头中包括的依赖的区块头的哈希值,一种优化的方案是,挑选出2G-1个第一区块依赖的区块头,即在G个区块链L(i,m)中各选一个最新的第二区块头B(i,m)的过程中除去初始的区块头所在的区块链,即若初始的区块头所在的区块链为区块链L(p,q),则i等于p时,m不等于q,进一步,若L(i,m)中不包括区块链L(p,q),则对于不同的k,所述第一节点从G个区块链L(k,l_k)中选一个最新的第三区块头B(k,l_k)的过程中,将初始的区块头所在的区块链去除,即k不等于p,即不从L(p,l_k)这G个区块链中选区块头。Specifically, in order to reduce the hash value of the dependent block header included in the block header of the first block, an optimized solution is to select 2G-1 block headers that the first block depends on, that is, in G In the process of selecting an up-to-date second block header B (i, m) in the blockchain L (i, m), the block where the original block header is located is removed, that is, if the block where the initial block header is located Is blockchain L (p, q), when i is equal to p, m is not equal to q, further, if L (i, m) does not include blockchain L (p, q), then for different k, When the first node selects the latest third block header B (k, l_k) from the G block chains L (k, l_k), the block where the initial block header is located is removed, that is, k does not Is equal to p, that is, the block header is not selected from the G blockchains of L (p, l_k).
需要说明的是,步骤a和步骤b的实现过程不分先后顺序。It should be noted that the steps a and b are implemented in no particular order.
上述具体实施方式中,将第一区块依赖的区块头的哈希值放入第一区块的区块头中,可以确定出区块链网络中所有区块链的状态。In the above specific embodiment, the hash value of the block header that the first block depends on is placed in the block header of the first block to determine the status of all blockchains in the blockchain network.
在上述实施例的基础上,可选的,在步骤102之前,还可以进行如下操作:Based on the above embodiment, optionally, before step 102, the following operations may also be performed:
所述第一节点根据第三账户组到第一账户组对应的区块链确定所述第一交易信息对应的交易输入,是否来自于所述第三账户组到所述第一账户组的账户之间的交易对应的交易输出;The first node determines whether the transaction input corresponding to the first transaction information is from the account of the third account group to the first account group according to the blockchain corresponding to the first account group from the third account group The transaction output corresponding to the transaction between;
若是,则所述第一节点根据所述第一账户组到第四账户组对应的区块链验证所述交易输出,是否未被所述第一账户组到所述第四账户组的账户之间的交易使用;所述第三账户组和所述第四账户组分别为所述区块链网络中任一账户组;If yes, the first node verifies the transaction output according to the blockchain corresponding to the first account group to the fourth account group. Use of transactions between; the third account group and the fourth account group are respectively any account group in the blockchain network;
若是,则确定所述第一交易信息有效。If yes, it is determined that the first transaction information is valid.
具体的,在生成第一区块之前,需要验证接收到的第一交易信息是否有效,即第一交易信息对应的交易是否有效。Specifically, before generating the first block, it is necessary to verify whether the received first transaction information is valid, that is, whether the transaction corresponding to the first transaction information is valid.
需要验证两点,1、第一交易信息对应的交易输入是否来自于有效的UTXO,2、没有双花。Two points need to be verified: 1. Whether the transaction input corresponding to the first transaction information comes from a valid UTXO, and 2. There is no double spending.
根据上述选择出的依赖的区块头,可以确定出区块链网络中每一条区块链的区块,从而确定了所有的历史交易,即确定了一个账本。Based on the selected block headers selected above, each block of the block chain in the block chain network can be determined, thereby determining all historical transactions, that is, determining a ledger.
首先,根据任一账户组到第一账户组对应的区块链中区块包括的交易信息,确定第一交易信息对应的交易输入,是否来自于其他账户组到第一账户 组的账户之间的交易对应的交易输出,即是否来自于之前的一个交易的输出。First, according to the transaction information included in the block in the blockchain corresponding to the first account group from any account group, determine whether the transaction input corresponding to the first transaction information comes from another account group to the account of the first account group The transaction output corresponding to the transaction, that is, whether it came from the output of a previous transaction.
然后,根据第一账户组到任一账户组对应的区块链中区块包括的交易信息,验证交易输出,是否未被第一账户组到其他账户组的账户之间的交易使用,即该交易输出没有被其他交易消耗掉。Then, according to the transaction information included in the block in the blockchain corresponding to the first account group to any account group, verify whether the transaction output is not used by the transaction between the accounts of the first account group and other account groups, that is, the The transaction output is not consumed by other transactions.
如果满足上述两个条件,则说明第一交易信息有效。If the above two conditions are met, it means that the first transaction information is valid.
因此,每一个账户组对应的节点只需要保存所有和这个账户组相关的输入和输出交易即可知道该账户组内所有账户的余额,因此每个账户组对应的节点只需要保存部分历史交易记录,即只需要保存与该账户组相关的区块链的区块,相关的区块链包括其他任一账户组到该账户组对应的区块链,以及该账户组到其他任一账户组(可以去除该账户组)对应的区块链,即2G-1条区块链。对于该账户组不相关的区块链仅需要保存区块头即可。Therefore, the node corresponding to each account group only needs to save all input and output transactions related to this account group to know the balance of all accounts in the account group, so the node corresponding to each account group only needs to save some historical transaction records , That is, only the blocks of the blockchain related to the account group need to be saved. The related blockchain includes any other account group to the corresponding blockchain of the account group, and the account group to any other account group ( The corresponding blockchain of the account group can be removed, that is, 2G-1 blockchains. For the blockchain that is not related to the account group, only the block header needs to be saved.
进一步的,第一节点根据所述第一交易信息和所述第一区块依赖的区块头的哈希值,生成第一区块,具体可以采用如下方式实现:Further, the first node generates the first block according to the first transaction information and the hash value of the block header that the first block depends on, which may be specifically implemented as follows:
所述第一节点按照第二预设条件利用工作证明算法,确定随机数;The first node determines the random number by using the proof-of-work algorithm according to the second preset condition;
所述第一节点将所述第一区块依赖的区块头的哈希值和所述随机数,按照预设的区块头的数据结构生成所述第一区块的区块头;The first node generates the block header of the first block according to the preset block header data structure according to the hash value of the block header that the first block depends on and the random number;
所述第一节点将有效的所述第一交易信息按照预设的区块主体的数据结构,生成所述第一区块的区块主体;The first node generates the block body of the first block according to the preset data structure of the block body of the valid first transaction information;
所述第一节点将所述区块头和所述区块主体组合形成所述第一区块。The first node combines the block header and the block body to form the first block.
第一区块包括区块头和区块主体,可选的,所述第一区块的区块头还包括:所述第一区块链中上一个区块的哈希值、所述第一区块的区块主体的哈希值和时间戳。The first block includes a block header and a block body. Optionally, the block header of the first block further includes: the hash value of the previous block in the first block chain, the first area The hash value and time stamp of the block body of the block.
具体的,第一节点在生成第一区块时,需要通过工作证明算法,寻找随机数,该随机数满足第二预设条件。例如通过该随机数生成的区块的哈希值满足一定的条件,如小于预设阈值。Specifically, when generating the first block, the first node needs to find a random number through a proof-of-work algorithm, and the random number satisfies the second preset condition. For example, the hash value of the block generated by the random number satisfies certain conditions, such as less than a preset threshold.
然后将随机数、选出的依赖的区块头的哈希值、时间戳(即第一区块创建时间)、该区块链的上一个区块的哈希值、第一区块的区块主体(即有效负载)的哈希值等信息组成第一区块的区块头。Then the random number, the hash value of the selected dependent block header, the timestamp (that is, the first block creation time), the hash value of the previous block of the blockchain, the block of the first block The hash value of the main body (ie, payload) and other information constitute the block header of the first block.
并将验证后的有效的第一交易信息生成第一区块的区块主体,然后将区块头和区块主体生成最终的第一区块。The validated first transaction information is used to generate the block body of the first block, and then the block header and block body are generated into the final first block.
区块头还可以包括如下信息:描述信息(比如:版本信息,有效负载大小,所有依赖的区块头的哈希的哈希,交易Merkle树根节点的哈希值,工作证明算法的目标值等等)。The block header can also include the following information: description information (such as: version information, payload size, hash of all dependent block header hashes, the hash value of the root node of the transaction Merkle tree, the target value of the proof of work algorithm, etc. ).
区块主体(即有效负载)还可以包括其他任何可以存储的数据。The block body (that is, the payload) can also include any other data that can be stored.
上述哈希可以是任何哈希函数计算出来的,包括MD5,SHA-1,SHA-224,SHA-256,SHA-384,SHA-512,SHA-512/224,SHA-512/256,SHA-3等。The above hash can be calculated by any hash function, including MD5, SHA-1, SHA-224, SHA-256, SHA-384, SHA-512, SHA-512 / 224, SHA-512 / 256, SHA- 3 etc.
上述具体实施方式中,在生成第一区块之前需要验证接收到的第一交易信息是否有效,该第一区块链的第一区块与2G-1条区块链相关,即所有账户组到第一账户组的交易对应的G条区块链,第一账户组到除了第一账户组的所有账户组的交易对应的G-1条区块链,因此根据与第一账户组相关的账户组的交易信息,即第一区块链相关的区块链,可确定出该第一交易信息是否有效。In the above specific embodiment, it is necessary to verify whether the received first transaction information is valid before generating the first block. The first block of the first blockchain is related to 2G-1 blockchains, that is, all account groups G blockchains corresponding to transactions in the first account group, G-1 blockchains corresponding to transactions in all account groups except the first account group, so according to the The transaction information of the account group, that is, the blockchain related to the first blockchain, can determine whether the first transaction information is valid.
在上述实施例的基础上,可选的,本实施例的方法还包括:Based on the above embodiment, optionally, the method in this embodiment further includes:
所述第一节点接收第五账户组对应的节点发送的第二区块链上的区块主体,所述区块主体包括:所述第一账户组关联的第二交易信息;所述第二区块链为第五账户组到所述第一账户组对应的区块链;所述第二交易信息是由所述第五账户组到所述第一账户组的账户之间的交易形成的;The first node receives a block body on the second blockchain sent by a node corresponding to the fifth account group, the block body includes: second transaction information associated with the first account group; the second The blockchain is the blockchain corresponding to the first account group from the fifth account group; the second transaction information is formed by the transaction between the accounts of the fifth account group and the first account group ;
所述第一节点验证所述区块主体的数据格式是否正确;The first node verifies whether the data format of the block body is correct;
若正确,则将所述区块主体加入所述第一节点存储的第二区块链中。If it is correct, the block body is added to the second block chain stored by the first node.
具体的,第一节点接收其他节点发送的区块主体,例如第五账户组对应的节点发送的第二区块链上的区块主体。该区块主体包括第一账户组相关的第二交易信息,该第二交易信息是由第五账户组到所述第一账户组的账户之间的交易形成的。第二区块链为第五账户组到第一账户组对应的区块链。Specifically, the first node receives the block body sent by other nodes, for example, the block body on the second block chain sent by the node corresponding to the fifth account group. The block body includes second transaction information related to the first account group, and the second transaction information is formed by transactions between the fifth account group and the accounts of the first account group. The second blockchain is the corresponding blockchain from the fifth account group to the first account group.
在实际应用中,需要确定该区块主体对应的区块头是否接收到,若没有接收到,则等接收到区块头之后,第一节点验证该区块的数据格式是否正确;若正确,则加入该第一节点存储的第二区块链中,同时把该区块主体转发给P2P网络里第五账户组和第一账户组对应的节点,然后把区块头转发给区块链网络中的其他所有节点;若不正确,则放弃这个区块,不做任何处理。In actual applications, it is necessary to determine whether the block header corresponding to the block body is received. If it is not received, after receiving the block header, the first node verifies whether the data format of the block is correct; if it is correct, add In the second blockchain stored by the first node, the block body is forwarded to the nodes corresponding to the fifth account group and the first account group in the P2P network, and then the block header is forwarded to other nodes in the blockchain network. All nodes; if it is incorrect, the block is discarded without any processing.
进一步,还可以验证区块头中的随机数是否满足工作证明POW的预设 条件,即验证区块的哈希值是否符合预设要求。Further, it can also be verified whether the random number in the block header meets the preset conditions of the proof of work POW, that is, whether the hash value of the block meets the preset requirements.
进一步的,本实施例的方法还包括:Further, the method of this embodiment further includes:
所述第一节点接收第一账户组对应的节点发送的第三区块链上的区块主体,所述区块主体包括:所述第一账户组关联的第三交易信息;所述第三区块链为第一账户组到第六账户组对应的区块链;所述第三交易信息是由所述第一账户组到所述第六账户组的账户之间的交易形成的;The first node receives a block body on a third blockchain sent by a node corresponding to the first account group, the block body includes: third transaction information associated with the first account group; the third The blockchain is the blockchain corresponding to the first account group to the sixth account group; the third transaction information is formed by transactions between the accounts of the first account group to the sixth account group;
所述第一节点验证所述第三交易信息是否有效;The first node verifies whether the third transaction information is valid;
若所述第三交易信息有效,则将所述区块主体加入所述第一节点存储的第三区块链中。If the third transaction information is valid, the block body is added to the third block chain stored by the first node.
具体的,第一节点接收其他节点发送的区块主体,例如第一账户组对应的其他节点发送的第三区块链上的区块主体。该区块主体包括第一账户组相关的第三交易信息,该第二交易信息是由第一账户组到第六账户组的账户之间的交易形成的。第三区块链为第一账户组到第六账户组对应的区块链。Specifically, the first node receives the block body sent by other nodes, for example, the block body on the third block chain sent by other nodes corresponding to the first account group. The block body includes third transaction information related to the first account group, and the second transaction information is formed by transactions between the accounts of the first account group to the sixth account group. The third blockchain is the blockchain corresponding to the first account group to the sixth account group.
在实际应用中,需要确定该区块主体对应的区块头是否接收到,若没有接收到,则等接收到区块头之后,第一节点验证该区块主体的数据格式是否正确;若正确,且第三交易信息有效,则加入该第一节点存储的第三区块链中,同时把该区块主体转发给P2P网络里第六账户组和第一账户组对应的节点,然后把区块头转发给区块链网络中的其他所有节点转发给P2P网络里的其他节点;若不正确,则放弃这个区块,不做任何处理。In practical applications, it is necessary to determine whether the block header corresponding to the block body is received. If it is not received, after receiving the block header, the first node verifies that the data format of the block body is correct; if it is correct, and If the third transaction information is valid, it is added to the third blockchain stored by the first node, and the block body is forwarded to the nodes corresponding to the sixth account group and the first account group in the P2P network, and then the block header is forwarded Forward to all other nodes in the blockchain network to other nodes in the P2P network; if it is not correct, the block is discarded without any processing.
可选的,所述第一节点验证所述第三交易信息是否有效,具体可以通过如下方式实现:Optionally, the first node verifies whether the third transaction information is valid, which may be specifically implemented as follows:
所述第一节点根据第七账户组到所述第一账户组对应的区块链确定所述第三交易信息对应的交易输入,是否来自于所述第七账户组到所述第一账户组的账户之间的交易对应的交易输出;The first node determines whether the transaction input corresponding to the third transaction information is from the seventh account group to the first account group according to the blockchain corresponding to the first account group from the seventh account group The transaction output corresponding to the transaction between the accounts;
若是,则所述第一节点根据第一账户组到第八账户组对应的区块链验证所述交易输出,是否未被所述第一账户组到第八账户组的账户之间的交易使用;所述第七账户组和所述第八账户组分别为所述区块链网络中任一账户组;If yes, the first node verifies the transaction output according to the blockchain corresponding to the first account group to the eighth account group, and is not used by the transaction between the accounts of the first account group to the eighth account group ; The seventh account group and the eighth account group are respectively any account group in the blockchain network;
若是,则确定所述第三交易信息有效。If yes, it is determined that the third transaction information is valid.
验证第三交易信息是否有效的过程与前述实施例中验证第一交易信息是否有效的过程类似,此处不再赘述。The process of verifying whether the third transaction information is valid is similar to the process of verifying whether the first transaction information is valid in the foregoing embodiment, and details are not described here.
上述具体实施方式中,在接收到区块之后需要验证该区块的区块主体的交易信息是否有效,根据与区块所在的区块链相关的其他区块链,可确定出该交易信息是否有效。In the above specific embodiment, after receiving the block, it is necessary to verify whether the transaction information of the block body of the block is valid, and according to other blockchains related to the blockchain where the block is located, it can be determined whether the transaction information effective.
在上述实施例的基础上,可选的,本实施例的方法还包括:Based on the above embodiment, optionally, the method in this embodiment further includes:
所述第一节点接收第二节点发送的第四区块链中的区块头,所述区块头包括:所述区块头依赖的最新区块的哈希值;所述第四区块链为区块链网络中任一区块链;The first node receives the block header in the fourth blockchain sent by the second node, the block header includes: a hash value of the latest block that the block header depends on; the fourth blockchain is a zone Any blockchain in the blockchain network;
所述第一节点验证所述第四区块链中的区块头的区块依赖是否合理;The first node verifies whether the block dependency of the block header in the fourth block chain is reasonable;
若所述第四区块链中的区块头的区块依赖是否合理,则将所述区块头加入所述第一节点存储的第四区块链中。If the block dependency of the block header in the fourth block chain is reasonable, the block header is added to the fourth block chain stored by the first node.
具体的,第一节点除了会接收其他依赖区块链的区块主体之外,还会接收到所有的区块链的区块头,具体接收第二节点发送的第四区块链中的区块头,第二节点可以是区块链网络中任一账户组对应的节点。第四区块链为区块链网络中任一区块链。Specifically, in addition to receiving other block bodies that rely on the blockchain, the first node will also receive all the block headers of the blockchain, specifically the block headers in the fourth blockchain sent by the second node. The second node may be a node corresponding to any account group in the blockchain network. The fourth blockchain is any blockchain in the blockchain network.
所述区块头包括:该区块头依赖的最新区块头的哈希值。The block header includes: the hash value of the latest block header that the block header depends on.
第一节点需要验证该区块头的区块依赖是否合理;若合理,则将该区块头加入第一节点存储的第四区块链中,同时转发给P2P网络里的其他节点;若不合理,放弃这个区块头,不做任何处理。The first node needs to verify whether the block dependency of the block header is reasonable; if it is reasonable, the block header is added to the fourth block chain stored by the first node and forwarded to other nodes in the P2P network; if unreasonable, Discard this block header without doing anything.
可选的,假设所述第四区块链为L(i1,j1),接收到的第四区块链为L(i1,j1)的区块头为B(i1,j1);所述i1、j1分别为大于或等于0,且小于或等于G-1的整数,所述i1和所述j1表示所述区块链网络中任一账户组,所述第一节点验证所述第四区块链中的区块头的区块依赖是否合理,具体可以通过如下方式实现:Optionally, assuming that the fourth blockchain is L (i1, j1), the block header of the received fourth blockchain is L (i1, j1) is B (i1, j1); the i1 j1 is an integer greater than or equal to 0 and less than or equal to G-1, the i1 and the j1 represent any account group in the blockchain network, and the first node verifies the fourth block Whether the block dependency of the block header in the chain is reasonable can be achieved in the following ways:
步骤c、所述第一节点根据所述区块头B(i1,j1),确定任一条区块链L(r1,s1)的最新的第七区块头Z(r1,s1);其中,所述r1、s1分别为大于或等于0,且小于或等于G-1的整数;Step c. The first node determines the latest seventh block header Z (r1, s1) of any block chain L (r1, s1) according to the block header B (i1, j1); wherein, the r1 and s1 are integers greater than or equal to 0 and less than or equal to G-1;
步骤d、所述第一节点根据所述区块头B(i1,j1)中包括的第i2个区块头B i2的哈希值对应的区块头B i2,确定所述区块链L(r1,s1)的最新的第八区块头Z'(r1,s1); Step d: The first node determines the blockchain L (r1, according to the block header B i2 corresponding to the hash value of the i2th block header B i2 included in the block header B (i1, j1) s1) the latest eighth block header Z '(r1, s1);
步骤e、所述第一节点确定所述第七区块头Z(r1,s1)和所述第八区块头Z'(r1,s1)是否在所述区块链L(r,s)的相同分叉上;Step e. The first node determines whether the seventh block header Z (r1, s1) and the eighth block header Z '(r1, s1) are the same in the blockchain L (r, s) Bifurcation
若是,则在所述第八区块头Z'(r1,s1)比所述第七区块头Z(r1,s1)新时,将所述第七区块头Z(r1,s1)更新为所述第八区块头Z'(r1,s1);If yes, when the eighth block header Z '(r1, s1) is newer than the seventh block header Z (r1, s1), update the seventh block header Z (r1, s1) to the The eighth block header Z '(r1, s1);
将i2加一,重复执行步骤d-e,直至i2达到2G或所述第七区块头Z(r1,s1)和所述第八区块头Z'(r1,s1)不在所述区块链L(r,s)的相同分叉上停止执行;其中,所述i2的初始值为1;Increase i2 by one and repeat step de until i2 reaches 2G or the seventh block header Z (r1, s1) and the eighth block header Z '(r1, s1) are not in the blockchain L (r , s) stops execution on the same fork; where, the initial value of i2 is 1;
若所有的区块头B i2确定的第八区块头Z'(r1,s1)均与所述第七区块头Z(r1,s1)在相同的区块链L(r,s)上,则确定所述第四区块链中的区块头的区块依赖合理。 If all the eighth block header Z '(r1, s1) determined by the block header B i2 are on the same blockchain L (r, s) as the seventh block header Z (r1, s1), then it is determined The block dependency of the block header in the fourth block chain is reasonable.
具体来说,首先,第一节点根据所述区块头B(i1,j1),确定任一条区块链L(r1,s1)的最新的第七区块头Z(r1,s1),然后根据区块头B(i1,j1)中包括的第1个区块头B 1的哈希值对应的区块头B 1,确定所述区块链L(r1,s1)的最新的第八区块头Z'(r1,s1),确定第七区块头Z(r1,s1)与第八区块头Z'(r1,s1)是否在区块链L(r,s)的相同分叉上;若是,则说明该区块头B 1合理,若第八区块头Z'(r1,s1)比第七区块头Z(r1,s1)新时,将第七区块头Z(r1,s1)更新为第八区块头Z'(r1,s1); Specifically, first, the first node determines the latest seventh block header Z (r1, s1) of any blockchain L (r1, s1) according to the block header B (i1, j1), and then header B (i1, j1) includes a first header region B corresponding to the hash value of a header region B 1, determining that the block chains L (r1, s1) of the latest header eighth region Z '( r1, s1), determine whether the seventh block header Z (r1, s1) and the eighth block header Z '(r1, s1) are on the same fork of the blockchain L (r, s); Block header B 1 is reasonable. If the eighth block header Z '(r1, s1) is newer than the seventh block header Z (r1, s1), update the seventh block header Z (r1, s1) to the eighth block header Z '(r1, s1);
然后,将i2加1,然后继续执行上述步骤直至i2达到2G或第七区块头Z(r1,s1)和第八区块头Z'(r1,s1)不在区块链L(r,s)的相同分叉上停止执行。Then, add 1 to i2, and then continue to perform the above steps until i2 reaches 2G or the seventh block header Z (r1, s1) and the eighth block header Z '(r1, s1) are not in the blockchain L (r, s) Stop execution on the same fork.
若第七区块头Z(r1,s1)和第八区块头Z'(r1,s1)不在区块链L(r,s)的相同分叉上,则说明该区块头的依赖有问题,不能形成一个正确的账本,则中断验证,验证不通过。If the seventh block header Z (r1, s1) and the eighth block header Z '(r1, s1) are not on the same fork of the blockchain L (r, s), it means that the block header's dependence is problematic and cannot be When a correct ledger is formed, the verification is interrupted and the verification fails.
若所有的区块头B i2确定的第八区块头Z'(r1,s1)均与第七区块头Z(r1,s1)在相同的区块链L(r,s)上,则确定第三区块链中的区块头的区块依赖合理。 If all the eighth block header Z '(r1, s1) determined by the block header B i2 are on the same blockchain L (r, s) as the seventh block header Z (r1, s1), the third The block dependency of the block header in the blockchain is reasonable.
最后确定出的Z(r1,s1)就是最终该区块链的最新区块,即最终确定了每一条区块链。The final determined Z (r1, s1) is the latest block of the blockchain, that is, each blockchain is finally determined.
其中,若在挑选第一区块依赖的区块头时,挑选出2G-1个区块头,则i2的最大值为2G-1。Among them, if 2G-1 block headers are selected when selecting the block header that the first block depends on, the maximum value of i2 is 2G-1.
如图4所示,一条区块链的分叉是由最新的区块决定的,一般情况下只有一条分叉,没有分叉,在区块链的形成过程中,短的分叉最终被抛弃,保留最长的分叉作为该区块链。As shown in Figure 4, the fork of a blockchain is determined by the latest block. Generally, there is only one fork and no fork. During the formation of the blockchain, short forks are eventually abandoned , Keep the longest fork as the blockchain.
上述具体实施方式中,在接收到区块的区块头之后,需要验证区块头中包括的最新的区块头是否合理。In the above specific embodiment, after receiving the block header of the block, it is necessary to verify whether the latest block header included in the block header is reasonable.
本发明实施例还提供一种基于区块链的交易数据处理装置,该装置设置在第一节点,所述第一节点为区块链网络中第一账户组对应的节点,所述区块链网络中包括G个账户组和G×G个区块链,任一所述账户组到另一个任一所述账户组对应于一条区块链,所述第一账户组为所述区块链网络中的任一账户组,G为大于1的整数;基于区块链的交易数据处理装置包括:An embodiment of the present invention also provides a transaction data processing device based on a blockchain. The device is provided at a first node. The first node is a node corresponding to a first account group in a blockchain network. The blockchain The network includes G account groups and G × G blockchains, any one of the account groups to another any of the account groups corresponds to a blockchain, and the first account group is the blockchain For any account group in the network, G is an integer greater than 1; the transaction data processing device based on the blockchain includes:
接收模块,用于接收第一交易信息;所述第一交易信息是由所述第一账户组到第二账户组的账户之间的交易形成的;所述第二账户组为所述区块链网络中的任一账户组;A receiving module, configured to receive first transaction information; the first transaction information is formed by a transaction between accounts in the first account group to a second account group; the second account group is the block Any account group in the chain network;
处理模块,用于根据所述第一交易信息生成第一区块,并将所述第一区块加入到第一区块链上;所述第一区块链为所述第一账户组到所述第二账户组对应的区块链。The processing module is configured to generate a first block according to the first transaction information and add the first block to the first blockchain; the first blockchain is the first account group to The blockchain corresponding to the second account group.
可选的,所述处理模块,具体用于:Optionally, the processing module is specifically used for:
在根据所述第一交易信息生成第一区块之前,获取所述第一区块依赖的区块头的哈希值;所述第一区块依赖的区块头为能确定出所述区块链网络中所有区块链的区块头;Before generating the first block according to the first transaction information, obtain the hash value of the block header that the first block depends on; the block header that the first block depends on can determine the blockchain Block headers of all blockchains in the network;
所述第一节点根据所述第一交易信息和所述第一区块依赖的区块头的哈希值,生成第一区块。The first node generates a first block based on the first transaction information and the hash value of the block header that the first block depends on.
可选的,若所述第一区块链为L(i,j);所述i、j分别为大于或等于0,且小于或等于G-1的整数,所述i表示第一账户组,所述j表示第二账户组,所述处理模块,具体用于:Optionally, if the first blockchain is L (i, j); i and j are integers greater than or equal to 0 and less than or equal to G-1, respectively, and i represents the first account group , J represents a second account group, and the processing module is specifically used to:
根据第一预设条件,从已验证的区块头中选择一个初始的区块头;According to the first preset condition, select an initial block header from the verified block headers;
从G个区块链L(i,m)中各选一个最新的第二区块头B(i,m),使得所述第二区块头B(i,m)确定出的每一条区块链的最新的区块头和所述初始的区块头确定出的对应区块链的最新的区块头兼容;所述m的取值范围为从0到G-1的整数;所述m表示所述区块链网络中的任一账户组;Choose one of the latest second block header B (i, m) from the G blockchains L (i, m), so that each block chain determined by the second block header B (i, m) The latest block header of is compatible with the latest block header of the corresponding blockchain determined by the initial block header; the value of m is an integer from 0 to G-1; the m represents the area Any account group in the blockchain network;
对于不同的k,从G个区块链L(k,l_k)中选一个最新的第三区块头B(k,l_k),使得所述第三区块头B(k,l_k)确定出的每一条区块链的最新的区块头和所述初始的区块头确定出的对应区块链的最新的区块头兼容;所述k的取值范围为从0到G-1的整数,且k不等于i,l_k的取值范围为从0到G-1的整数;所 述k表示所述区块链网络中除所述第一账户组之外的任一账户组,所述l_k表示所述区块链网络中任一账户组;For different k, select the latest third block header B (k, l_k) from the G blockchains L (k, l_k), so that each item determined by the third block header B (k, l_k) The latest block header of the blockchain is compatible with the latest block header of the corresponding blockchain determined by the initial block header; the value of k is an integer from 0 to G-1, and k is not equal to i, l_k is an integer ranging from 0 to G-1; the k represents any account group except the first account group in the blockchain network, and the l_k represents the area Any account group in the blockchain network;
将初始的区块头、所述第二区块头和所述第三区块头,作为所述第一区块依赖的区块头,并计算所述第一区块依赖的区块头的哈希值。The initial block header, the second block header, and the third block header are used as the block header that the first block depends on, and the hash value of the block header that the first block depends on is calculated.
可选的,若所述初始的区块头所在的区块链为区块链L(p,q),则若所述i等于所述p,则所述m不等于q;Optionally, if the block where the initial block header is located is block L (p, q), if i is equal to p, then m is not equal to q;
若所述i不等于所述p,则k不等于p。If the i is not equal to the p, k is not equal to p.
可选的,所述处理模块,具体用于执行如下步骤:Optionally, the processing module is specifically used to perform the following steps:
在根据第一预设条件,从已验证的区块头中选择一个初始的区块头之后,根据所述初始的区块头确定区块链L(r,s)的最新的第四区块头Z(r,s);其中,所述r、s分别为大于或等于0,且小于或等于G-1的整数;After selecting an initial block header from the verified block headers according to the first preset condition, the latest fourth block header Z (r of the blockchain L (r, s) is determined according to the initial block header , s); wherein, r and s are integers greater than or equal to 0 and less than or equal to G-1, respectively;
步骤a、从区块链L(i,m)中选一个最新的第二区块头B(i,m),使得所述第二区块头B(i,m)确定的所述区块链L(r,s)的最新的第五区块头Z'(r,s)和所述第四区块头Z(r,s)在所述区块链L(r,s)的相同分叉上,且若所述第五区块头Z'(r,s)比所述第四区块头Z(r,s)新,则将所述区块链L(r,s)的最新的第四区块头Z(r,s)更新为所述第五区块头Z'(r,s);Step a. Select a newest second block header B (i, m) from the block chain L (i, m), so that the second block header B (i, m) determines the block chain L ( r, s) the latest fifth block header Z '(r, s) and the fourth block header Z (r, s) are on the same fork of the blockchain L (r, s), and If the fifth block header Z '(r, s) is newer than the fourth block header Z (r, s), then the latest fourth block header Z of the blockchain L (r, s) (r, s) is updated to the fifth block header Z '(r, s);
将m加一,重复执行步骤a,直至m达到G-1;其中,所述m的初始值为0;Add one to m and repeat step a until m reaches G-1; where the initial value of m is 0;
步骤b、从区块链L(k,l_k)中选一个最新的第三区块头B(k,l_k),使得所述第三区块头B(k,l_k)确定的所述区块链L(r,s)的最新的第六区块头Z″(r,s)和所述第四区块头Z(r,s)在所述区块链L(r,s)的相同分叉上,且若所述第六区块头Z″(r,s)比所述第四区块头Z(r,s)新,则将所述区块链L(r,s)的最新的第四区块头Z(r,s)更新为所述第六区块头Z″(r,s);Step b. Select the latest third block header B (k, l_k) from the block chain L (k, l_k), so that the block chain L () determined by the third block header B (k, l_k) r, s) The latest sixth block header Z ″ (r, s) and the fourth block header Z (r, s) are on the same fork of the blockchain L (r, s), and If the sixth block header Z ″ (r, s) is newer than the fourth block header Z (r, s), then the latest fourth block header Z of the blockchain L (r, s) (r, s) is updated to the sixth block header Z ″ (r, s);
将k加一,重复执行步骤b,直至k达到G-1;其中,所述k的初始值为0,且k不等于i。Add one to k and repeat step b until k reaches G-1; where the initial value of k is 0 and k is not equal to i.
可选的,所述处理模块,还用于:Optionally, the processing module is also used to:
根据所述第一交易信息生成第一区块之前,根据第三账户组到第一账户组对应的区块链确定所述第一交易信息对应的交易输入,是否来自于所述第三账户组到所述第一账户组的账户之间的交易对应的交易输出;Before generating the first block according to the first transaction information, determine whether the transaction input corresponding to the first transaction information comes from the third account group according to the blockchain corresponding to the first account group from the third account group Transaction output corresponding to the transaction between the accounts of the first account group;
若是,则根据所述第一账户组到第四账户组对应的区块链验证所述交易 输出,是否未被所述第一账户组到所述第四账户组的账户之间的交易使用;所述第三账户组和所述第四账户组分别为所述区块链网络中任一账户组;If so, verify that the transaction output is not used by transactions between the accounts of the first account group and the fourth account group according to the blockchain corresponding to the first account group to the fourth account group; The third account group and the fourth account group are respectively any account group in the blockchain network;
若是,则确定所述第一交易信息有效。If yes, it is determined that the first transaction information is valid.
可选的,所述处理模块,具体用于:Optionally, the processing module is specifically used for:
所述第一节点按照第二预设条件利用工作证明算法,确定随机数;The first node determines the random number by using the proof-of-work algorithm according to the second preset condition;
所述第一节点将所述第一区块依赖的区块头的哈希值和所述随机数,按照预设的区块头的数据结构生成所述第一区块的区块头;The first node generates the block header of the first block according to the preset block header data structure according to the hash value of the block header that the first block depends on and the random number;
所述第一节点将有效的所述第一交易信息按照预设的区块主体的数据结构,生成所述第一区块的区块主体;The first node generates the block body of the first block according to the preset data structure of the block body of the valid first transaction information;
所述第一节点将所述区块头和所述区块主体组合形成所述第一区块。The first node combines the block header and the block body to form the first block.
可选的,所述接收模块,还用于:Optionally, the receiving module is also used to:
接收第五账户组对应的节点发送的第二区块链上的区块主体,所述区块主体包括:所述第一账户组关联的第二交易信息;所述第二区块链为第五账户组到所述第一账户组对应的区块链;所述第二交易信息是由所述第五账户组到所述第一账户组的账户之间的交易形成的;Receiving the block body on the second blockchain sent by the node corresponding to the fifth account group, the block body including: second transaction information associated with the first account group; the second block chain is the first Blockchain corresponding to the first account group from the five account groups; the second transaction information is formed by transactions between the accounts of the fifth account group and the first account group;
所述处理模块,还用于:The processing module is also used to:
所述第一节点验证所述区块主体的数据格式是否正确;The first node verifies whether the data format of the block body is correct;
若正确,则将所述区块主体加入所述第一节点存储的第二区块链中。If it is correct, the block body is added to the second block chain stored by the first node.
可选的,所述接收模块,还用于:Optionally, the receiving module is also used to:
所述第一节点接收第一账户组对应的节点发送的第三区块链上的区块主体,所述区块主体包括:所述第一账户组关联的第三交易信息;所述第三区块链为第一账户组到第六账户组对应的区块链;所述第三交易信息是由所述第一账户组到所述第六账户组的账户之间的交易形成的;The first node receives a block body on a third blockchain sent by a node corresponding to the first account group, the block body includes: third transaction information associated with the first account group; the third The blockchain is the blockchain corresponding to the first account group to the sixth account group; the third transaction information is formed by transactions between the accounts of the first account group to the sixth account group;
所述处理模块,还用于:The processing module is also used to:
所述第一节点验证所述第三交易信息是否有效;The first node verifies whether the third transaction information is valid;
若所述第三交易信息有效,则将所述区块主体加入所述第一节点存储的第三区块链中。If the third transaction information is valid, the block body is added to the third block chain stored by the first node.
可选的,所述处理模块,具体用于:Optionally, the processing module is specifically used for:
确定所述第三交易信息对应的交易输入,是否来自于所述第七账户组到所述第一账户组的账户之间的交易对应的交易输出;Determining whether the transaction input corresponding to the third transaction information comes from the transaction output corresponding to the transaction between the accounts of the seventh account group and the first account group;
若是,则验证所述交易输出,是否未被所述第一账户组到第八账户组的账户之间的交易使用;所述第七账户组和所述第八账户组分别为所述区块链网络中任一账户组;If yes, verify whether the transaction output is not used by transactions between the accounts of the first account group to the eighth account group; the seventh account group and the eighth account group are the blocks respectively Any account group in the chain network;
若是,则确定所述第三交易信息有效。If yes, it is determined that the third transaction information is valid.
可选的,所述接收模块,还用于:Optionally, the receiving module is also used to:
接收第二节点发送的第四区块链中的区块头,所述区块头包括:所述区块头依赖的最新区块头的哈希值;所述第四区块链为区块链网络中任一区块链;Receiving the block header in the fourth blockchain sent by the second node, the block header including: the hash value of the latest block header that the block header depends on; the fourth blockchain is any of the blockchain networks A blockchain;
可选的,所述处理模块,具体用于:Optionally, the processing module is specifically used for:
验证所述第四区块链中的区块头的区块依赖是否合理;Verify whether the block dependency of the block header in the fourth blockchain is reasonable;
若所述第四区块链中的区块头的区块依赖是否合理,则将所述区块头加入所述第一节点存储的第四区块链中。If the block dependency of the block header in the fourth block chain is reasonable, the block header is added to the fourth block chain stored by the first node.
可选的,假设所述第四区块链为L(i1,j1),接收到的第四区块链为L(i1,j1)的区块头为B(i1,j1);所述i1、j1分别为大于或等于0,且小于或等于G-1的整数,所述i1和所述j1表示所述区块链网络中任一账户组,所述处理模块,具体用于执行如下步骤:Optionally, assuming that the fourth blockchain is L (i1, j1), the block header of the received fourth blockchain is L (i1, j1) is B (i1, j1); the i1 j1 is an integer greater than or equal to 0 and less than or equal to G-1, the i1 and the j1 represent any account group in the blockchain network, and the processing module is specifically used to perform the following steps:
步骤c、所述第一节点根据所述区块头B(i1,j1),确定任一条区块链L(r1,s1)的最新的第七区块头Z(r1,s1);其中,所述r1、s1分别为大于或等于0,且小于或等于G-1的整数;Step c. The first node determines the latest seventh block header Z (r1, s1) of any block chain L (r1, s1) according to the block header B (i1, j1); wherein, the r1 and s1 are integers greater than or equal to 0 and less than or equal to G-1;
步骤d、所述第一节点根据所述区块头B(i1,j1)中包括的第i2个区块头B i2的哈希值对应的区块头B i2,确定所述区块链L(r1,s1)的最新的第八区块头Z'(r1,s1); Step d: The first node determines the blockchain L (r1, according to the block header B i2 corresponding to the hash value of the i2th block header B i2 included in the block header B (i1, j1) s1) the latest eighth block header Z '(r1, s1);
步骤e、所述第一节点确定所述第七区块头Z(r1,s1)和所述第八区块头Z'(r1,s1)是否在所述区块链L(r,s)的相同分叉上;Step e. The first node determines whether the seventh block header Z (r1, s1) and the eighth block header Z '(r1, s1) are the same in the blockchain L (r, s) Bifurcation
若是,则在所述第八区块头Z'(r1,s1)比所述第七区块头Z(r1,s1)新时,将所述第七区块头Z(r1,s1)更新为所述第八区块头Z'(r1,s1);If yes, when the eighth block header Z '(r1, s1) is newer than the seventh block header Z (r1, s1), update the seventh block header Z (r1, s1) to the The eighth block header Z '(r1, s1);
将i2加一,重复执行步骤d-e,直至i2达到2G或所述第七区块头Z(r1,s1)和所述第八区块头Z'(r1,s1)不在所述区块链L(r,s)的相同分叉上停止执行;其中,所述i2的初始值为1;Increase i2 by one and repeat step de until i2 reaches 2G or the seventh block header Z (r1, s1) and the eighth block header Z '(r1, s1) are not in the blockchain L (r , s) stops execution on the same fork; where, the initial value of i2 is 1;
若所有的区块头B i2确定的第八区块头Z'(r1,s1)均与所述第七区块头Z(r1,s1)在所述区块链L(r,s)的相同分叉上,则确定所述第四区块链中的区块头 的区块依赖合理。 If the eighth block header Z '(r1, s1) determined by all block headers B i2 is the same as the seventh block header Z (r1, s1) in the same blockchain L (r, s) On the above, it is determined that the block dependency of the block header in the fourth block chain is reasonable.
可选的,所述第一区块的区块头还包括:所述第一区块链中上一个区块的哈希值、所述第一区块的区块主体的哈希值和时间戳。Optionally, the block header of the first block further includes: a hash value of the previous block in the first block chain, a hash value of the block body of the first block, and a time stamp .
可选的,所述处理模块,还用于:Optionally, the processing module is also used to:
将所述第一区块加入第一区块链之后,将所述第一区块的区块头广播至所述区块链网络中的所有节点,并将所述第一区块的区块主体广播至与所述第一账户组或者第二账户组对应的节点,以使所述区块链网络中的其他节点对接收到的所述第一区块的区块头和/或区块主体进行验证。After adding the first block to the first blockchain, the block header of the first block is broadcast to all nodes in the blockchain network, and the block body of the first block Broadcast to the node corresponding to the first account group or the second account group, so that other nodes in the blockchain network can perform the received block header and / or block body of the first block verification.
本实施例的装置,可以用于执行上述方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。The device of this embodiment may be used to execute the technical solutions of the above method embodiments, and its implementation principles and technical effects are similar, and are not repeated here.
图5为本发明提供的电子设备实施例的结构图,如图5所示,该电子设备包括:FIG. 5 is a structural diagram of an embodiment of an electronic device provided by the present invention. As shown in FIG. 5, the electronic device includes:
处理器501,以及,用于存储处理器501的可执行指令的存储器502。A processor 501, and a memory 502 for storing executable instructions of the processor 501.
可选的,还可以包括:通信接口503,用于与其他设备通信。Optionally, it may further include: a communication interface 503 for communicating with other devices.
上述部件可以通过一条或多条总线进行通信。The above components can communicate through one or more buses.
其中,处理器501配置为经由执行所述可执行指令来执行前述方法实施例中对应的方法,其具体实施过程可以参见前述方法实施例,此处不再赘述。The processor 501 is configured to execute the corresponding method in the foregoing method embodiments by executing the executable instructions. For the specific implementation process, reference may be made to the foregoing method embodiments, and details are not described herein again.
本发明实施例中还提供一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现前述方法实施例中对应的方法,其具体实施过程可以参见前述方法实施例,其实现原理和技术效果类似,此处不再赘述。An embodiment of the present invention also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the corresponding method in the foregoing method embodiment is implemented. For the specific implementation process, refer to the foregoing method implementation For example, the implementation principles and technical effects are similar, and will not be repeated here.
本领域技术人员在考虑说明书及实践这里公开的发明后,将容易想到本公开的其它实施方案。本发明旨在涵盖本公开的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本公开的一般性原理并包括本公开未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本公开的真正范围和精神由下面的权利要求书指出。Those skilled in the art will easily think of other embodiments of the present disclosure after considering the description and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses, or adaptive changes of the present disclosure that follow the general principles of the present disclosure and include common general knowledge or common technical means in the technical field not disclosed in the present disclosure. . The description and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are pointed out by the following claims.
应当理解的是,本公开并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本公开的范围仅由所附的权利要求书来限制。It should be understood that the present disclosure is not limited to the precise structure that has been described above and shown in the drawings, and that various modifications and changes can be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (15)

  1. 一种基于区块链的交易数据处理方法,其特征在于,所述方法应用于第一节点,所述第一节点为区块链网络中第一账户组对应的节点,所述区块链网络中包括G个账户组和G×G个区块链,任一所述账户组到另一个任一所述账户组对应于一条区块链,所述第一账户组为所述区块链网络中的任一账户组,G为大于1的整数;所述方法包括:A blockchain-based transaction data processing method, characterized in that the method is applied to a first node, the first node is a node corresponding to a first account group in a blockchain network, and the blockchain network Includes G account groups and G × G blockchains, any one of the account groups to another any of the account groups corresponds to a blockchain, and the first account group is the blockchain network In any account group in G, G is an integer greater than 1; the method includes:
    所述第一节点接收第一交易信息;所述第一交易信息是由所述第一账户组到第二账户组的账户之间的交易形成的;所述第二账户组为所述区块链网络中的任一账户组;The first node receives first transaction information; the first transaction information is formed by a transaction between accounts in the first account group to a second account group; the second account group is the block Any account group in the chain network;
    所述第一节点根据所述第一交易信息生成第一区块,并将所述第一区块加入到第一区块链上;所述第一区块链为所述第一账户组到所述第二账户组对应的区块链。The first node generates a first block based on the first transaction information, and adds the first block to the first blockchain; the first blockchain sets the first account group to The blockchain corresponding to the second account group.
  2. 根据权利要求1所述的方法,其特征在于,所述第一节点根据所述第一交易信息生成第一区块之前,还包括:The method according to claim 1, wherein before the first node generates the first block according to the first transaction information, the method further comprises:
    所述第一节点获取所述第一区块依赖的区块头的哈希值;所述第一区块依赖的区块头为能确定出所述区块链网络中所有区块链的区块头;The first node obtains the hash value of the block header that the first block depends on; the block header that the first block depends on is a block header that can determine all the blockchains in the blockchain network;
    所述第一节点根据所述第一交易信息生成第一区块,包括:The first node generating the first block according to the first transaction information includes:
    所述第一节点根据所述第一交易信息和所述第一区块依赖的区块头的哈希值,生成第一区块。The first node generates a first block based on the first transaction information and the hash value of the block header that the first block depends on.
  3. 根据权利要求2所述的方法,其特征在于,若所述第一区块链为L(i,j);所述i、j分别为大于或等于0,且小于或等于G-1的整数,所述i表示第一账户组,所述j表示第二账户组,所述第一节点获取所述第一区块依赖的区块头的哈希值,包括:The method according to claim 2, wherein if the first blockchain is L (i, j); i and j are integers greater than or equal to 0 and less than or equal to G-1, respectively , The i represents a first account group, the j represents a second account group, and the first node obtains the hash value of the block header that the first block depends on, including:
    所述第一节点根据第一预设条件,从已验证的区块头中选择一个初始的区块头;The first node selects an initial block header from the verified block headers according to the first preset condition;
    所述第一节点从G个区块链L(i,m)中各选一个最新的第二区块头B(i,m),使得所述第二区块头B(i,m)确定出的每一条区块链的最新的区块头和所述初始的区块头确定出的对应区块链的最新的区块头兼容;所述m的取值范围为从0到G-1的整数;所述m表示所述区块链网络中的任一账户组;The first node selects an up-to-date second block header B (i, m) from the G blockchains L (i, m), so that the second block header B (i, m) determines The latest block header of each blockchain is compatible with the latest block header of the corresponding blockchain determined by the initial block header; the value of m is an integer from 0 to G-1; m represents any account group in the blockchain network;
    对于不同的k,所述第一节点从G个区块链L(k,l_k)中选一个最新的第三 区块头B(k,l_k),使得所述第三区块头B(k,l_k)确定出的每一条区块链的最新的区块头和所述初始的区块头确定出的对应区块链的最新的区块头兼容;所述k的取值范围为从0到G-1的整数,且k不等于i,l_k的取值范围为从0到G-1的整数;所述k表示所述区块链网络中除所述第一账户组之外的任一账户组,所述l_k表示所述区块链网络中任一账户组;For different k, the first node selects the latest third block header B (k, l_k) from the G blockchains L (k, l_k), so that the third block header B (k, l_k) The latest block header of each block chain determined is compatible with the latest block header of the corresponding block chain determined by the initial block header; the value range of k is an integer from 0 to G-1 , And k is not equal to i, the value range of l_k is an integer from 0 to G-1; the k represents any account group in the blockchain network except the first account group, the l_k represents any account group in the blockchain network;
    所述第一节点将初始的区块头、所述第二区块头和所述第三区块头,作为所述第一区块依赖的区块头,并计算所述第一区块依赖的区块头的哈希值。The first node uses the initial block header, the second block header, and the third block header as the block header that the first block depends on, and calculates the block header that the first block depends on Hash value.
  4. 根据权利要求3所述的方法,其特征在于,若所述初始的区块头所在的区块链为区块链L(p,q),则若所述i等于所述p,则所述m不等于q;The method according to claim 3, characterized in that, if the initial block header block chain is the block chain L (p, q), then if the i is equal to the p, the m Not equal to q;
    若所述i不等于所述p,则k不等于p。If the i is not equal to the p, k is not equal to p.
  5. 根据权利要求4所述的方法,其特征在于,所述第一节点根据第一预设条件,从已验证的区块头中选择一个初始的区块头之后,还包括:The method according to claim 4, wherein after the first node selects an initial block header from the verified block headers according to the first preset condition, the method further includes:
    根据所述初始的区块头确定区块链L(r,s)的最新的第四区块头Z(r,s);其中,所述r、s分别为大于或等于0,且小于或等于G-1的整数;Determine the latest fourth block header Z (r, s) of the blockchain L (r, s) according to the initial block header; wherein, r and s are respectively greater than or equal to 0 and less than or equal to G An integer of -1;
    相应的,所述第一节点从G个区块链L(i,m)中各选一个最新的第二区块头B(i,m),包括:Correspondingly, the first node selects the latest second block header B (i, m) from the G blockchains L (i, m), including:
    步骤a、所述第一节点从区块链L(i,m)中选一个最新的第二区块头B(i,m),使得所述第二区块头B(i,m)确定的所述区块链L(r,s)的最新的第五区块头Z'(r,s)和所述第四区块头Z(r,s)在所述区块链L(r,s)的相同分叉上,且若所述第五区块头Z'(r,s)比所述第四区块头Z(r,s)新,则将所述区块链L(r,s)的最新的第四区块头Z(r,s)更新为所述第五区块头Z'(r,s);Step a. The first node selects a newest second block header B (i, m) from the blockchain L (i, m), so that the second block header B (i, m) determines the The latest fifth block header Z '(r, s) of the blockchain L (r, s) and the fourth block header Z (r, s) are the same in the blockchain L (r, s) On a fork, and if the fifth block header Z '(r, s) is newer than the fourth block header Z (r, s), then the latest of the blockchain L (r, s) The fourth block header Z (r, s) is updated to the fifth block header Z '(r, s);
    将m加一,重复执行步骤a,直至m达到G-1;其中,所述m的初始值为0;Add one to m and repeat step a until m reaches G-1; where the initial value of m is 0;
    相应的,对于不同的k,所述第一节点从G个区块链L(k,l_k)中选一个最新的第三区块头B(k,l_k),包括:Correspondingly, for different k, the first node selects the latest third block header B (k, l_k) from the G blockchains L (k, l_k), including:
    步骤b、所述第一节点从区块链L(k,l_k)中选一个最新的第三区块头B(k,l_k),使得所述第三区块头B(k,l_k)确定的所述区块链L(r,s)的最新的第六区块头Z″(r,s)和所述第四区块头Z(r,s)在所述区块链L(r,s)的相同分叉上,且若所述第六区块头Z″(r,s)比所述第四区块头Z(r,s)新,则将所述区块链L(r,s)的最新的第四区块头Z(r,s)更新为所述第六区块头Z″(r,s);Step b. The first node selects the latest third block header B (k, l_k) from the blockchain L (k, l_k), so that the third block header B (k, l_k) determines the The latest sixth block header Z ″ (r, s) of the blockchain L (r, s) and the fourth block header Z (r, s) are the same in the blockchain L (r, s) On a fork, and if the sixth block header Z ″ (r, s) is newer than the fourth block header Z (r, s), then the latest of the blockchain L (r, s) The fourth block header Z (r, s) is updated to the sixth block header Z ″ (r, s);
    将k加一,重复执行步骤b,直至k达到G-1;其中,所述k的初始值为0,且k不等于i。Add one to k and repeat step b until k reaches G-1; where the initial value of k is 0 and k is not equal to i.
  6. 根据权利要求2-5任一项所述的方法,其特征在于,所述第一节点根据所述第一交易信息生成第一区块之前,还包括:The method according to any one of claims 2-5, wherein before the first node generates the first block according to the first transaction information, the method further includes:
    所述第一节点根据第三账户组到第一账户组对应的区块链确定所述第一交易信息对应的交易输入,是否来自于所述第三账户组到所述第一账户组的账户之间的交易对应的交易输出;The first node determines whether the transaction input corresponding to the first transaction information is from the account of the third account group to the first account group according to the blockchain corresponding to the first account group from the third account group The transaction output corresponding to the transaction between;
    若是,则所述第一节点根据所述第一账户组到第四账户组对应的区块链验证所述交易输出,是否未被所述第一账户组到所述第四账户组的账户之间的交易使用;所述第三账户组和所述第四账户组分别为所述区块链网络中任一账户组;If yes, the first node verifies the transaction output according to the blockchain corresponding to the first account group to the fourth account group. Use of transactions between; the third account group and the fourth account group are respectively any account group in the blockchain network;
    若是,则确定所述第一交易信息有效。If yes, it is determined that the first transaction information is valid.
  7. 根据权利要求6所述的方法,其特征在于,所述第一节点根据所述第一交易信息和所述第一区块依赖的区块头的哈希值,生成第一区块,包括:The method according to claim 6, wherein the first node generates the first block based on the first transaction information and the hash value of the block header that the first block depends on, including:
    所述第一节点按照第二预设条件利用工作证明算法,确定随机数;The first node determines the random number by using the proof-of-work algorithm according to the second preset condition;
    所述第一节点将所述第一区块依赖的区块头的哈希值和所述随机数,按照预设的区块头的数据结构生成所述第一区块的区块头;The first node generates the block header of the first block according to the preset block header data structure according to the hash value of the block header that the first block depends on and the random number;
    所述第一节点将有效的所述第一交易信息按照预设的区块主体的数据结构,生成所述第一区块的区块主体;The first node generates the block body of the first block according to the preset data structure of the block body of the valid first transaction information;
    所述第一节点将所述区块头和所述区块主体组合形成所述第一区块。The first node combines the block header and the block body to form the first block.
  8. 根据权利要求1-5任一项所述的方法,其特征在于,还包括:The method according to any one of claims 1-5, further comprising:
    所述第一节点接收第五账户组对应的节点发送的第二区块链上的区块主体,所述区块主体包括:所述第一账户组关联的第二交易信息;所述第二区块链为第五账户组到所述第一账户组对应的区块链;所述第二交易信息是由所述第五账户组到所述第一账户组的账户之间的交易形成的;The first node receives a block body on the second blockchain sent by a node corresponding to the fifth account group, the block body includes: second transaction information associated with the first account group; the second The blockchain is the blockchain corresponding to the first account group from the fifth account group; the second transaction information is formed by the transaction between the accounts of the fifth account group and the first account group ;
    所述第一节点验证所述区块主体的数据格式是否正确;The first node verifies whether the data format of the block body is correct;
    若正确,则将所述区块主体加入所述第一节点存储的第二区块链中。If it is correct, the block body is added to the second block chain stored by the first node.
  9. 根据权利要求1-5任一项所述的方法,其特征在于,还包括:The method according to any one of claims 1-5, further comprising:
    所述第一节点接收第一账户组对应的节点发送的第三区块链上的区块主体,所述区块主体包括:所述第一账户组关联的第三交易信息;所述第三区 块链为第一账户组到第六账户组对应的区块链;所述第三交易信息是由所述第一账户组到所述第六账户组的账户之间的交易形成的;The first node receives a block body on a third blockchain sent by a node corresponding to the first account group, the block body includes: third transaction information associated with the first account group; the third The blockchain is the blockchain corresponding to the first account group to the sixth account group; the third transaction information is formed by transactions between the accounts of the first account group to the sixth account group;
    所述第一节点验证所述第三交易信息是否有效;The first node verifies whether the third transaction information is valid;
    若所述第三交易信息有效,则将所述区块主体加入所述第一节点存储的第三区块链中。If the third transaction information is valid, the block body is added to the third block chain stored by the first node.
  10. 根据权利要求9所述的方法,其特征在于,所述第一节点验证所述第三交易信息是否有效,包括:The method according to claim 9, wherein the first node verifies whether the third transaction information is valid, including:
    所述第一节点根据第七账户组到所述第一账户组对应的区块链确定所述第三交易信息对应的交易输入,是否来自于所述第七账户组到所述第一账户组的账户之间的交易对应的交易输出;The first node determines whether the transaction input corresponding to the third transaction information is from the seventh account group to the first account group according to the blockchain corresponding to the first account group from the seventh account group The transaction output corresponding to the transaction between the accounts;
    若是,则所述第一节点根据所述第一账户组到第八账户组对应的区块链验证所述交易输出,是否未被所述第一账户组到所述第八账户组的账户之间的交易使用;所述第七账户组和所述第八账户组分别为所述区块链网络中任一账户组;If yes, the first node verifies whether the transaction output is not based on the accounts from the first account group to the eighth account group according to the blockchain corresponding to the first account group to the eighth account group Use of transactions between; the seventh account group and the eighth account group are respectively any account group in the blockchain network;
    若是,则确定所述第三交易信息有效。If yes, it is determined that the third transaction information is valid.
  11. 根据权利要求1-5任一项所述的方法,其特征在于,还包括:The method according to any one of claims 1-5, further comprising:
    所述第一节点接收第二节点发送的第四区块链中的区块头,所述区块头包括:所述区块头依赖的最新区块头的哈希值;所述第四区块链为区块链网络中任一区块链;The first node receives the block header in the fourth blockchain sent by the second node, the block header includes: a hash value of the latest block header that the block header depends on; the fourth blockchain is a zone Any blockchain in the blockchain network;
    所述第一节点验证所述第四区块链中的区块头的区块依赖是否合理;The first node verifies whether the block dependency of the block header in the fourth block chain is reasonable;
    若所述第四区块链中的区块头的区块依赖是否合理,则将所述区块头加入所述第一节点存储的第四区块链中。If the block dependency of the block header in the fourth block chain is reasonable, the block header is added to the fourth block chain stored by the first node.
  12. 根据权利要求11所述的方法,其特征在于,假设所述第四区块链为L(i1,j1),接收到的第四区块链为L(i1,j1)的区块头为B(i1,j1);所述i1、j1分别为大于或等于0,且小于或等于G-1的整数,所述i1和所述j1表示所述区块链网络中任一账户组,所述第一节点验证所述第四区块链中的区块头的区块依赖是否合理,包括:The method according to claim 11, characterized in that, assuming that the fourth blockchain is L (i1, j1), the received fourth blockchain is L (i1, j1) and the block header is B ( i1, j1); i1, j1 are integers greater than or equal to 0 and less than or equal to G-1, respectively, i1 and j1 represent any account group in the blockchain network, the A node verifies whether the block dependency of the block header in the fourth blockchain is reasonable, including:
    步骤c、所述第一节点根据所述区块头B(i1,j1),确定任一条区块链L(r1,s1)的最新的第七区块头Z(r1,s1);其中,所述r1、s1分别为大于或等于0,且小于或等于G-1的整数;Step c. The first node determines the latest seventh block header Z (r1, s1) of any block chain L (r1, s1) according to the block header B (i1, j1); wherein, the r1 and s1 are integers greater than or equal to 0 and less than or equal to G-1;
    步骤d、所述第一节点根据所述区块头B(i1,j1)中包括的第i2个区块头B i2的哈希值对应的区块头B i2,确定所述区块链L(r1,s1)的最新的第八区块头Z'(r1,s1); Step d: The first node determines the blockchain L (r1, according to the block header B i2 corresponding to the hash value of the i2th block header B i2 included in the block header B (i1, j1) s1) the latest eighth block header Z '(r1, s1);
    步骤e、所述第一节点确定所述第七区块头Z(r1,s1)和所述第八区块头Z'(r1,s1)是否在所述区块链L(r,s)的相同分叉上;Step e. The first node determines whether the seventh block header Z (r1, s1) and the eighth block header Z '(r1, s1) are the same in the blockchain L (r, s) Bifurcation
    若是,则在所述第八区块头Z'(r1,s1)比所述第七区块头Z(r1,s1)新时,将所述第七区块头Z(r1,s1)更新为所述第八区块头Z'(r1,s1);If yes, when the eighth block header Z '(r1, s1) is newer than the seventh block header Z (r1, s1), update the seventh block header Z (r1, s1) to the The eighth block header Z '(r1, s1);
    将i2加一,重复执行步骤d-e,直至i2达到2G或所述第七区块头Z(r1,s1)和所述第八区块头Z'(r1,s1)不在所述区块链L(r,s)的相同分叉上停止执行;其中,所述i2的初始值为1;Increase i2 by one and repeat step de until i2 reaches 2G or the seventh block header Z (r1, s1) and the eighth block header Z '(r1, s1) are not in the blockchain L (r , s) stops execution on the same fork; where, the initial value of i2 is 1;
    若所有的区块头B i2确定的第八区块头Z'(r1,s1)均与所述第七区块头Z(r1,s1)在所述区块链L(r,s)的相同分叉上,则确定所述第四区块链中的区块头的区块依赖合理。 If the eighth block header Z '(r1, s1) determined by all block headers B i2 is the same as the seventh block header Z (r1, s1) in the same blockchain L (r, s) On the above, it is determined that the block dependency of the block header in the fourth block chain is reasonable.
  13. 根据权利要求1-5任一项所述的方法,其特征在于,所述将所述第一区块加入第一区块链之后,还包括:The method according to any one of claims 1-5, wherein after adding the first block to the first blockchain, the method further comprises:
    所述第一节点将所述第一区块的区块头广播至所述区块链网络中的所有节点,并将所述第一区块的区块主体广播至与所述第一账户组或者第二账户组对应的节点,以使所述区块链网络中的其他节点对接收到的所述第一区块的区块头和/或区块主体进行验证。The first node broadcasts the block header of the first block to all nodes in the blockchain network, and broadcasts the block body of the first block to the first account group or The node corresponding to the second account group, so that other nodes in the blockchain network can verify the received block header and / or block body of the first block.
  14. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1-13任一项所述的方法。A computer-readable storage medium on which a computer program is stored, characterized in that, when the computer program is executed by a processor, the method according to any one of claims 1-13 is implemented.
  15. 一种电子设备,其特征在于,包括:An electronic device, characterized in that it includes:
    处理器;以及Processor; and
    存储器,用于存储所述处理器的可执行指令;A memory for storing executable instructions of the processor;
    其中,所述处理器配置为经由执行所述可执行指令来执行权利要求1-13任一项所述的方法。Wherein, the processor is configured to execute the method of any one of claims 1-13 via executing the executable instructions.
PCT/CN2018/109701 2018-10-10 2018-10-10 Blockchain-based transaction data processing method and device, and storage medium WO2020073246A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2018/109701 WO2020073246A1 (en) 2018-10-10 2018-10-10 Blockchain-based transaction data processing method and device, and storage medium
CN201880017223.5A CN110692078B (en) 2018-10-10 2018-10-10 Transaction data processing method, device and storage medium based on blockchain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2018/109701 WO2020073246A1 (en) 2018-10-10 2018-10-10 Blockchain-based transaction data processing method and device, and storage medium

Publications (1)

Publication Number Publication Date
WO2020073246A1 true WO2020073246A1 (en) 2020-04-16

Family

ID=69107162

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/109701 WO2020073246A1 (en) 2018-10-10 2018-10-10 Blockchain-based transaction data processing method and device, and storage medium

Country Status (2)

Country Link
CN (1) CN110692078B (en)
WO (1) WO2020073246A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11228439B2 (en) * 2019-01-02 2022-01-18 Jiaping Wang Scale out blockchain with asynchronized consensus zones

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112580112B (en) * 2021-02-26 2021-06-22 北京全息智信科技有限公司 Intelligent contract implementation method and device based on full-chain consensus and local deployment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106506638A (en) * 2016-11-04 2017-03-15 江苏通付盾科技有限公司 Block storage method and device in block chain
CN107147735A (en) * 2017-05-12 2017-09-08 北京博晨技术有限公司 A kind of distributed account book system based on hierarchy
CN107239940A (en) * 2017-05-11 2017-10-10 北京博晨技术有限公司 Network trading method and device based on block catenary system
WO2018119930A1 (en) * 2016-12-29 2018-07-05 深圳前海达闼云端智能科技有限公司 Transaction verification processing method, apparatus and node device
CN108282474A (en) * 2018-01-18 2018-07-13 山东大学 The maintaining method of digital asset trade identity based on block chain
CN108512649A (en) * 2018-02-09 2018-09-07 北京欧链科技有限公司 The processing method and processing device of the reversed Hash link of block chain

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106055597B (en) * 2016-05-24 2022-05-20 布比(北京)网络技术有限公司 Digital transaction system and account information query method used for same
CN106372940B (en) * 2016-08-31 2019-10-11 江苏通付盾科技有限公司 Identity identifying method, server and terminal device based on block chain network
CN106796685A (en) * 2016-12-30 2017-05-31 深圳前海达闼云端智能科技有限公司 Block chain authority control method and device and node equipment
CN108492108B (en) * 2018-03-29 2021-04-23 深圳前海微众银行股份有限公司 Block chain cross-chain communication method, system and computer readable storage medium
CN108492183B (en) * 2018-03-29 2021-05-18 深圳前海微众银行股份有限公司 Block chain account transaction method, system and computer readable storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106506638A (en) * 2016-11-04 2017-03-15 江苏通付盾科技有限公司 Block storage method and device in block chain
WO2018119930A1 (en) * 2016-12-29 2018-07-05 深圳前海达闼云端智能科技有限公司 Transaction verification processing method, apparatus and node device
CN107239940A (en) * 2017-05-11 2017-10-10 北京博晨技术有限公司 Network trading method and device based on block catenary system
CN107147735A (en) * 2017-05-12 2017-09-08 北京博晨技术有限公司 A kind of distributed account book system based on hierarchy
CN108282474A (en) * 2018-01-18 2018-07-13 山东大学 The maintaining method of digital asset trade identity based on block chain
CN108512649A (en) * 2018-02-09 2018-09-07 北京欧链科技有限公司 The processing method and processing device of the reversed Hash link of block chain

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11228439B2 (en) * 2019-01-02 2022-01-18 Jiaping Wang Scale out blockchain with asynchronized consensus zones

Also Published As

Publication number Publication date
CN110692078A (en) 2020-01-14
CN110692078B (en) 2023-07-25

Similar Documents

Publication Publication Date Title
WO2021032138A1 (en) Consensus method and device based on blockchain system, and system
US20210295321A1 (en) Methods for decentralized digital asset transfer and smart contract state transition
CN113329031B (en) Method and device for generating state tree of block
CN110869967B (en) System and method for parallel processing of blockchain transactions
CN107807951B (en) Block chain generation method, data verification method, node and system
CN110245956B (en) Asynchronous multi-chain based block chain transaction confirmation method and system
WO2019207504A1 (en) Maintaining blocks of a blockchain in a partitioned blockchain network
JP2020504927A (en) Method and apparatus for a distributed database enabling deletion of events
Matzutt et al. How to securely prune bitcoin’s blockchain
CN110263035A (en) Data storage, querying method and device and electronic equipment based on block chain
CN111630830A (en) Distributed blockchain data storage under account model
CN111630507A (en) Distributed blockchain data storage under account model
US20200084041A1 (en) Automated Blockchain Protocol Update
CN112348518B (en) Block chain transaction certification method and device
CN111095210A (en) Storing shared blockchain data based on error correction coding
WO2020199713A1 (en) Data verification method, system, apparatus, and device
EP3954085A1 (en) Methods and devices for propagating blocks in a blockchain network
US20220172180A1 (en) Method for Storing Transaction that Represents Asset Transfer to Distributed Network and Program for Same
WO2020073246A1 (en) Blockchain-based transaction data processing method and device, and storage medium
CN111164934A (en) Pruning of authentication trees
CN113411189B (en) Data processing method and device, tracing method and device, and electronic device
CN111226206A (en) Taking snapshots of blockchain data
JP2023522119A (en) Block Propagation with Poisoned Transactions in Blockchain Networks
CN113157450A (en) Method and apparatus for performing blocks in a blockchain system
JP2017139733A (en) Generation and authentication of packet in process chain

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18936374

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18936374

Country of ref document: EP

Kind code of ref document: A1