WO2020010972A1 - 应用于区块链系统中矿工节点的共识方法和区块链系统 - Google Patents

应用于区块链系统中矿工节点的共识方法和区块链系统 Download PDF

Info

Publication number
WO2020010972A1
WO2020010972A1 PCT/CN2019/090356 CN2019090356W WO2020010972A1 WO 2020010972 A1 WO2020010972 A1 WO 2020010972A1 CN 2019090356 W CN2019090356 W CN 2019090356W WO 2020010972 A1 WO2020010972 A1 WO 2020010972A1
Authority
WO
WIPO (PCT)
Prior art keywords
miner node
node
block
lower limit
miner
Prior art date
Application number
PCT/CN2019/090356
Other languages
English (en)
French (fr)
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 深圳市红砖坊技术有限公司
Publication of WO2020010972A1 publication Critical patent/WO2020010972A1/zh
Priority to US17/144,353 priority Critical patent/US20210176058A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3236Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions
    • H04L9/3239Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions involving non-keyed hash functions, e.g. modification detection codes [MDCs], MD5, SHA or RIPEMD
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/30Public key, i.e. encryption algorithm being computationally infeasible to invert or user's encryption keys not requiring secrecy
    • 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/04Payment circuits
    • G06Q20/06Private payment circuits, e.g. involving electronic currency used among participants of a common payment scheme
    • G06Q20/065Private payment circuits, e.g. involving electronic currency used among participants of a common payment scheme using e-cash
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9024Graphs; Linked lists
    • 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/30Payment architectures, schemes or protocols characterised by the use of specific devices or networks
    • G06Q20/36Payment architectures, schemes or protocols characterised by the use of specific devices or networks using electronic wallets or electronic money safes
    • G06Q20/367Payment architectures, schemes or protocols characterised by the use of specific devices or networks using electronic wallets or electronic money safes involving electronic purses or money safes
    • G06Q20/3678Payment architectures, schemes or protocols characterised by the use of specific devices or networks using electronic wallets or electronic money safes involving electronic purses or money safes e-cash details, e.g. blinded, divisible or detecting double spending
    • 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/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3823Payment protocols; Details thereof insuring higher security of transaction combining multiple encryption tools for a transaction
    • 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/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3825Use of electronic signatures
    • 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/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3827Use of message hashing
    • 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/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3829Payment protocols; Details thereof insuring higher security of transaction involving key management
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0894Escrow, recovery or storing of secret information, e.g. secret key escrow or cryptographic key storage
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/321Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving a third party or a trusted authority
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3236Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3247Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving digital signatures
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3297Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving time stamps, e.g. generation of time stamps
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/50Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees
    • 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 embodiments of the present application relate to the field of computer technology, and in particular, to a consensus method and a blockchain system applied to miner nodes in a blockchain system.
  • the public chain of the blockchain mainly adopts PoW (Proof of Work, Proof of Work) as a consensus algorithm to determine which miner node obtains the right to account.
  • PoW Proof of Work, Proof of Work
  • the advantage of PoW as a consensus algorithm is that it has a wide range of applications and high security.
  • the biggest disadvantage is that the meaningless hash collision calculation (commonly known as mining) causes a lot of waste of power.
  • POET Proof of Elapsed Time, Proof of Elapsed Time
  • the current POET consensus algorithm depends on a specific model of CPU, and the alliance chain builds blocks between specific institutions Chain system, therefore, it is acceptable to specify the use of a specific type of CPU, but the public chain system is not suitable for limiting the use of a specific type of CPU. Therefore, the current POET is not suitable for application in the public chain.
  • the embodiments of the present application propose a consensus method and device applied to a miner node in a blockchain system.
  • an embodiment of the present application provides a consensus method applied to a miner node in a blockchain system.
  • the method includes: obtaining a cumulative unused lower limit duration; and executing the following in a trusted execution environment associated with the miner node: Bookkeeping right determination operation: determining the current cumulative unused duration of the miner node; determining whether the current cumulative unused duration is greater than the cumulative unused lower limit duration; and in response to determining that the current cumulative unused duration is greater than the cumulative
  • the unused lower limit duration is determined that the miner node competes for a bookkeeping right, and the difference between the current cumulative unused duration and the cumulative unused lower limit duration is used to update the current cumulative unused duration.
  • the trusted execution environment associated with the miner node includes: the trusted execution environment associated with the miner node is set in the miner node; or the trusted execution environment associated with the miner node is set at Among other electronic devices connected to the miner node network, the miner node interacts with a trusted execution environment associated with the miner node through a message communication mechanism.
  • the bookkeeping right determining operation further comprises: in response to determining that the miner node competes for the bookkeeping right, determining whether to adjust the cumulative unaccounted for according to the block in which the miner node competes for the bookkeeping right.
  • Use the lower limit duration in response to determining to adjust the cumulative unused lower limit duration, perform the following cumulative unused lower limit duration adjustment operation: determine the cumulative unadjusted cumulative unadjustment based on the cumulative unused lower limit duration, the actual duration of the adjustment cycle, and the desired adjustment cycle duration
  • the lower limit time is used, and the actual adjustment time is the generation time of the block in which the miner node competes for accounting rights and the area corresponding to the last unadjusted cumulative unused lower limit time in the block chain of the miner node. The time between the generation times of the blocks; and updating the accumulated unused lower limit duration to the adjusted accumulated unused lower limit duration.
  • the adjusted unused lower limit duration is positively correlated with the cumulative unused lower limit duration and the desired adjustment period duration, and the adjusted unused lower limit duration is equal to the adjustment period. Duration is negatively correlated.
  • the method before performing the following bookkeeping right determination operation in a trusted execution environment associated with the miner node, the method further includes: obtaining a hash value of a previous block of the block to be booked; and After it is determined that the miner node competes with the accounting right, the operation of determining the accounting right further includes: using the trusted execution information of the accounting right determination information in a trusted execution environment associated with the miner node The preset private key signature stored in the environment is used to obtain the signature of the accounting right determination information, where the accounting right determination information includes: the hash value of the previous block of the block to be accounted for, and the accumulated unused lower limit Duration and the account address bound to the miner node, the account address bound to the miner node is stored in a trusted execution environment associated with the miner node; determining the accounting right determination information and the accounting right determination Information signatures are broadcast to neighboring nodes of the miner node.
  • the accounting right determination information further includes a real-name authentication identifier stored in a trusted execution environment associated with the miner node, and the real-name authentication identifier is used to characterize the trusted execution associated with the miner node Whether the environment has passed the real-name certification of a third-party agency.
  • the trusted execution environment associated with the miner node interacts with the outside world in a cipher text manner; and performing the following bookkeeping right determination operation in the trusted execution environment associated with the miner node includes: The preset administrator public key encrypts the instruction corresponding to the accounting right determination operation to obtain the encrypted instruction; in the trusted execution environment associated with the miner node, it is stored in the trusted execution environment associated with the miner node The preset administrator private key decrypts the obtained encrypted instruction, obtains the decrypted instruction, and executes the decrypted instruction to perform the accounting right determination operation; The execution result is encrypted with a preset key stored in a trusted execution environment associated with the miner node, and the trusted execution environment associated with the miner node is output.
  • the method further comprises: in response to receiving a signature of the accounting right determination information and the accounting right determination information, using a preset public key to perform signature verification on the received accounting right determination information;
  • the signature verification of the received accounting right determination information is passed, and the hash value of the tail block in the blockchain of the miner node and the accumulated unused lower limit time are used for the received accounting right.
  • the hash value of the previous block in the determination information and the accumulated unused lower limit time are verified; in response to the verification, the account address in the received accounting right determination information is determined to compete with the first current block
  • the bookkeeping right determination operation further includes: in response to determining that the current cumulative unused time of the miner node is greater than the cumulative unused upper limit Duration, updating the current cumulative unused duration to the cumulative unused upper limit duration.
  • an embodiment of the present application provides a consensus device applied to a miner node in a blockchain system.
  • the device includes: a first obtaining unit configured to obtain a cumulative unused lower limit duration; a bookkeeping right determination unit, Is configured to perform the following accounting right determination operations in the trusted execution environment associated with the miner node: determine the current cumulative unused duration of the miner node; determine whether the current cumulative unused duration is greater than the cumulative unused lower limit duration; and respond to determining the current cumulative The unused time is greater than the accumulated unused lower limit time, it is determined that the miner node competes for the bookkeeping right, and the difference between the current accumulated unused time and the accumulated unused lower limit time is used to update the current accumulated unused time.
  • the trusted execution environment associated with the miner node includes: the trusted execution environment associated with the miner node is set in the miner node; or the trusted execution environment associated with the miner node is set at Among other electronic devices connected to the miner node network, the miner node interacts with a trusted execution environment associated with the miner node through a message communication mechanism.
  • the bookkeeping right determining operation further comprises: in response to determining that the miner node competes for the bookkeeping right, determining whether to adjust the cumulative unaccounted for according to the block in which the miner node competes for the bookkeeping right.
  • Use the lower limit duration in response to determining to adjust the cumulative unused lower limit duration, perform the following cumulative unused lower limit duration adjustment operation: determine the cumulative unadjusted cumulative unadjustment based on the cumulative unused lower limit duration, the actual duration of the adjustment cycle, and the desired adjustment cycle duration
  • the lower limit time is used, and the actual adjustment time is the generation time of the block in which the miner node competes for accounting rights and the area corresponding to the last unadjusted cumulative unused lower limit time in the block chain of the miner node. The time between the generation times of the blocks; and updating the accumulated unused lower limit duration to the adjusted accumulated unused lower limit duration.
  • the adjusted unused lower limit duration is positively correlated with the cumulative unused lower limit duration and the desired adjustment period duration, and the adjusted unused lower limit duration is equal to the adjustment period. Duration is negatively correlated.
  • the device before performing the following accounting right determination operation in a trusted execution environment associated with the miner node, the device further includes a second acquisition unit configured to acquire a previous area of the block to be accounted for The hash value of the block; and after the determining that the miner node competes with the accounting right, the operation of determining the accounting right further includes: determining the accounting right in a trusted execution environment associated with the miner node The information uses a preset private key signature stored in the trusted execution environment to obtain a signature of the right to determine accounting information, where the information about the right to determine accounting includes a hash value of a previous block of the block to be accounted for The account address bound to the miner node by the accumulated unused lower limit time, and the account address bound by the miner node is stored in a trusted execution environment associated with the miner node; the accounting right determination information is stored And the bookkeeping right determination information is signed and broadcast to neighboring nodes of the miner node.
  • the accounting right determination information further includes a real-name authentication identifier stored in a trusted execution environment associated with the miner node, and the real-name authentication identifier is used to characterize the trusted execution associated with the miner node Whether the environment has passed the real-name certification of a third-party agency.
  • the trusted execution environment associated with the miner node uses cipher text to interact with the outside world; and the accounting right determination unit is further configured to: use a preset administrator public key to pair the accounting right
  • the instructions corresponding to the determined operation are encrypted to obtain encrypted instructions.
  • the obtained encryption is performed by using a preset administrator private key stored in the trusted execution environment associated with the miner node.
  • the instruction is decrypted to obtain the decrypted instruction, and the decrypted instruction is executed to perform the accounting right determination operation; the execution result of the execution of the accounting right determination operation is performed using a trusted execution associated with the miner node After the preset key stored in the environment is encrypted, the trusted execution environment associated with the miner node is output.
  • the apparatus further includes: a signature verification unit configured to determine the received accounting right using a preset public key in response to receiving a signature of the accounting right determination information and the accounting right determination information The information is subjected to signature verification; the verification unit is configured to respond to the signature verification of the received accounting right determination information, and respectively utilize the hash value and the address of the tail block in the block chain of the miner node.
  • a signature verification unit configured to determine the received accounting right using a preset public key in response to receiving a signature of the accounting right determination information and the accounting right determination information The information is subjected to signature verification; the verification unit is configured to respond to the signature verification of the received accounting right determination information, and respectively utilize the hash value and the address of the tail block in the block chain of the miner node.
  • the cumulative unused lower limit time is used to verify the hash value of the previous block and the cumulative unused lower limit time in the received accounting right determination information; the determination unit is configured to respond to the verification and pass the received
  • the account address in the obtained accounting right determination information is determined to be the account address bound by the miner node competing for the first current block, where the first current block is the received accounting right determination information.
  • the bookkeeping right determination operation further includes: in response to determining that the current cumulative unused time of the miner node is greater than the cumulative unused upper limit Duration, updating the current cumulative unused duration to the cumulative unused upper limit duration.
  • an embodiment of the present application provides a miner node, including: one or more processors; a storage device storing one or more programs thereon, when the one or more programs are replaced by the one or more programs When the processor executes, the one or more processors are caused to implement the method as described in any implementation manner of the first aspect.
  • an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored, wherein the computer program is implemented by one or more processors as described in any implementation manner of the first aspect Methods.
  • an embodiment of the present application provides a blockchain system.
  • the blockchain system includes at least one parallel chain.
  • the parallel chain includes a routing node and at least one miner node.
  • the network connection between the nodes, the miner node is bound with the account address, and the miner node is configured to compete for the right to account for the intra-chain transaction request of the parallel chain where the miner node is located, as described in the implementation method of the first aspect, and the routing node It is configured to synchronize the block chain of the same miner node of the routing node to the local block chain in real time.
  • the routing node is further configured to: in response to receiving the accounting right determination information and the accounting right determination information signature including the previous block hash value, the cumulative unused lower limit duration, the account address, and the A public key is used to perform signature verification on the received accounting right determination information; in response to the signature verification of the received accounting right determination information being passed, the tail block of the routing node's blockchain is used respectively.
  • the Greek value and the accumulated unused lower limit duration stored locally by the routing node check the hash value of the previous block and the accumulated unused lower limit duration in the received accounting right determination information; in response to the received The hash value of the previous block in the accounting right determination information and the cumulative unused lower limit time are verified and passed, and the account address in the received accounting right determination information is determined as the miner competing to the second current block.
  • the account address bound by the node, wherein the second current block is the next block of the block indicated by the previous block hash value in the received accounting right determination information.
  • the routing node is further configured to: in response to failing to verify the hash value of the previous block and the accumulated unused lower limit time in the received accounting right determination information, the received The account address in the accounting right determination information is added to the locally stored blacklist account address set.
  • the miner node is further configured to determine whether to enter a new cumulative unused lower limit time adjustment period according to the block in which the miner node competes for accounting rights; in response to determining to enter a new cumulative unused lower limit time period Adjust the cycle and perform the following current accounting confirmation of each block: obtain the digital currency balance corresponding to the account address of the miner node that is bound by the node; divide the obtained digital currency balance by the number of blocks in the preset period The integer part of the obtained ratio is determined as the current accounting reward per block; the product of the current accounting reward per block and the number of blocks in the preset period is determined as the expected distribution reward; according to the selected waiting reward Processing the transaction request, when the reward transfer-out information is expected to be distributed, the current block reward transfer-in information, and the current block reward transfer-out information are used to generate block data of the block in which the miner node competes for accounting rights, wherein the current Expected distribution reward transfer out information is used to characterize the transfer of the expected distribution reward from the account address bound
  • performing the following bookkeeping right determination operation in a trusted execution environment associated with the miner node includes: responding to a random number used for hash collision calculation using a proof-of-work consensus mechanism to satisfy a preset Conditionally, the bookkeeping right determination operation is performed in a trusted execution environment associated with the miner node.
  • the miner node is further configured to perform the following hash collision difficulty target value adjustment operation: in response to determining that the miner node competes for the right to account, according to the block where the miner node competes for the right to account To determine whether to adjust the difficulty target value of the hash collision; in response to determining to adjust the difficulty target value of the hash collision, determine adjustment based on the difficulty target value of the current hash collision, the actual adjustment period, and the expected adjustment period duration The post-difficulty target value, and updating the difficulty target value of the current hash collision to the adjusted difficulty target value.
  • the routing node is further configured to: determine a time interval between the same same-chain miner node of the routing node competing for the accounting right twice; and in response to the accumulated unused lower limit time minus the determined The time difference between the time intervals is greater than a preset time threshold, and the account address bound by the miner node corresponding to the determined time interval is added to the blacklist account address set.
  • the consensus method applied to the miner node in the blockchain system provided in the embodiments of the present application is determined by determining the current cumulative unused time of the miner node is greater than the cumulative unused lower limit time in the trusted execution environment associated with the miner node.
  • Miner nodes compete for bookkeeping rights, and update the current cumulative unused time with the difference between the current cumulative unused time and the cumulative unused lower limit time, which reduces the power consumption of the public chain in the blockchain.
  • FIG. 1 is an exemplary system architecture diagram to which an embodiment of the present application can be applied;
  • FIG. 1 is an exemplary system architecture diagram to which an embodiment of the present application can be applied;
  • 2A is a flowchart of an embodiment of a consensus method applied to a miner node in a blockchain system according to the present application;
  • FIG. 2B is an exploded flowchart of step 202 in the flowchart shown in FIG. 2A;
  • FIG. 3 is a flowchart of another embodiment of a consensus method applied to a miner node in a blockchain system according to the present application;
  • FIG. 4 is an exemplary system architecture diagram of an embodiment of a blockchain system according to the present application.
  • 5A and 5B are timing diagrams of one embodiment of a blockchain system according to the present application.
  • 5C is an exploded flowchart of step 508 in the timing chart shown in FIG. 5B;
  • FIG. 6 is a schematic structural diagram of an embodiment of a consensus device applied to a miner node in a blockchain system according to the present application;
  • FIG. 7 is a schematic structural diagram of a computer system suitable for implementing a miner node according to an embodiment of the present application.
  • FIG. 1 illustrates an exemplary system architecture 100 of an embodiment of a consensus method applied to a miner node in a blockchain system or a consensus device applied to a miner node in a blockchain system.
  • the system architecture 100 may include miner nodes 101, 102, 103 and a network 104.
  • the network 104 is used to provide a medium for a communication link between the terminal devices 101, 102, and 103.
  • the network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
  • miner nodes 101, 102, 103 Users can use the miner nodes 101, 102, 103 to interact with other miner nodes through the network 104 to receive or send messages and the like.
  • Various communication client applications can be installed on the miner nodes 101, 102, 103, such as blockchain accounting applications, digital currency wallet applications, web browser applications, shopping applications, search applications, instant messaging tools, Email clients, social platform software, etc.
  • the miner nodes 101, 102, 103 may be hardware or software.
  • the terminal devices 101, 102, and 103 can be various electronic devices associated with a Trusted Execution Environment (TEE, Trusted Execution Environment), including but not limited to smartphones, tablets, laptops, and desktops Computer and so on.
  • TEE Trusted Execution Environment
  • the miner nodes 101, 102, and 103 are software, they can be installed in the electronic devices listed above. It can be implemented as multiple software or software modules (for example, to provide blockchain accounting services or to provide digital currency wallet services), or it can be implemented as a single software or software module. It is not specifically limited here.
  • TEE is an operating environment coexisting with Rich OS (usually Android, etc.) on the device, and provides security services for Rich OS.
  • Rich OS usually Android, etc.
  • TEE has its own execution space.
  • the software and hardware resources that TEE can access are separated from Rich OS.
  • TEE provides a secure execution environment for Trusted Applications (TA), while also protecting the confidentiality, integrity, and access rights of resources and data of trusted applications.
  • TA Trusted Applications
  • TEE is verified and isolated from RichOS during the secure boot process.
  • each trusted application is independent of each other and cannot be mutually accessed without authorization.
  • the TEE associated with the miner node can be implemented in the following two ways:
  • trusted hardware support can also be added at the bottom of the trusted execution environment, such as using a security chip that complies with the Trusted Platform Module (TPM) standard, or using Trusted Cryptography that conforms to the Trusted Cryptographic Module (TCM) Module) standard security chip.
  • TPM Trusted Platform Module
  • TCM Trusted Cryptography
  • a cryptographic lock (commonly known as a software dog) is used to implement a trusted execution environment.
  • Common software dogs are often packaged into a compact USB (Universal Serial Bus) device.
  • the software dog provides file storage and supports running customized programs.
  • the device type of the miner node need not be limited, as long as the miner node has a USB interface, which reduces the equipment requirements for the miner node.
  • Each miner node in the system architecture 100 forms a blockchain system, and each miner node in the system architecture 100 uses a distributed data blockchain to store data.
  • the consensus method applied to the miner nodes in the blockchain system is generally executed by the miner nodes 101, 102, 103, and accordingly, the consensus device applied to the miner nodes in the blockchain system Generally set in miner nodes 101, 102, 103.
  • FIG. 1 the number of miner nodes and networks in FIG. 1 is merely exemplary. According to the implementation needs, there can be any number of miner nodes and networks.
  • FIG. 2A it illustrates a flow 200 of an embodiment of a consensus method applied to a miner node in a blockchain system according to the present application.
  • the consensus method applied to a miner node in a blockchain system includes the following steps:
  • Step 201 Obtain a cumulative unused lower limit duration.
  • the execution body of the consensus method may obtain a predetermined cumulative unused lower limit duration in the process of competing for the bookkeeping right.
  • the cumulative unused lower limit time period may be set in advance by a technician, or may be obtained after the above-mentioned execution body is dynamically calculated and updated according to the blocks competed by the miner node.
  • Step 202 Perform a bookkeeping right determination operation in a trusted execution environment associated with a miner node.
  • the trusted execution environment associated with the miner node may be set in the miner node.
  • the trusted execution environment associated with the miner node may also be set in other electronic devices connected to the network of the miner node, and the miner node may use the trusted execution associated with it through a message communication mechanism. Environment to interact.
  • the above-mentioned execution subject may perform a bookkeeping right determination operation in a trusted execution environment associated with a miner node.
  • the accounting right determination operation may include sub-steps 2021 to 2024 as shown in FIG. 2B:
  • Sub-step 2021 Determine the current accumulated unused time of the miner node.
  • the execution subject may be associated with a trusted execution environment.
  • a clock may be set in the trusted execution environment, and the clock set in the trusted execution environment is different from the clock set outside the trusted execution environment of the execution subject.
  • the clock set in the trusted execution environment can only be accessed by programs in the trusted execution environment, and cannot be accessed by programs outside the trusted execution environment.
  • the foregoing execution subject may use various implementation methods in the associated trusted execution environment to determine the current cumulative unused duration of the miner node based on the current time of the clock set in the trusted execution environment.
  • the trusted execution environment associated with the miner node may be set with an initial value of the currently accumulated unused time before leaving the factory. Then, in the process of the miner node competing for the right of bookkeeping, the elapsed / elapsed time from the start of competing for the right of bookkeeping to the current time of the clock set in the trusted execution environment will accumulate to the current accumulated unused time. For example, changes in the "current cumulative unused time" can be controlled by a process (or background thread) that runs continuously in a trusted execution environment.
  • the execution entity may also determine whether the current cumulative unused duration of the miner node is greater than the cumulative unused upper limit duration after executing substep 2021 and before executing substep 2022. If it is determined to be greater than, the current accumulated unused time is updated to the accumulated unused upper limit time.
  • the cumulative unused upper limit time may be manually set by a technician based on experience, and the cumulative unused upper limit time may also be a product of the cumulative unused lower limit time and a preset coefficient greater than 1. In this way, it can be ensured that the currently accumulated unused time is less than or equal to the above accumulated unused upper limit time, that is, the currently accumulated unused time is not excessively accumulated. Setting the upper limit of the current cumulative unused time can improve security, because no matter what the reason (for example, the software has a bug), the number of times that the same miner node continuously obtains the accounting right will be limited.
  • the manufacturer of the trusted execution environment may randomly set a different initial value of the currently accumulated unused time for each of the manufactured trusted execution environments. If the same initial value of the currently accumulated unused time is set for each trusted execution environment that leaves the factory, when the trusted execution environment is purchased in batches and starts to compete for accounting rights at the same time, it may lead to a large number of competitions in the same time period To the miner's node with accounting rights, which in turn leads to soft forks.
  • step 2022 it is determined whether the currently accumulated unused duration is greater than the accumulated unused lower limit duration.
  • the execution entity may determine whether the currently accumulated unused time is greater than the accumulated unused lower limit time in the associated trusted execution environment. If it is determined to be greater, go to sub-step 2023.
  • sub-step 2023 it is determined that the miner node competes for the right to account.
  • the above-mentioned execution subject may determine that the miner node competes to the accounting right in a case where it is determined in the trusted execution environment that the current accumulated unused time is greater than the accumulated unused lower limit time.
  • the above-mentioned execution entity may start the bookkeeping operation after determining that it competes with the bookkeeping right, and the bookkeeping operation may be performed outside the associated trusted execution environment. It should be noted that here, for the miner nodes in the public chain blockchain system, the accounting process after competing for the accounting right is a well-known technology that is widely studied and applied at present, and will not be repeated here.
  • Substep 2024 Update the current accumulated unused time with the difference between the current accumulated unused time and the accumulated unused lower limit time.
  • the execution entity after determining that the above-mentioned execution entity has competed to the right of bookkeeping, it can update the current accumulated unused time in the associated trusted execution environment with the difference between the current accumulated unused time and the accumulated unused lower limit time. That is, competition for the bookkeeping right will cause the current accumulated unused time to consume the accumulated unused lower limit time, and then ensure that each miner node in the blockchain system competes for the bookkeeping right.
  • the execution body may also obtain a hash value of a previous block of the block to be accounted before executing step 202.
  • the previous block of the miner node's to-be-accounted block refers to the last completed bookkeeping block that the miner node has saved to the local blockchain, that is, the most recently completed bookkeeping block.
  • the hash value of a block can be obtained by querying the local blockchain.
  • the above-mentioned execution body may also perform the following sub-steps 2025 and 2026 after executing the sub-step 2023:
  • the accounting right determination information is signed with a preset private key stored in the trusted execution environment to obtain the accounting right information signature.
  • the above-mentioned execution body may use the accounting right determination information in the trusted execution environment associated with the miner node to use the stored information in the trusted execution environment.
  • the private key signature is preset, and the accounting right information signature is obtained.
  • the accounting right determination information may include: a hash value of a previous block of a block to be accounted for, a cumulative unused lower limit duration, and an account address bound to a miner node, where the account address bound by the miner node is stored in Trusted execution environment associated with miner nodes.
  • the trusted execution environment associated with the miner node may store a preset key pair, including a preset private key and a preset public key, where the preset private key is stored only in the trusted execution environment associated with the miner node, and The preset public key can be stored outside the trusted execution environment associated with the miner node in the trusted execution environment associated with the miner node.
  • the accounting right determination information may further include a real-name authentication identifier stored in a trusted execution environment associated with the miner node.
  • the real-name authentication identifier is used to characterize whether the trusted execution environment associated with the miner node has passed a third-party agency. Real-name certification.
  • the real-name authentication process of the miner node can be provided by a third-party agency. After the certification is passed, the third-party organization will assign a real-name certification mark to this certification, and store the real-name certification mark in the trusted trusted execution environment.
  • This real-name authentication ID can be used for query verification.
  • a third-party organization can provide a website for public inquiry and verification, and enter the authenticated account address (that is, the account address bound to the authenticated trusted execution environment) and real-name authentication logo on the website, and the above website can feedback information Used to indicate whether the trusted execution environment has passed real-name authentication.
  • the real-name authentication logo may include the institution code of the institution providing the real-name authentication.
  • the institution code can be used to distinguish between different third-party institutions. It can be understood that when a third-party organization provides real-name authentication, the authenticity of the attribution subject of the trusted execution environment can be verified, and the same attribution subject can authenticate a specified number (for example, one) of trusted execution environments at most.
  • a blockchain system that strictly implements the real-name authentication of miner nodes will have higher credibility and security, because real-name authentication can effectively guarantee the decentralization of the accounting process.
  • how to securely store the real-name authentication mark to the authenticated trusted execution environment is an existing technology that is currently widely studied and applied, and will not be repeated here.
  • the trusted execution environment can be used to verify the signature of the relevant storage instruction that stores the real-name authentication identifier into the trusted execution environment with the public key of a preset third-party organization, and the storage is allowed only after the verification is passed.
  • Sub-step 2026 Broadcast the accounting right determination information and the accounting right determination information to the neighboring nodes of the miner node.
  • the execution entity has signed the accounting right determination information through the associated trusted execution environment in step 2025, so the execution entity may determine the accounting right determination information and the accounting right determination determined in sub-step 2025.
  • Information signatures are broadcast to neighboring nodes of the miner node.
  • the above-mentioned execution body may execute sub-step 2024 and then sub-step 2025 and sub-step 2026 after executing sub-step 2023, and may also execute sub-step 2025 and sub-step 2026 before executing sub-step 2023. Step 2024, this application does not specifically limit this.
  • steps 2021 to 2025 completed in the trusted execution environment can be completed by calling the API provided by the trusted execution environment once, rather than calling the API more than once.
  • the steps 2021 to 2025 completed by an API call in the trusted execution environment can be regarded as a service provided by the trusted execution environment as a whole. This service can be remoted as trusted execution environment devices migrate to remote electronic devices.
  • the miner node can remotely call the services provided by the trusted execution environment, and its initiation instructions (including parameters) and the obtained call results need to be encrypted to prevent the attacker from intercepting the analysis or forging the content to launch the attack during the message communication (Ie, launch a man-in-the-middle attack).
  • the trusted execution environment associated with the miner node may use the cipher text to interact with the outside world. That is, when a miner node needs to perform an operation in a trusted execution environment, the pending data and corresponding operation instructions corresponding to the operation to be performed may be encrypted with a preset administrator public key and transmitted to the trusted execution environment. Then, the trusted execution environment can use the preset administrator private key to decrypt the received data to obtain the pending data and corresponding operation instructions. Second, the to-be-processed data decrypted by the trusted execution environment executes the corresponding operation instruction and obtains the operation result. Finally, the trusted execution environment encrypts the obtained operation results and outputs the trusted execution environment.
  • the key used by the trusted execution environment to encrypt the obtained operation result may be included in the decrypted to-be-processed data.
  • the key used by the trusted execution environment to encrypt the obtained operation result may also be preset.
  • the trusted execution environment encrypts the obtained operation results and outputs the trusted execution environment, which can be output to the memory or disk of the miner node, or can be sent to other electronic devices (such as the miner node) connected to the miner node network. Of the same link by the node).
  • step 202 may also be performed as follows:
  • a preset administrator public key can be used to encrypt the instruction corresponding to the accounting right determination operation to obtain an encrypted instruction.
  • the obtained encrypted instruction can be decrypted by using a preset administrator private key stored in the trusted execution environment associated with the miner node to obtain the decrypted instruction.
  • the decrypted instruction is executed to perform a billing right determination operation.
  • the billing right determination operation may include sub-steps 2021 to 2024.
  • the accounting right determination operation may also include sub-steps 2021 to 2026.
  • the execution result of the execution of the accounting right determination operation is encrypted with a preset key stored in the trusted execution environment associated with the miner node, and the trusted execution environment associated with the miner node is output.
  • the trusted execution environment can also provide other services, such as implementing specific signatures, creating specific identities, and generating random numbers. These services can also encrypt incoming pending data and operation instructions and outgoing operation results in the manner described above.
  • the communication process in cipher text will prevent the holder of the trusted execution environment from accepting some service calls and rejecting them.
  • Other services are called to achieve this technical effect: multiple services provided by the trusted execution environment will be provided in bundles.
  • step 202 may also be performed as follows:
  • the bookkeeping right determination operation is performed in a trusted execution environment associated with the miner node. That is, it is necessary to first use PoW for hash collision calculation, and only when the random number used for hash collision calculation satisfies a preset condition will it be determined whether the current cumulative unused duration of the miner node is greater than the cumulative unused lower limit duration.
  • the hash collision calculation in the blockchain, and whether the random number used for the hash collision calculation satisfies a preset condition is an existing technology widely studied and applied in this field, and is not repeated here.
  • the random number used in the hash collision calculation meeting the preset conditions may include:
  • a difficulty target value target targetmax / difficulty is set in advance, where targetmax is a preset maximum difficulty value, and difficulty is a dynamically adjustable difficulty coefficient. The larger the difficulty coefficient, the smaller the difficulty target value.
  • the calculated hash value is less than the above-mentioned difficulty target value. If it is less than the above-mentioned difficulty target value, it can be determined that the random number Nonce used for the hash collision calculation satisfies a preset condition.
  • the technical effects can at least include:
  • the attacker can postpone the execution of step 202, that is, temporarily hold the bookkeeping right determination operation, and allow the trusted execution environment to "Current Cumulative Unused Time" becomes very long.
  • the "cumulative unused time" of each miner node controlled by the attacker is very long, the attacker can make these "cumulative unused time” be very long.
  • the miner node starts to perform the accounting right determination operation at the same time to compete for the accounting right. In this case, the probability of the attacker continuously obtaining the right to keep accounts is greatly increased, and 51% of the computing power is disguised.
  • the hardware of the trusted execution environment is provided by the government. How can the government not cheat itself? Overlaying the PoW consensus mechanism actually raises the threshold for official cheating. Assuming that there are 1,000 miner nodes in the blockchain system, the official needs to use 1,001 equivalent devices to launch a 51% hashrate attack. The threshold is high. This dual consensus mechanism of superimposed PoW is more likely to gain public trust.
  • the foregoing execution subject may also perform the following steps 203 to 205:
  • Step 203 In response to receiving the accounting right determination information and the accounting right determination information signature, use a preset public key to perform signature verification on the received accounting right determination information.
  • the execution entity may use a preset public key in a trusted execution environment or outside the trusted execution environment when receiving the accounting right determination information and the accounting right determination information broadcast from other neighboring nodes. Perform signature verification on the received accounting right determination information.
  • the signature of the received accounting right determination information is obtained by using a preset private key for signature, using the preset public key to perform signature verification on the received accounting right determination information will verify the pass.
  • step 203 If the signature verification is passed in step 203, the execution subject may go to step 204 for execution.
  • step 204 the hash value of the last block and the accumulated unused lower limit in the received accounting right determination information are determined by using the hash value of the tail block and the accumulated unused lower limit of the miner node's blockchain, respectively. The duration is checked.
  • the execution body may perform signature verification on the received accounting right determination information and the accounting right determination information signature.
  • the tail block in the blockchain of the miner node is used respectively.
  • the Greek value and the cumulative unused lower limit time are used to verify the hash value of the previous block and the cumulative unused lower limit time in the received accounting right determination information. If the check passes, it indicates that the miner node that sent the received accounting right determination information did not forge the accounting right determination information, and then it can go to step 205. If the verification fails, it indicates that the miner node that sent the received accounting right determination information forged the accounting right determination information.
  • the tail block in the blockchain of the miner node may be a block that has not been finalized by the miner node (for example, a block that has not been finalized may mean that there are fewer blocks in the miner node's blockchain One of the six blocks).
  • a block that has not been finalized may mean that there are fewer blocks in the miner node's blockchain One of the six blocks).
  • the hash values of blocks B1, B2, and B3 are H1, H2, and H3, respectively.
  • Step 205 Determine the account address in the received accounting right determination information as the account address bound by the miner node competing to the first current block.
  • the execution entity may determine that the account address in the received accounting right determination information is contended for the first current block if the received accounting right determination information is verified in step 204.
  • the first current block is the next block of the block indicated by the previous block hash value in the received accounting right determination information.
  • the consensus method provided by the above embodiments of the present application determines that the miner node competes with the accounting right in the case that the current cumulative unused time of the miner node is greater than the cumulative unused lower limit time in the trusted execution environment associated with the miner node, that is By adopting a mechanism of equal distribution of time length, the high energy consumption defect caused by the consensus mechanism using proof of work in the public chain is overcome.
  • FIG. 3 illustrates a process 300 of yet another embodiment of a consensus method applied to a miner node in a blockchain system according to the present application.
  • the process 300 of the consensus method includes the following steps:
  • Step 301 Obtain a cumulative unused lower limit duration.
  • Step 302 Perform a bookkeeping right determination operation in a trusted execution environment associated with a miner node.
  • steps 301 and 302 are basically the same as the operations of steps 201 and 202 in the embodiment shown in FIG. 2A, and details are not described herein again.
  • Step 303 In response to determining that the miner node competes for the accounting right, it is determined whether to adjust the accumulated unused lower limit duration according to the block where the miner node competes for the accounting right.
  • the execution body of the consensus method can determine whether to adjust according to the block where the miner node competes for the right to account, in the case where it is determined that the miner node competes for the right to account, Cumulative unused lower limit duration. If it is determined to adjust the accumulated unused lower limit duration, go to step 304 for execution.
  • each block can be uniquely indicated by a block identifier.
  • the execution entity may determine whether to adjust the accumulated unused lower limit duration according to the block identifier of the block where the miner node competes for the accounting right.
  • the above-mentioned executing entity may determine whether the block identifier of the block where the miner node competes for the accounting right belongs to a preset set of block identifiers for the adjusted cumulative unused lower limit duration, if If it belongs, you can determine the adjusted unused lower limit duration.
  • the preset block identifier set for adjusting the cumulative unused lower limit time duration may be a set of block identifiers preset by a technician based on experience to indicate the last block of each cumulative unused lower limit time adjustment period.
  • the above-mentioned executing entity may determine whether there is a preset periodic block between the block where the miner node competes for the accounting right and the block corresponding to the last adjusted cumulative unused lower limit time. The number of difference minus one block, if it is, you can determine to adjust the cumulative unused lower limit duration.
  • the preset periodic block number is 1008, that is, the cumulative unused lower limit duration is adjusted for every 1008 blocks produced.
  • Step 304 Perform a cumulative unused lower limit time length adjustment operation.
  • the execution entity may determine to adjust the accumulated unused lower limit duration in step 303, perform the operation of adjusting the accumulated unused lower limit duration.
  • the cumulative unused lower limit duration adjustment operation may include the following sub-steps 3041 to 3042:
  • Sub-step 3041 determining the cumulative unused lower limit duration after adjustment according to the cumulative unused lower limit duration, the actual duration of the adjustment cycle, and the expected adjustment cycle duration.
  • the above-mentioned execution body may adopt various implementation manners, and determine the cumulative unused lower limit duration after adjustment according to the cumulative unused lower limit duration, the actual adjustment period duration, and the expected adjustment cycle duration.
  • the actual length of the adjustment period is the time between the generation time of the block where the miner node competes for the accounting right and the generation time of the block corresponding to the last adjusted cumulative unused lower limit time in the block chain of the miner node. That is, the actual length of the adjustment period is the actual waiting time between the two unadjusted cumulative unused lower durations of the miner node.
  • the adjustment period of the blockchain is the same duration, that is, The actual waiting time between the two consecutive adjustments of the accumulated unused lower limit time will be shorter (because there are more miner nodes participating in the competition for bookkeeping rights, it is easier to complete the competition in less than the expected time), and conversely, when miners When the number of nodes is greatly reduced during the current cumulative unused lower limit time adjustment period, the actual adjustment period is the same, that is, the actual waiting time between two consecutive adjustments of the cumulative unused lower limit time period will become longer.
  • the duration can be positively correlated with both the cumulative unused lower limit duration and the expected adjustment cycle duration, and the adjusted cumulative unused lower limit duration can be negatively correlated with the actual duration of the adjustment cycle.
  • the cumulative unused lower limit duration after the adjustment may be calculated according to the following formula based on the cumulative unused lower limit duration, the actual duration of the adjustment period, and the expected adjustment cycle duration:
  • T min is the cumulative unused lower limit duration
  • T exp is the expected adjustment period duration
  • T real is the real time of the adjustment period
  • T ′ min is the calculated adjusted unused lower limit duration.
  • the accumulated unused lower limit duration can also be calculated according to the following formula based on the accumulated unused lower limit duration, the actual adjustment period duration, and the expected adjustment cycle duration:
  • T min is the cumulative unused lower limit duration
  • T exp is the expected adjustment period duration
  • ⁇ , ⁇ , ⁇ and ⁇ are preset constants
  • T ′ min is the calculated adjusted unused lower limit duration.
  • Sub-step 3042 updating the accumulated unused lower limit duration to the adjusted accumulated unused lower duration.
  • the execution entity may update the cumulative unused lower limit duration of the miner node to the adjusted cumulative unused lower limit duration calculated in substep 3041.
  • the above-mentioned execution body adopts an optional implementation manner of overlaying the PoW consensus mechanism in the embodiment shown in FIG. 2A, in some optional implementation manners of this embodiment, the above-mentioned execution body also You can perform the following steps 305:
  • Step 305 Perform a hash collision difficulty target value adjustment operation.
  • the hash collision difficulty target value adjustment operation may include the following sub-steps 3051 to 3053:
  • Sub-step 3051 in response to determining that the miner node competes for the bookkeeping right, determines whether to adjust the target value of the difficulty of the hash collision according to the block where the miner node competes for the bookkeeping right.
  • the execution entity may determine whether the block identifier of the block that the miner node competes for the accounting right belongs to a preset set of block identifiers for adjusting the hash collision difficulty target value, If it is, you can determine the difficulty target for adjusting the hash collision.
  • the preset block identifier set for adjusting the hash collision difficulty target value may be a block identifier that is preset by a technician based on experience to indicate the last block of each hash collision difficulty target value adjustment cycle. set.
  • the above-mentioned executing entity may determine whether there is a preset periodic block between the block where the miner node competes for the accounting right and the block corresponding to the last adjusted cumulative unused lower limit time.
  • the number of difference minus one block if it is, you can determine the target value of adjusting the hash collision difficulty.
  • the preset periodic block number is 1008, that is, the target value of the hash collision difficulty is adjusted every 1008 blocks.
  • Sub-step 3052 in response to determining the difficulty target value of adjusting the hash collision, determining the adjusted difficulty target value according to the current difficulty target value of the hash collision, the actual adjustment period length, and the expected adjustment period length.
  • the adjusted difficulty target value is positively correlated with the current difficulty target value of the current hash collision and the actual duration of the adjustment period, and the adjusted difficulty target value is negatively correlated with the expected adjustment period length.
  • the specific calculation method of the adjusted difficulty target value is basically the same as the calculation method of the adjusted cumulative unused lower limit duration described in sub-step 2041, and details are not described herein again.
  • Sub-step 3053 Update the difficulty target value of the current hash collision to the adjusted difficulty target value.
  • the process 300 of the consensus method applied to the miner node in the blockchain system in this embodiment has more than 300 times for adjusting the cumulative unused lower limit time. step. Therefore, the technical effects achieved by the solution described in this embodiment can at least include: when the number of miner nodes in the blockchain changes, adjust the accumulated unused lower limit time in real time to adapt to the dynamic change of the number of miner nodes, and try to ensure the area The number of blocks produced by the block chain system within a preset expected period is maintained at a preset number.
  • the POET consensus mechanism is applied to the alliance chain by using the CPU to randomly specify a waiting time to replace the proof-of-work consensus mechanism to compete for bookkeeping rights.
  • This consensus method cannot support the difficulty of dynamically adjusting the bookkeeping rights.
  • the process 300 of the consensus method applied to the miner node in the blockchain system shown in FIG. 3 can adjust the difficulty of competing bookkeeping rights by adjusting the accumulated unused lower limit time. For example, increasing the accumulated unused lower limit duration makes it more difficult to compete for bookkeeping rights, while lowering the accumulated unused lower limit duration reduces the difficulty of competing for bookkeeping rights.
  • FIG. 4 illustrates an exemplary system architecture 400 according to one embodiment of a blockchain system of the present application.
  • the system architecture 400 may include parallel chains 401, 402, 403 and networks 404, 405.
  • the network 404 is used to provide a medium for a communication link between the routing node 4011 and the routing node 4021.
  • the network 404 may include various connection types, such as wired, wireless communication links, or fiber optic cables, and so on.
  • the network 405 is used to provide a medium for a communication link between the routing node 4021 and the routing node 4031.
  • the network 404 may include various connection types, such as wired, wireless communication links, or fiber optic cables, and so on.
  • the parallel chain 401 includes a routing node 4011, a miner node 4012, 4013, 4014, 4015, and a network 4016.
  • the network 4016 is used to provide a medium for a communication link between the routing node 4011 and the miner nodes 4012, 4013, 4014, and 4015.
  • the network 4016 may include various connection types, such as wired, wireless communication links, or fiber optic cables, and so on.
  • the miner nodes 4012, 4013, 4014, 4015 of the parallel chain 401 use a distributed data blockchain to store data.
  • the parallel chain 402 includes a routing node 4021, a miner node 4022, 4023, 4024, and a network 4025.
  • the network 4025 is used to provide a medium for a communication link between the routing node 4021 and the miner nodes 4022, 4023, and 4024.
  • the network 4025 may include various connection types, such as wired, wireless communication links, or fiber optic cables, and so on.
  • the miner nodes 4022, 4023, and 4024 of the parallel chain 402 use a distributed data blockchain to store data.
  • the parallel chain 403 includes a routing node 4031, a miner node 4032, 4033, 4034, 4035, 4036, and a network 4037.
  • the network 4037 is used to provide a medium for a communication link between the routing node 4031 and the miner nodes 4032, 4033, 4034, 4035, and 4036.
  • the network 4037 may include various connection types, such as wired, wireless communication links, or fiber optic cables, and so on.
  • the miner nodes 4032, 4033, 4034, 4035, 4036 of the parallel chain 403 use distributed data blockchains to store data.
  • the user can use the miner nodes 4012, 4013, 4014, 4015 to interact with the routing node 4011 through the network 4016 to receive or send messages and the like.
  • Users can also use the miner nodes 4022, 4023, and 4024 to interact with the routing node 4021 through the network 4025 to receive or send messages.
  • Users can also use the miner nodes 4022, 4023, 4024, 4025, 4036 to interact with the routing node 4031 through the network 4037 to receive or send messages, etc.
  • Miner nodes 4012, 4013, 4014, 4015, 4022, 4023, 4024, 4032, 4033, 4034, 4035, 4036 can be installed with various communication client applications, such as blockchain accounting applications, digital currency wallet applications , Web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc. Users can use digital currency wallet applications installed on the miner nodes 4012, 4013, 4014, 4015, 4022, 4023, 4024, 4032, 4033, 4034, 4035, 4036 to implement digital currency management, transfer, receipt, check balance, View transactions and more.
  • Miner nodes 4012, 4013, 4014, 4015, 4022, 4023, 4024, 4032, 4033, 4034, 4035, 4036 are all bound with account addresses (for example, digital currency wallet applications can be used to bind account addresses).
  • routing nodes 4011, 4021, and 4031 may be hardware or software.
  • the routing nodes 4011, 4021, and 4031 are hardware, they can be implemented as a distributed server cluster composed of multiple servers or as a single server.
  • the routing nodes 4011, 4021, and 4031 are software, they can be implemented as multiple software or software modules (for example, to provide routing services), or can be implemented as a single software or software module. It is not specifically limited here.
  • the miner nodes 4012, 4013, 4014, 4015, 4022, 4023, 4024, 4032, 4033, 4034, 4035, 4036 can be hardware or software.
  • the miner nodes 4012, 4013, 4014, 4015, 4022, 4023, 4024, 4032, 4033, 4034, 4035, 4036 are hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or it can be implemented as a single server.
  • miner nodes 4012, 4013, 4014, 4015, 4022, 4023, 4024, 4032, 4033, 4034, 4035, 4036 are software, they can be implemented as multiple software or software modules (for example, to provide competitive accounting rights and accounting Account services), can also be implemented as a single software or software module. It is not specifically limited here.
  • the miner nodes 4012, 4013, 4014, 4015, 4022, 4023, 4024, 4032, 4033, 4034, 4035, 4036 can be associated with a trusted execution environment, and the miner nodes 4012, 4013, 4014, 4015, 4022, 4023, 4024, 4032, 4033, 4034, 4035, 4036 can implement the consensus method in the embodiment shown in FIG. 2A, and can also implement the consensus method in the embodiment shown in FIG.
  • the trusted execution environment associated with the miner node may be set in the miner node. Alternatively, the trusted execution environment associated with the miner node may also be set in other electronic devices connected to the miner node network.
  • the miner node can interact with its associated trusted execution environment by means of a message communication mechanism (such as TCP / IP).
  • a message communication mechanism such as TCP / IP
  • a trusted execution environment device in the form of a USB interface the industry has mature technologies such as USB and Network, making the trusted execution environment of a USB port inserted in an electronic device connected to the network of a miner node equivalent to plugging into the local machine of the miner node use.
  • the parallel chain can also include SPV (Simplified Payment Verification, Simplified Payment Verification) nodes.
  • SPV nodes can be installed with various communication client applications, such as simplified payment verification applications, digital currencies Wallet applications, web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc. Users can use the simplified payment verification application installed on the SPV node to implement operations such as digital currency management, transfers, receipts, viewing balances, and viewing transaction records.
  • FIG. 4 is merely exemplary. There can be any number of parallel chains according to implementation needs.
  • the number of routing nodes, miner nodes, and networks in each parallel chain is also only indicative. According to implementation needs, there can be any number of routing nodes, miner nodes, and networks.
  • FIG. 5 illustrates a timing sequence 500 of one embodiment of a blockchain system according to the present application.
  • the blockchain system in the embodiment of the present application may include at least one parallel chain (for example, parallel chains 401, 402, and 403 shown in FIG. 4), and the parallel chain may include routing nodes (for example, routing nodes 4011, 4021 shown in FIG. 4). , 4031) and at least one miner node (such as the miner nodes 4012, 4013, 4014, 4015, 4022, 4023, 4024, 4032, 4033, 4034, 4035, 4036) shown in Figure 4, each miner node of each parallel chain
  • the distributed data blockchain is used to store data, and the network connections between routing nodes of at least one parallel chain,
  • the timing sequence 500 of an embodiment of the blockchain system according to the present application may include the following steps:
  • Step 501 A miner node acquires a cumulative unused lower limit duration and performs a bookkeeping right determination operation in a trusted execution environment associated with the miner node, so as to compete for the bookkeeping right of an intra-chain transaction request of the parallel chain where the miner node is located.
  • the miner node may use the consensus method in the embodiment shown in FIG. 2A or the consensus method in the embodiment shown in FIG. 3 to compete for the record of the intra-chain transaction request of the parallel chain where the miner node is located. Account rights.
  • the transaction request may include a billing request and a billing request.
  • the transaction request D is to transfer X digital currencies in the account address A to the account address B.
  • the transaction request D may include an outgoing request D1 and an incoming request D2, where the outgoing request D1 is to reduce the digital currency in the account address A by X, and the incoming request D2 is to increase the digital currency in the account address B by X.
  • adding or reducing X digital currencies for an account address can be reflected in the increase in the total amount expressed by all UTXO (Unspent Transaction Output) attributable to the account address when the blockchain software is implemented. Or reduce.
  • UTXO Unspent Transaction Output
  • the intra-chain transaction request of the parallel chain where the miner node is located may specifically include the following two cases: (1) The parallel chain corresponding to the transfer account address and the transfer account address in the transaction request are both the parallel chain where the miner node is located , Then the outgoing request and the incoming request in the transaction request are both intra-chain transaction requests of the parallel chain where the miner node is located.
  • the parallel chain corresponding to the transfer account address in the transaction request is the parallel chain where the miner node is located, and the parallel chain corresponding to the transfer account address in the transaction request is not the parallel chain where the miner node is, then in the transaction request
  • the payment request is an in-chain transaction request of the parallel chain where the miner node is located, and the entry request in the transaction request is not an in-chain transaction request of the parallel chain where the miner node is located.
  • the entry request in the transaction request is a transfer in transaction request Intra-chain transaction request for the parallel chain corresponding to the account address.
  • the payment request D1 is an intra-chain transaction request of the parallel chain L1
  • the account request D2 is a parallel chain L2 chain. Intra-Transaction Request.
  • SPV nodes or miner nodes in the parallel chain can send the received transaction requests to the parallel chain corresponding to the transfer account address in the transaction request. Routing node. The routing node can sign the received transaction request and broadcast it to the same-chain miner node of the routing node. In this way, the miner node can receive the transaction request and adopt any consensus method in the embodiment shown in FIG. 2A or use any consensus method in the embodiment shown in FIG. 3 to compete for the parallelism of the miner node. The right to book the transaction request within the chain.
  • each account address can correspond to a parallel chain
  • various implementations can be used to correspond the account address to a parallel chain in the parallel chain included in the blockchain system.
  • one of the parallel chains included in the blockchain system can be randomly selected as the parallel chain corresponding to the account address.
  • the parallel chain where the miner node is located may be the parallel chain corresponding to the account address bound by the miner node.
  • step 502 the routing node synchronizes the blockchain of the same-chain miner node of the routing node to the local blockchain in real time.
  • the routing node (for example, the routing nodes 4011, 4021, and 4031 shown in FIG. 1) will also synchronize the blockchain of the same-chain miner node of the routing node to the local blockchain in real time. In other words, the routing node will not perform the operation of competing for accounting rights and accounting. However, the routing node stores the blockchain (ledger) of the parallel chain where the routing node is located.
  • the routing node stores the blockchain (ledger) of the parallel chain where the routing node is located.
  • routing node may execute step 502 at any time, and is not limited to performing step 502 after performing step 501.
  • each routing node can correspond to a parallel chain, and various implementation methods can be used to map the routing node to a parallel chain in the parallel chain included in the blockchain system.
  • the domain name of a routing node may be associated with the parallel chain identifier of the parallel chain where the routing node is located.
  • “routenode0.xxx.com” is the domain name of the routing node of the parallel chain indicated by the parallel chain identifier "0”
  • routenode1.xxx.com is the routing node of the parallel chain indicated by the parallel chain identifier "1"
  • Domain name "routenode65535.xxx.com” is the domain name of the routing node of the parallel chain indicated by the parallel chain identifier "65535".
  • the same-chain miner node of the routing node is a miner node belonging to the same parallel chain as the routing node.
  • the miner nodes 4012, 4013, 4014, and 4015 are the same-chain miner nodes of the routing node 4011.
  • the foregoing sequence 500 may further include steps 503 to 505:
  • Step 503 In response to receiving the accounting right determination information and the accounting right determination information including the hash value of the previous block, the accumulated unused lower limit time, and the account address, the routing node uses the preset public key to sign the received accounting right determination information. The right to confirm the bookkeeping right is verified by the signature.
  • each parallel chain is usually based on a peer-to-peer network (Peer-to-Peer, P2P)
  • the routing node is also a node in the parallel chain, and the routing node may also receive the accounting right determination information and the accounting right determination information signature sent by the miner nodes in the same chain. Therefore, the routing node can use the preset public key to perform signature verification on the received accounting right determination information when it receives the accounting right determination information and the accounting right determination information signature from the same-chain miner node.
  • the routing node also stores a preset public key in a preset key pair stored in the trusted execution environment associated with the miner node.
  • the signature of the accounting right determination information received by the routing node is obtained by using a preset private key for signature, the signature verification of the received accounting right determination information using the preset public key will be verified.
  • the routing node If the accounting right determination information and the accounting right determination information signature received by the routing node are not obtained by using a preset private key for signature, use the preset public key to perform signature verification on the received accounting right determination information. Will fail verification.
  • the routing node may go to step 504 for execution if the signature verification is passed in step 503.
  • Step 504 The routing node responds to the signature verification of the received accounting right determination information, and uses the hash value of the tail block in the routing node's blockchain and the accumulated unused storage of the routing node locally.
  • the lower limit duration verifies the hash value of the previous block and the accumulated unused lower limit duration in the received accounting right determination information.
  • the routing node may use the preset public key to perform signature verification on the received accounting right determination information in step 503, and respectively use the hash value of the tail block in the routing node's blockchain. And the accumulated unused lower limit duration stored locally by the routing node to verify the hash value of the previous block and the accumulated unused lower limit duration in the received accounting right determination information. If the verification passes, it indicates that the miner node that sent the received accounting right determination information did not forge the accounting right determination information, and then it can go to step 505. If the verification fails, it indicates that the miner node that sent the received accounting right determination information forged the accounting right determination information.
  • the trailing block in the routing node's blockchain can be a routing node's block that has not yet been finalized (for example, a block that has not been finalized yet can mean that there are few subsequent blocks in the routing node's blockchain One of the six blocks).
  • a block that has not been finalized yet can mean that there are few subsequent blocks in the routing node's blockchain One of the six blocks.
  • the previous block hash value in the received accounting right determination information can be compared with the above-mentioned hash values H4, H5, and H6, respectively, if there is one hash value in the hash values H4, H5, and H6 Same as the hash value of the previous block in the received accounting right determination information, it can be determined that the verification of the hash value of the previous block in the received accounting right determination information is passed.
  • the routing node responds to the verification of the hash value of the previous block and the cumulative unused lower limit time in the received accounting right determination information, and passes the account number in the received accounting right determination information.
  • the address is determined as the account address bound by the miner node competing to the second current block.
  • the routing node may check the hash value of the previous block and the accumulated unused lower limit time in the received accounting right determination information in step 504 to verify the received accounting right.
  • the account address in the determination information is determined as the account address bound by the miner node competing to the second current block.
  • the second current block is the next block of the block indicated by the hash value of the previous block in the received accounting right determination information.
  • the foregoing sequence 500 may further include the following step 506:
  • step 506 the routing node responds to the previous block hash value and the accumulated unused lower limit time in the received accounting right determination information and fails to check, and the The account address is added to the locally stored blacklist account address set.
  • the routing node locally stores a blacklisted account address set.
  • the routing node will check the validity of the transaction request. Only the transaction request that passed the validity check will be signed by the routing node and broadcast to each of the same-chain miner nodes of the routing node.
  • the validity check may include, but is not limited to, verifying whether the transfer account address in the transaction request has a UTXO record, whether the balance of the transfer account address in the transaction request supports the current transaction request, and the transfer account address in the transaction request. Or whether the transferred account address is an account address in the blacklist account address set stored in the routing node, and so on.
  • step 504 if the routing node fails to verify the hash value of the previous block and the accumulated unused lower limit time in the received accounting right determination information, it indicates that the received accounting right is sent.
  • the miner node that determined the information forged the accounting right determination information then the account address in the received accounting right determination information can be added to the blacklist account address set stored by the routing node, and the account address in the blacklist account address set Both the outbound transaction request and the inbound transaction request will be blocked by the routing node because the legitimacy check fails.
  • FIG. 5B Due to the limitation of page display, the following reference is continued to FIG. 5B. It should be noted that the process of FIG. 5B may include various steps shown in FIG. 5A in addition to the process shown in FIG. 5B.
  • the rewards of miner nodes come from two parts. One is that there is a reward for competing with the right to bookkeeping, commonly known as a mining reward; the other is the bookkeeping reward, that is, the transaction request recorded in the current block of the miner node Reward, commonly known as bookkeeping fee (or transaction fee, transaction commission).
  • the value of the bookkeeping reward part is related to the time period. In the time period with high transaction volume, the bookkeeping reward is more, and in the time period with less transaction volume, the bookkeeping reward is less.
  • the above-mentioned timing 500 may further include steps 507 to 509 shown in FIG. 5B:
  • Step 507 The miner node determines whether to enter a new cumulative unused lower limit time adjustment period according to the block in which the miner node competes for the accounting right.
  • the miner node may determine whether to enter a new cumulative unused lower limit time adjustment period according to the block in which the miner node competes for the bookkeeping right. If the block corresponding to the accumulated unused lower limit last time and the block that competed for the bookkeeping right for the miner node are separated by the difference between the preset period and the number of blocks minus 1, the miner node competes for the bookkeeping right The corresponding block enters the new cumulative unused time adjustment cycle. The block that the miner node competes for the accounting right is the first block to enter the new cumulative unused time adjustment cycle. Then it can be determined that the new cumulative unused time adjustment cycle is entered. The lower limit duration adjustment period is then performed at step 508, otherwise, it may be determined that a new cumulative unused lower limit duration adjustment period has not been entered, and then proceeds to step 509 for execution.
  • each block can be indicated by a block identifier
  • the miner node can determine whether the block identifier of the block that the miner node competes for the accounting right belongs to a preset
  • the new period block identifier set if it belongs, it can be determined to enter a new cumulative unused lower limit duration adjustment period.
  • the preset new period block identifier set may be a set of block identifiers preset by a technician based on experience and used to instruct the first block of a new cumulative unused lower limit time adjustment period.
  • the new periodic block identifier set may include : 0, 1008, ..., 1008 ⁇ n, where n is a positive integer.
  • step 508 the miner node responds to the determination that it enters a new cumulative unused lower limit time length adjustment period, and executes an operation for determining a bookkeeping reward per block in the current period.
  • the miner node may determine in step 507 to enter a new cumulative unused lower limit time length adjustment period, and perform the current block accounting reward determination operation, where the current per block accounting reward determination operation may include as shown in FIG. 5C Illustrated sub-steps 5081 to 5084:
  • Sub-step 5081 Obtain the digital currency balance corresponding to the account address of the miner node that is linked by the node.
  • the miner node can obtain the digital currency balance corresponding to the account address of the miner node that is bound by the node, and these acquired digital currency balances can be used to evenly distribute to the current accumulated unused lower limit duration adjustment period.
  • the miner node corresponding to each block can obtain the digital currency balance corresponding to the account address of the miner node that is bound by the node, and these acquired digital currency balances can be used to evenly distribute to the current accumulated unused lower limit duration adjustment period.
  • sub-step 5082 the integer part of the ratio obtained by dividing the obtained digital currency balance by the number of blocks in a preset period is determined as the current accounting reward per block.
  • the current accounting reward per block may be an integer or a floating point number. If the current bookkeeping reward per block is a floating point number, here, because there may be differences in hardware structure between different miner nodes, the accuracy of each miner node in the division operation is different. In order to avoid the difference in the current accounting rewards per block due to the difference in the hardware structure of each miner node, the integer part of the ratio obtained by dividing the obtained digital currency balance by the number of blocks in a preset period can be determined as Bookkeeping rewards per block in the current period. In this way, even if the hardware of each miner node is different, the calculation of the bookkeeping rewards per block in the current period can be guaranteed to be the same.
  • the current accounting reward per block is used to characterize each new block in the current cumulative unused lower limit time adjustment period.
  • the bookkeeping reward is the same, that is, the bookkeeping reward is the bookkeeping reward per block for the current period.
  • the accounting reward of each block newly issued during the current cumulative unused lower limit time adjustment period is only related to the total accounting reward of each transaction request in the block within the previous cumulative unused lower limit time adjustment period. , And has nothing to do with the accounting reward of the transaction request to be recorded in this block.
  • the number of preset period blocks is a preset number of blocks generated in each cumulative unused lower limit time adjustment period.
  • the number of preset period blocks may be 1008.
  • Sub-step 5083 determines the product of the accounting reward per block in the current period and the number of blocks in a preset period as the current expected distribution reward.
  • N is the number of preset period blocks
  • U a is the calculated reward for each block in the current period
  • U ′ is the calculated expected distribution reward.
  • the distribution reward is expected to be used to represent the sum of the bookkeeping rewards shared by the miner nodes of each newly generated block within the current cumulative unused lower limit time adjustment period.
  • Sub-step 5084 generating a block for the miner node to compete with the block for bookkeeping rights based on the selected pending transaction request, when the reward reward transfer-out information is expected, the current block reward transfer-in information and the current block reward transfer-out information data.
  • the miner node locally stores a set of pending transaction requests. Since the miner node has already competed for accounting rights, at this time, the miner node will select a pending transaction request from the locally stored set of pending transaction requests, and select the selected transaction request. Of pending transaction requests are written to the block that is currently competing for accounting rights.
  • the block that currently competes with the bookkeeping right since the block that currently competes with the bookkeeping right is the first block of the current cumulative unused lower limit time adjustment period, it will also In this block, write the expected transfer reward reward transfer-out information, the current block reward transfer-in information, and the current block reward transfer-out information, where the expected distribution reward transfer-out information is used to characterize the same link from the miner node
  • the account address bound by the node is transferred out.
  • the current block reward transfer information is used to indicate that the current block reward for each block is transferred to the account address bound by the miner node, and the current block reward is transferred out.
  • the information is used to characterize the transfer of the accounting reward corresponding to the selected pending transaction request to the miner node's account address bound to the node by the node. That is, in the first block of the current accumulated unused lower limit time adjustment period, the transfer from the account address bound by the node to the miner node ’s same link is transferred out.
  • the current reward for each block is transferred into The account address bound by the miner node and the account address bound by the node for transferring the accounting reward corresponding to the selected pending transaction request to the miner node.
  • the miner node responds to the determination that it has not entered a new cumulative unused lower limit time adjustment period, and generates a miner node competition record based on the selected pending transaction request, the current block reward transfer-in information, and the current block reward transfer-out information.
  • the block data of the account block is not limited to the current block reward transfer-in information, and the current block reward transfer-out information.
  • the miner node may determine in step 507 that it has not entered a new cumulative unused lower limit duration adjustment period, indicating that the block currently competing for the accounting right by the miner node is not the first block in the current cumulative unused adjustment period. In the same way, because the miner node has already competed for the right to account, at this time, the miner node will select the pending transaction request from the set of pending transaction requests stored locally, and write the selected pending transaction request into the current competition. To the block of accounting rights.
  • the block that currently competes with the bookkeeping right is not the first block of the current cumulative unused lower limit time adjustment period, and there is no need to write the current
  • the reward to be allocated is transferred out of the account address bound by the node of the same link of the miner node, but each miner node that competes for the accounting right will receive the current accounting reward for each block, and the selected pending transaction request
  • Each transaction request in the account corresponds to a bookkeeping reward, and the bookkeeping reward corresponding to the selected pending transaction request needs to be transferred to the account address of the miner node that is bound by the node.
  • the current block reward transfer-in information and the current block reward transfer-out information will also be written in this block.
  • the current block reward transfer-in information is used to characterize the transfer of the current accounting reward for each block.
  • the account address bound by the miner node, and the current block reward transfer out information is used to represent the account address bound by the node of the same link where the selected reward for the pending transaction request is transferred to the miner node.
  • PoW consensus algorithm needs to be based on complete block data, including the pending transactions that need to be packaged, in order to determine the hash value of the root of the Merkle Tree recorded in the block header.
  • steps 507, 508, and 509 should be performed before step 501, that is, it is necessary to determine whether to perform the accounting right determination operation.
  • Enter the new cumulative unused lower limit duration adjustment cycle and when it is determined to enter the new cumulative unused lower limit duration adjustment period, execute the current accounting confirmation of each block per block, and determine that the new cumulative unused lower limit has not been entered
  • the block data of the block where the miner node competes for the accounting right is generated according to the selected pending transaction request, the current block reward transfer-in information and the current block reward transfer-out information.
  • steps 507, 508, and 509 may be performed after step 501.
  • the foregoing sequence 500 may further include the following steps 510 and 511:
  • step 510 the routing node determines a time interval between the same node in the same chain and the same miner node competing for the accounting right.
  • the routing node can determine the same same-chain miner node of the routing node to compete for the accounting right by the local blockchain. Time interval.
  • Step 511 The routing node responds to the accumulated unused lower limit time minus the determined time interval and the time difference is greater than a preset time threshold, and adds the account address bound to the miner node corresponding to the determined time interval to the blacklist account address set. .
  • the routing node in step 510 and the same interval of the same miner node of the same routing node determine the time interval between the two adjacent nodes competing for the accounting right, then in step 511 the routing node may first calculate the cumulative unused lower limit time minus Go to the time difference of the determined time interval, and then determine whether the calculated time difference is greater than a preset time threshold. If it is greater than the preset time threshold, it indicates that the time interval determined in step 510 is shorter, that is, the time interval determined in step 510 is shorter.
  • the time interval between the two adjacent miner nodes competing for the right to account for the determined time interval is short, that is, the miner node corresponding to the time interval determined in step 510 may have cheating behavior, then the routing node can use
  • the account address bound by the miner node corresponding to the determined time interval is added to the blacklist account address set, and furthermore, the outbound transaction request and the inbound transaction request of the account address bound by the miner node corresponding to the determined interval are both The routed node is blocked because the validity check fails in the validity check.
  • steps 510 and 511 include at least:
  • the content of the crack may be: shortening the interval of waiting for accounting rights by destroying the hardware clock in the trusted execution environment, or cracking the first key equivalent stored in the trusted execution environment.
  • this application provides an embodiment of a consensus device applied to a miner node in a blockchain system.
  • This device embodiment is similar to the method shown in FIG. 2A
  • the device can be specifically applied to various electronic devices.
  • the consensus device 600 applied to a miner node in a blockchain system in this embodiment includes a first obtaining unit 601 and a billing right determination unit 602.
  • the first obtaining unit 601 is configured to obtain the accumulated unused lower limit duration; and the accounting right determination unit 602 is configured to perform the following accounting right determination operation in a trusted execution environment associated with the miner node: determine the miner node The current accumulated unused time; determine whether the current accumulated unused time is greater than the accumulated unused lower limit time; and in response to determining that the current accumulated unused time is greater than the accumulated unused lower limit time, determine that the miner node competes to the accounting right, and The current cumulative unused time is updated with the difference between the duration and the cumulative unused lower limit time.
  • step 201 and step 202 in the example are not repeated here.
  • the trusted execution environment associated with the miner node may include: the trusted execution environment associated with the miner node is set in the miner node; or the miner node is associated
  • the trusted execution environment is provided in other electronic devices connected to the network of the miner node, and the miner node interacts with its associated trusted execution environment through a message communication mechanism.
  • the operation of determining the accounting right may further include: in response to determining that the miner node competes for the accounting right, according to the block in which the mining node competes for the accounting right To determine whether to adjust the cumulative unused lower limit duration; in response to determining to adjust the cumulative unused lower limit duration, perform the following cumulative unused lower limit duration adjustment operation: according to the cumulative unused lower limit duration, and adjust the actual time duration and expectations
  • the length of the adjustment cycle determines the cumulative unused lower limit time after the adjustment, and the actual adjustment time is the generation time of the block in which the miner node competes for accounting rights and the last adjustment in the block chain of the miner node. The time between the generation times of the blocks corresponding to the cumulative unused lower limit duration; and updating the cumulative unused lower limit duration to the adjusted cumulative unused lower limit duration.
  • the adjusted unused lower limit duration may be positively related to both the cumulative unused lower limit duration and the desired adjustment period duration, and the adjusted cumulative unused lower limit is positively related.
  • the duration may be negatively related to the actual duration of the adjustment period.
  • the device before performing the following accounting right determination operation in a trusted execution environment associated with the miner node, the device may further include a second obtaining unit 603 configured to obtain A hash value of a previous block of the block to be accounted for; and after the determining that the miner node competes for a bookkeeping right, the operation of determining the bookkeeping right may further include: In the letter execution environment, the bookkeeping right determination information is signed by using a preset private key stored in the trusted execution environment to obtain a bookkeeping right determination information signature, where the bookkeeping right determination information includes: to-be-accounted area The hash value of the previous block of the block, the accumulated unused lower limit time, and the account address bound to the miner node, the account address bound to the miner node is stored in a trusted execution environment associated with the miner node Medium; sign the broadcast right determination information and the record right determination information to a neighboring node of the miner node by broadcasting.
  • the accounting right determination information may further include a real-name authentication identifier stored in a trusted execution environment associated with the miner node, and the real-name authentication identifier is used to characterize Describes whether the trusted execution environment associated with the miner node has passed the real-name certification of a third-party organization.
  • the trusted execution environment associated with the miner node may use cipher text to interact with the outside world; and the accounting right determination unit 602 may be further configured to: use a preset The administrator public key encrypts the instruction corresponding to the accounting right determination operation to obtain the encrypted instruction; in the trusted execution environment associated with the miner node, the pre-stored information stored in the trusted execution environment associated with the miner node is used.
  • the administrator's private key decrypts the obtained encrypted instruction, obtains the decrypted instruction, and executes the decrypted instruction to perform the accounting right determination operation; the execution result of the accounting right determination operation will be performed Encrypt with the preset key stored in the trusted execution environment associated with the miner node and output the trusted execution environment associated with the miner node.
  • the apparatus 600 may further include: a signature verification unit 604 configured to respond to receiving the accounting right determination information and the accounting right determination information signature, using a preset public account The signature verification is performed on the received accounting right determination information by a key; the verification unit 605 is configured to respond to the signature verification of the received accounting right determination information, and respectively utilize the blockchain of the miner node The hash value of the tail block and the cumulative unused lower limit duration in the verification are performed to check the hash value of the previous block and the cumulative unused lower limit duration in the received accounting right determination information; the determining unit 606, It is configured to determine the account address in the received accounting right determination information as the account address bound by the miner node competing to the first current block in response to the verification pass, wherein the first current block The next block of the block indicated by the previous block hash value in the received accounting right determination information.
  • a signature verification unit 604 configured to respond to receiving the accounting right determination information and the accounting right determination information signature, using a preset public account The signature verification is performed on the received accounting right determination information
  • the bookkeeping right determination operation may further include: in response to determining the current accumulation of the miner node The unused time is greater than the cumulative unused upper limit time, and the current cumulative unused time is updated to the cumulative unused upper limit time.
  • FIG. 7 illustrates a schematic structural diagram of a computer system 700 suitable for implementing a miner node in an embodiment of the present application.
  • the miner node shown in FIG. 7 is only an example, and should not bring any limitation on the functions and scope of use of the embodiments of the present application.
  • the computer system 700 includes a central processing unit (CPU, Central Processing Unit) 701, which can be loaded to random access according to a program stored in a read-only memory (ROM, Read Only Memory) 702 or from a storage portion 708
  • ROM Read Only Memory
  • RAM Random Access Memory
  • a program in a memory (RAM, Random Access Memory) 703 executes various appropriate actions and processes.
  • RAM 703 various programs and data required for the operation of the system 700 are also stored.
  • the CPU 701, ROM 702, and RAM 703 are connected to each other through a bus 704.
  • An input / output (I / O, Input / Output) interface 705 is also connected to the bus 704.
  • the following components are connected to the I / O interface 705: an input portion 706 including a keyboard, a mouse, and the like; an output portion 707 including a cathode ray tube (CRT, Cathode Ray Tube), a liquid crystal display (LCD, Liquid Crystal Display), and the speaker, etc.
  • a storage section 708 including a hard disk and the like; and a communication section 709 including a network interface card such as a LAN (Local Area Network) card, a modem, and the like.
  • the communication section 709 performs communication processing via a network such as the Internet.
  • the driver 710 is also connected to the I / O interface 705 as needed.
  • a removable medium 711 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed, so that a computer program read out therefrom is installed into the storage section 708 as needed.
  • the process described above with reference to the flowchart may be implemented as a computer software program.
  • embodiments of the present disclosure include a computer program product including a computer program carried on a computer-readable medium, the computer program containing program code for performing a method shown in a flowchart.
  • the computer program may be downloaded and installed from a network through the communication section 709, and / or installed from a removable medium 711.
  • CPU central processing unit
  • the computer-readable medium described in this application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the two.
  • the computer-readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable Programming read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the foregoing.
  • a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in combination with an instruction execution system, apparatus, or device.
  • a computer-readable signal medium may include a data signal that is included in baseband or propagated as part of a carrier wave, and which carries computer-readable program code. Such a propagated data signal may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • the computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, and the computer-readable medium may send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device .
  • Program code embodied on a computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
  • Computer program code for performing the operations of the present application may be written in one or more programming languages, or a combination thereof, including programming languages such as Java, Smalltalk, C ++, Python, and also object-oriented. Includes regular procedural programming languages—such as "C” or similar programming languages.
  • the program code can be executed entirely on the user's computer, partly on the user's computer, as an independent software package, partly on the user's computer, partly on a remote computer, or entirely on a remote computer or server.
  • the remote computer can be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (such as through an Internet service provider) Internet connection).
  • LAN local area network
  • WAN wide area network
  • Internet service provider Internet service provider
  • each block in the flowchart or block diagram may represent a module, a program segment, or a part of code, which contains one or more functions to implement a specified logical function Executable instructions.
  • the functions labeled in the blocks may also occur in a different order than those labeled in the drawings. For example, two blocks represented one after the other may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved.
  • each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts can be implemented by a dedicated hardware-based system that performs the specified function or operation , Or it can be implemented with a combination of dedicated hardware and computer instructions.
  • the units described in the embodiments of the present application may be implemented by software or hardware.
  • the described unit may also be provided in a processor, for example, it may be described as: a processor includes a first acquisition unit and a billing right determination unit. Among them, the names of these units do not constitute a limitation on the unit itself in some cases.
  • the first acquisition unit may also be described as "a unit that acquires the cumulative unused lower limit time".
  • the present application further provides a computer-readable medium, which may be included in the device described in the foregoing embodiments; or may exist alone without being assembled into the device.
  • the computer-readable medium carries one or more programs, and when the one or more programs are executed by the device, the device: obtains a cumulative unused lower limit duration; executes the following in a trusted execution environment associated with the miner node Accounting right determination operation: determine the current accumulated unused duration of the above miner node; determine whether the current accumulated unused duration is greater than the accumulated unused lower limit duration; and in response to determining that the current accumulated unused duration is greater than the accumulated unused lower duration, It is determined that the miner node competes for a bookkeeping right, and the current accumulated unused time is updated with a difference between the current accumulated unused time and the accumulated unused lower limit time.

Abstract

一种应用于区块链系统中矿工节点的共识方法和装置。该方法包括:获取累计未用下限时长;在矿工节点关联的可信执行环境中执行以下记账权确定操作:确定矿工节点的当前累计未用时长;确定当前累计未用时长是否大于累计未用下限时长;响应于确定当前累计未用时长大于累计未用下限时长,确定矿工节点竞争到记账权,以及用当前累计未用时长与累计未用下限时长的差更新当前累计未用时长。该方法降低了区块链系统的电能消耗。

Description

应用于区块链系统中矿工节点的共识方法和区块链系统
本专利申请要求于2018年07月10日提交的、申请号为201810751530.8、申请人为程强、发明名称为“应用于区块链系统中矿工节点的共识方法和区块链系统”的中国专利申请的优先权,该申请的全文以引用的方式并入本申请中。
技术领域
本申请实施例涉及计算机技术领域,具体涉及应用于区块链系统中矿工节点的共识方法和区块链系统。
背景技术
目前区块链的公有链中主要采用PoW(Proof of Work,工作量证明)作为共识算法来确定哪个矿工节点获得记账权。PoW作为共识算法的优点是适应面广、安全性高,最大缺点是无意义的哈希碰撞计算(俗称挖矿)导致大量电能浪费。
在区块链的联盟链中有采用PoET(Proof of Elapsed Time,消逝时间量证明)作为共识算法,但目前的PoET共识算法依赖于特定型号的CPU,而联盟链是在特定机构间搭建区块链系统,因此,指定统一使用特定型号的CPU是可接受的,但公有链系统则不适合限定使用特定型号的CPU,因此,目前的PoET不适合应用在公有链中。
发明内容
本申请实施例提出了应用于区块链系统中矿工节点的共识方法和装置。
第一方面,本申请实施例提供了一种应用于区块链系统中矿工节点的共识方法,该方法包括:获取累计未用下限时长;在所述矿工节点关联的可信执行环境中执行以下记账权确定操作:确定所述矿工节点的当前累计未用时长;确定所述当前累计未用时长是否大于所述累计未用下限时长;响应于确定所述当前累计未用时长大于所述累计未 用下限时长,确定所述矿工节点竞争到记账权,以及用所述当前累计未用时长与所述累计未用下限时长的差更新所述当前累计未用时长。
在一些实施例中,所述矿工节点关联有可信执行环境,包括:所述矿工节点关联的可信执行环境设置在所述矿工节点中;或者所述矿工节点关联的可信执行环境设置在与所述矿工节点网络连接的其他电子设备中,所述矿工节点通过消息通信机制与其关联的可信执行环境进行交互。
在一些实施例中,所述记账权确定操作还包括:响应于确定所述矿工节点竞争到记账权,根据所述矿工节点竞争到记账权的区块,确定是否调整所述累计未用下限时长;响应于确定调整所述累计未用下限时长,执行以下累计未用下限时长调整操作:根据所述累计未用下限时长、调整周期实等时长和期望调整周期时长确定调整后累计未用下限时长,所述调整周期实等时长为所述矿工节点竞争到记账权的区块的生成时间和所述矿工节点的区块链中上次调整所述累计未用下限时长对应的区块的生成时间之间的时长;以及将所述累计未用下限时长更新为所述调整后累计未用下限时长。
在一些实施例中,所述调整后累计未用下限时长与所述累计未用下限时长和所述期望调整周期时长均正相关,所述调整后累计未用下限时长与所述调整周期实等时长负相关。
在一些实施例中,在所述矿工节点关联的可信执行环境中执行以下记账权确定操作之前,所述方法还包括:获取待记账区块的上一区块的哈希值;以及在所述确定所述矿工节点竞争到记账权之后,所述记账权确定操作还包括:在所述矿工节点关联的可信执行环境中,将记账权确定信息利用所述可信执行环境中存储的预设私钥签名,得到记账权确定信息签名,其中,所述记账权确定信息包括:待记账区块的上一区块的哈希值、所述累计未用下限时长和所述矿工节点绑定的账号地址,所述矿工节点绑定的账号地址存储在所述矿工节点关联的可信执行环境中;将所述记账权确定信息和所述记账权确定信息签名广播给所述矿工节点的相邻节点。
在一些实施例中,所述记账权确定信息还包括存储在所述矿工节 点关联的可信执行环境中的实名认证标识,所述实名认证标识用于表征所述矿工节点关联的可信执行环境是否已通过第三方机构的实名认证。
在一些实施例中,所述矿工节点关联的可信执行环境采用密文方式与外界交互;以及所述在所述矿工节点关联的可信执行环境中执行以下记账权确定操作,包括:用预设管理员公钥对所述记账权确定操作对应的指令进行加密,得到加密指令;在所述矿工节点关联的可信执行环境中,用所述矿工节点关联的可信执行环境中存储的预设管理员私钥对所得到的加密指令进行解密,得到解密后的指令,以及执行所述解密后的指令以执行所述记账权确定操作;将执行所述记账权确定操作的执行结果用所述矿工节点关联的可信执行环境中存储的预设密钥加密后输出所述矿工节点关联的可信执行环境。
在一些实施例中,所述方法还包括:响应于接收到记账权确定信息与记账权确定信息签名,利用预设公钥对所收到的记账权确定信息进行签名验证;响应于对所收到的记账权确定信息进行签名验证通过,分别利用所述矿工节点的区块链中的尾部区块的哈希值和所述累计未用下限时长对所收到的记账权确定信息中的上一区块哈希值和累计未用下限时长进行校验;响应于校验通过,将所收到的记账权确定信息中的账号地址确定为竞争到第一当前区块的矿工节点绑定的账号地址,其中,所述第一当前区块为所收到的记账权确定信息中上一区块哈希值所指示的区块的下一区块。
在一些实施例中,所述在确定所述矿工节点的当前累计未用时长之后,所述记账权确定操作还包括:响应于确定所述矿工节点的当前累计未用时长大于累计未用上限时长,将所述当前累计未用时长更新为所述累计未用上限时长。
第二方面,本申请实施例提供了一种应用于区块链系统中矿工节点的共识装置,该装置包括:第一获取单元,被配置成获取累计未用下限时长;记账权确定单元,被配置成在矿工节点关联的可信执行环境中执行以下记账权确定操作:确定矿工节点的当前累计未用时长;确定当前累计未用时长是否大于累计未用下限时长;响应于确定当前 累计未用时长大于累计未用下限时长,确定矿工节点竞争到记账权,以及用当前累计未用时长与累计未用下限时长的差更新当前累计未用时长。
在一些实施例中,所述矿工节点关联有可信执行环境,包括:所述矿工节点关联的可信执行环境设置在所述矿工节点中;或者所述矿工节点关联的可信执行环境设置在与所述矿工节点网络连接的其他电子设备中,所述矿工节点通过消息通信机制与其关联的可信执行环境进行交互。
在一些实施例中,所述记账权确定操作还包括:响应于确定所述矿工节点竞争到记账权,根据所述矿工节点竞争到记账权的区块,确定是否调整所述累计未用下限时长;响应于确定调整所述累计未用下限时长,执行以下累计未用下限时长调整操作:根据所述累计未用下限时长、调整周期实等时长和期望调整周期时长确定调整后累计未用下限时长,所述调整周期实等时长为所述矿工节点竞争到记账权的区块的生成时间和所述矿工节点的区块链中上次调整所述累计未用下限时长对应的区块的生成时间之间的时长;以及将所述累计未用下限时长更新为所述调整后累计未用下限时长。
在一些实施例中,所述调整后累计未用下限时长与所述累计未用下限时长和所述期望调整周期时长均正相关,所述调整后累计未用下限时长与所述调整周期实等时长负相关。
在一些实施例中,在所述矿工节点关联的可信执行环境中执行以下记账权确定操作之前,所述装置还包括第二获取单元,被配置成获取待记账区块的上一区块的哈希值;以及在所述确定所述矿工节点竞争到记账权之后,所述记账权确定操作还包括:在所述矿工节点关联的可信执行环境中,将记账权确定信息利用所述可信执行环境中存储的预设私钥签名,得到记账权确定信息签名,其中,所述记账权确定信息包括:待记账区块的上一区块的哈希值、所述累计未用下限时长和所述矿工节点绑定的账号地址,所述矿工节点绑定的账号地址存储在所述矿工节点关联的可信执行环境中;将所述记账权确定信息和所述记账权确定信息签名广播给所述矿工节点的相邻节点。
在一些实施例中,所述记账权确定信息还包括存储在所述矿工节点关联的可信执行环境中的实名认证标识,所述实名认证标识用于表征所述矿工节点关联的可信执行环境是否已通过第三方机构的实名认证。
在一些实施例中,所述矿工节点关联的可信执行环境采用密文方式与外界交互;以及所述记账权确定单元进一步被配置成:用预设管理员公钥对所述记账权确定操作对应的指令进行加密,得到加密指令;在所述矿工节点关联的可信执行环境中,用所述矿工节点关联的可信执行环境中存储的预设管理员私钥对所得到的加密指令进行解密,得到解密后的指令,以及执行所述解密后的指令以执行所述记账权确定操作;将执行所述记账权确定操作的执行结果用所述矿工节点关联的可信执行环境中存储的预设密钥加密后输出所述矿工节点关联的可信执行环境。
在一些实施例中,所述装置还包括:签名验证单元,被配置成响应于接收到记账权确定信息与记账权确定信息签名,利用预设公钥对所收到的记账权确定信息进行签名验证;校验单元,被配置成响应于对所收到的记账权确定信息进行签名验证通过,分别利用所述矿工节点的区块链中的尾部区块的哈希值和所述累计未用下限时长对所收到的记账权确定信息中的上一区块哈希值和累计未用下限时长进行校验;确定单元,被配置成响应于校验通过,将所收到的记账权确定信息中的账号地址确定为竞争到第一当前区块的矿工节点绑定的账号地址,其中,所述第一当前区块为所收到的记账权确定信息中上一区块哈希值所指示的区块的下一区块。
在一些实施例中,所述在确定所述矿工节点的当前累计未用时长之后,所述记账权确定操作还包括:响应于确定所述矿工节点的当前累计未用时长大于累计未用上限时长,将所述当前累计未用时长更新为所述累计未用上限时长。
第三方面,本申请实施例提供了一种矿工节点,包括:一个或多个处理器;存储装置,其上存储有一个或多个程序,当上述一个或多个程序被上述一个或多个处理器执行时,使得上述一个或多个处理器 实现如第一方面中任一实现方式描述的方法。
第四方面,本申请实施例提供了一种计算机可读存储介质,其上存储有计算机程序,其中,该计算机程序被一个或多个处理器执行时实现如第一方面中任一实现方式描述的方法。
第五方面,本申请实施例提供了一种区块链系统,所述区块链系统包括至少一个并行链,并行链包括路由节点和至少一个矿工节点,其中,所述至少一个并行链的路由节点之间网络连接,矿工节点绑定有账号地址,矿工节点被配置成如第一方面中任一实现方式描述的方法竞争该矿工节点所在并行链的链内交易请求的记账权,路由节点被配置成:实时将该路由节点的同链矿工节点的区块链同步到本地区块链。
在一些实施例中,路由节点还被配置成:响应于接收到包括上一区块哈希值、累计未用下限时长、账号地址的记账权确定信息和记账权确定信息签名,利用预设公钥对所收到的记账权确定信息进行签名验证;响应于对所收到的记账权确定信息进行签名验证通过,分别利用该路由节点的区块链中的尾部区块的哈希值和该路由节点本地存储的累计未用下限时长对所收到的记账权确定信息中的上一区块哈希值和累计未用下限时长进行校验;响应于对所收到的记账权确定信息中的上一区块哈希值和累计未用下限时长进行校验通过,将所收到的记账权确定信息中的账号地址确定为竞争到第二当前区块的矿工节点绑定的账号地址,其中,所述第二当前区块为所收到的记账权确定信息中上一区块哈希值所指示的区块的下一区块。
在一些实施例中,路由节点还被配置成:响应于对所收到的记账权确定信息中的上一区块哈希值和累计未用下限时长进行校验不通过,将所收到的记账权确定信息中的账号地址添加到本地存储的黑名单账号地址集合。
在一些实施例中,矿工节点还被配置成:根据该矿工节点竞争到记账权的区块,确定是否进入新的累计未用下限时长调整周期;响应于确定进入新的累计未用下限时长调整周期,执行以下当期每区块记账奖励确定操作:获取该矿工节点的同链路由节点绑定的账号地址对 应的数字货币余额;将获取的数字货币余额除以预设周期区块数目所得到的比值的整数部分确定为当期每区块记账奖励;将所述当期每区块记账奖励与所述预设周期区块数目的积确定为当期待分配奖励;根据所选取的待处理交易请求、当期待分配奖励转出信息、当前区块奖励转入信息和当前区块奖励转出信息生成所述矿工节点竞争到记账权的区块的区块数据,其中,所述当期待分配奖励转出信息用于表征从该矿工节点的同链路由节点绑定的账号地址转出所述当期待分配奖励,所述当前区块奖励转入信息用于表征将所述当期每区块记账奖励转入该矿工节点绑定的账号地址,所述当前区块奖励转出信息用于表征将所选取的待处理交易请求对应的记账奖励转入该矿工节点的同链路由节点绑定的账号地址;响应于确定未进入新的累计未用下限时长调整周期,根据所选取的待处理交易请求、所述当前区块奖励转入信息和所述当前区块奖励转出信息生成所述矿工节点竞争到记账权的区块的区块数据。
在一些实施例中,所述在所述矿工节点关联的可信执行环境中执行以下记账权确定操作,包括:响应于采用工作量证明共识机制进行哈希碰撞计算所用的随机数满足预设条件,在所述矿工节点关联的可信执行环境中执行所述记账权确定操作。
在一些实施例中,矿工节点还被配置成:执行以下哈希碰撞难度目标值调整操作:响应于确定所述矿工节点竞争到记账权,根据所述矿工节点竞争到记账权的区块,确定是否调整哈希碰撞的难度目标值;响应于确定调整所述哈希碰撞的难度目标值,根据所述当前哈希碰撞的难度目标值、调整周期实等时长和期望调整周期时长确定调整后难度目标值,以及将所述当前哈希碰撞的难度目标值更新为所述调整后难度目标值。
在一些实施例中,路由节点还被配置成:确定该路由节点的同一同链矿工节点相邻两次竞争到记账权的时间间隔;响应于所述累计未用下限时长减去所确定的时间间隔的时长差大于预设时长阈值,将所确定的时间间隔对应的矿工节点绑定的账号地址添加到所述黑名单账号地址集合。
本申请实施例提供的应用于区块链系统中矿工节点的共识方法,通过在矿工节点关联的可信执行环境中确定矿工节点的当前累计未用时长大于累计未用下限时长的情况下,确定矿工节点竞争到记账权,以及用当前累计未用时长与累计未用下限时长的差更新当前累计未用时长,降低了区块链中公有链的电能消耗。
附图说明
通过阅读参照以下附图所作的对非限制性实施例所作的详细描述,本申请的其它特征、目的和优点将会变得更明显:
图1是本申请的一个实施例可以应用于其中的示例性系统架构图;
图2A是根据本申请的应用于区块链系统中矿工节点的共识方法的一个实施例的流程图;
图2B是图2A所示的流程图中步骤202的分解流程图;
图3是根据本申请的应用于区块链系统中矿工节点的共识方法的又一个实施例的流程图;
图4是根据本申请的区块链系统的一个实施例的示例性系统架构图;
图5A和图5B是根据本申请的区块链系统的一个实施例的时序图;
图5C是图5B所示的时序图中步骤508的分解流程图;
图6是根据本申请的应用于区块链系统中矿工节点的共识装置的一个实施例的结构示意图;
图7是适于用来实现本申请实施例的矿工节点的计算机系统的结构示意图。
具体实施方式
下面结合附图和实施例对本申请作进一步的详细说明。可以理解的是,此处所描述的具体实施例仅仅用于解释相关发明,而非对该发明的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与有关发明相关的部分。
需要说明的是,在不冲突的情况下,本申请中的实施例及实施例 中的特征可以相互组合。下面将参考附图并结合实施例来详细说明本申请。
图1示出了可以应用本申请的应用于区块链系统中矿工节点的共识方法或应用于区块链系统中矿工节点的共识装置的实施例的示例性系统架构100。
如图1所示,系统架构100可以包括矿工节点101、102、103和网络104。网络104用以在终端设备101、102、103之间提供通信链路的介质。网络104可以包括各种连接类型,例如有线、无线通信链路或者光纤电缆等等。
用户可以使用矿工节点101、102、103通过网络104与其他矿工节点交互,以接收或发送消息等。矿工节点101、102、103上可以安装有各种通讯客户端应用,例如区块链记账类应用、数字货币钱包类应用、网页浏览器应用、购物类应用、搜索类应用、即时通信工具、邮箱客户端、社交平台软件等。
矿工节点101、102、103可以是硬件,也可以是软件。当终端设备101、102、103为硬件时,可以是关联有可信执行环境(TEE,Trusted Execution Environment)的各种电子设备,包括但不限于智能手机、平板电脑、膝上型便携计算机和台式计算机等等。当矿工节点101、102、103为软件时,可以安装在上述所列举的电子设备中。其可以实现成多个软件或软件模块(例如用来提供区块链记账服务或者用来提供数字货币钱包服务),也可以实现成单个软件或软件模块。在此不做具体限定。
这里,TEE是与设备上的Rich OS(通常是Android等)并存的运行环境,并且给Rich OS提供安全服务。TEE具有其自身的执行空间。TEE所能访问的软硬件资源是与Rich OS分离的。TEE提供了可信应用(Trusted Application,TA)的安全执行环境,同时也保护可信应用的资源和数据的保密性,完整性和访问权限。为了保证TEE本身的可信根,TEE在安全启动过程中是要通过验证并且与Rich OS隔离的。在TEE中,每个可信应用是相互独立的,而且不能在未授权的情况下不能互相访问。
作为示例,矿工节点关联的TEE可以采用如下两种方式:
(1)、借助特定CPU芯片提供的安全防护能力,比如Intel SGX、ARM Trust Zone等,构造一个可信执行环境。
为了保障安全强度,还可以在可信执行环境底层增加可信硬件支持,比如采用符合可信平台模块(TPM,Trusted Platform Module)标准的安全芯片,或采用符合可信密码模块(TCM,Trusted Cryptography Module)标准的安全芯片。
(2)采用加密锁(俗称软件狗)实现可信执行环境。
常见的软件狗常包装成一个小巧的USB(Universal Serial Bus,通用串行总线)设备,软件狗内既提供文件存贮,也支持运行经过定制的程序。采用软件狗,可以不必限定矿工节点的设备类型,只要矿机节点有USB接口即可,降低了对矿工节点的设备要求。
系统架构100中的各个矿工节点组成区块链系统,且系统架构100中的各个矿工节点采用分布式数据区块链存储数据。
需要说明的是,本申请实施例所提供的应用于区块链系统中矿工节点的共识方法一般由矿工节点101、102、103执行,相应地,应用于区块链系统中矿工节点的共识装置一般设置于矿工节点101、102、103中。
应该理解,图1中的矿工节点和网络的数目仅仅是示意性的。根据实现需要,可以具有任意数目的矿工节点和网络。
继续参考图2A,其示出了根据本申请的应用于区块链系统中矿工节点的共识方法的一个实施例的流程200。该应用于区块链系统中矿工节点的共识方法,包括以下步骤:
步骤201,获取累计未用下限时长。
在本实施例中,共识方法的执行主体(例如图1所示的矿工节点)可以在竞争记账权的过程中获取预先确定的累计未用下限时长。这里,累计未用下限时长可以是由技术人员预先设置好的,也可以是上述执行主体根据矿工节点所竞争的区块而动态计算并更新后得到的。
步骤202,在矿工节点关联的可信执行环境中执行记账权确定操 作。
在本实施例的一些可选的实现方式中,矿工节点关联的可信执行环境可以设置在矿工节点中。
在本实施例的一些可选的实现方式中,矿工节点关联的可信执行环境也可以设置在与该矿工节点网络连接的其他电子设备中,该矿工节点通过消息通信机制与其关联的可信执行环境进行交互。
在本实施例中,上述执行主体可以在矿工节点关联的可信执行环境中执行记账权确定操作。这里,记账权确定操作可以包括如图2B所示的子步骤2021到子步骤2024:
子步骤2021,确定矿工节点的当前累计未用时长。
这里,上述执行主体可以关联有可信执行环境。可信执行环境中可以设置有时钟,可信执行环境中设置的时钟与上述执行主体的可信执行环境之外设置的时钟是不同的时钟。可信执行环境中设置的时钟只能被可信执行环境中的程序访问,不能被可信执行环境之外的程序所访问。
这样,上述执行主体可以在关联的可信执行环境中,采用各种实现方式,基于可信执行环境中设置的时钟的当前时间确定矿工节点的当前累计未用时长。
在本实施例中,矿工节点关联的可信执行环境在出厂之前可以被设置了当前累计未用时长的初始值。然后,在矿工节点竞争记账权的过程中,从开始竞争记账权到可信执行环境中设置的时钟的当前时间之间所经过/消逝的时长会累加到当前累计未用时长。例如,可以由可信执行环境中持续运行的处理过程(或称背景线程)控制“当前累计未用时长”的变化。又例如,还可以是在执行子步骤2021时,先确定从开始竞争记账权到可信执行环境中设置的时钟的当前时间之间所经过/消逝的时长,然后将所确定的时长累加到当前累计未用时长中。当然,仅仅让矿工节点关联的可信执行环境加电,而不去竞争记账权(俗称挖矿),可信执行环境中的“当前累计未用时长”是不会累加的。
在本实施例的一些可选的实现方式中,上述执行主体还可以在执行完子步骤2021之后,执行子步骤2022之前,确定矿工节点的当前 累计未用时长是否大于累计未用上限时长。如果确定大于,则将当前累计未用时长更新为累计未用上限时长。其中,累计未用上限时长可以是由技术人员凭经验人工设定的,累计未用上限时长也可以是累计未用下限时长与预设的大于1的系数的乘积。这样,可以确保当前累计未用时长小于等于上述累计未用上限时长,即,当前累计未用时长不至于过度累计。设置当前累计未用时长的上限可以提高安全性,因为不管什么原因(比如,软件有Bug),同一矿工节点连续获得记账权的次数会受限。
在本实施例的一些可选的实现方式中,可信执行环境的厂商可以对每个出厂的可信执行环境随机设置不同的当前累计未用时长的初始值。如果为每个出厂的可信执行环境设置了相同的当前累计未用时长的初始值,当可信执行环境被批量购买并同时开始竞争记账权,则可能导致在同一时间段内出现大量竞争到记账权的矿工节点,继而导致容易出现软分叉。
子步骤2022,确定当前累计未用时长是否大于累计未用下限时长。
在本实施例中,上述执行主体可以在关联的可信执行环境中确定当前累计未用时长是否大于累计未用下限时长。如果确定大于,则转到子步骤2023。
子步骤2023,确定矿工节点竞争到记账权。
在本实施例中,上述执行主体可以在可信执行环境中确定当前累计未用时长大于累计未用下限时长的情况下,确定矿工节点竞争到记账权。
可以理解的是,上述执行主体可以在确定竞争到记账权后,开始记账操作,记账操作可以在关联的可信执行环境之外进行。需要说明的是,这里,对于公有链区块链系统中的矿工节点,竞争到记账权之后的记账过程是目前广泛研究和应用的公知技术,在此不再赘述。
在执行完子步骤2023后,转到子步骤2024执行。
子步骤2024,用当前累计未用时长与累计未用下限时长的差更新当前累计未用时长。
在本实施例中,上述执行主体可以在确定竞争到记账权后,在关 联的可信执行环境中用当前累计未用时长与累计未用下限时长的差更新当前累计未用时长。即,竞争到记账权会使得当前累计未用时长消耗掉累计未用下限时长,继而保证区块链系统中各矿工节点公平竞争记账权。
在本实施例的一些可选的实现方式中,上述执行主体还可以在执行步骤202之前,获取待记账区块的上一区块的哈希值。这里,矿工节点的待记账区块的上一区块是指该矿工节点已保存到本地区块链中的最后一个已完成记账的区块,即最近完成记账的区块,该区块的哈希值可以通过查询本地区块链获得。
基于上述可选实现方式,在本实施例的一些可选的实现方式中,上述执行主体还可以在执行完子步骤2023之后,执行如下子步骤2025和子步骤2026:
子步骤2025,在矿工节点关联的可信执行环境中,将记账权确定信息利用可信执行环境中存储的预设私钥签名,得到记账权信息签名。
由于上述执行主体已经在子步骤2023中确定矿工节点竞争到记账权,这里,上述执行主体可以在矿工节点关联的可信执行环境中,将记账权确定信息利用可信执行环境中存储的预设私钥签名,得到记账权信息签名。其中,记账权确定信息可以包括:待记账区块的上一区块的哈希值、累计未用下限时长和矿工节点绑定的账号地址,其中,矿工节点绑定的账号地址存储在矿工节点关联的可信执行环境中。
这里,矿工节点关联的可信执行环境可以存储有预设密钥对,包括预设私钥和预设公钥,其中,预设私钥只存储在矿工节点关联的可信执行环境中,而预设公钥可以存储在矿工节点关联的可信执行环境中和矿工节点关联的可信执行环境之外。
可选地,记账权确定信息还可以包括存储在矿工节点关联的可信执行环境中的实名认证标识,这里,实名认证标识用于表征矿工节点关联的可信执行环境是否已通过第三方机构的实名认证。
这里,矿工节点的实名认证过程可以由第三方机构提供。认证通过后,第三方机构会为本次认证分配一个实名认证标识,并将该实名认证标识存储到被认证的可信执行环境中。该实名认证标识可用于查 询验证。比如,第三方机构可以提供一个供大众查询验证的网站,在该网站输入被认证的账号地址(即被认证的可信执行环境绑定的账号地址)与实名认证标识,上述网站就可以反馈信息用于指示该可信执行环境是否已通过实名认证。实践中,实名认证标识中可以包括提供实名认证的机构的机构代码。当上述区块链系统有多于一个第三方机构提供实名认证服务时,机构代码可用作区分各个不同的第三方机构。可以理解的是,第三方机构提供实名认证时,可以验证可信执行环境的归属主体的真实性,以及同一归属主体最多可以认证指定数目个(例如,一个)可信执行环境。严格实施矿工节点实名认证的区块链系统将具备更高的可信性与安全性,因为实名认证可有效保障记账过程的去中心化。第三方机构实名认证通过后,如何将实名认证标识安全地存储到被认证的可信执行环境是目前广泛研究和应用的现有技术,在此不再赘述。例如,可以让可信执行环境用预置的第三方机构的公钥对将实名认证标识存储到可信执行环境的相关存储指令的签名做验证,验证通过才允许存储。
子步骤2026,将记账权确定信息和记账权确定信息签名广播给矿工节点的相邻节点。
这里,上述执行主体已经在步骤2025中通过关联的可信执行环境对记账权确定信息进行了签名,那么上述执行主体可以将子步骤2025中所确定的记账权确定信息和记账权确定信息签名广播给该矿工节点的相邻节点。需要说明的是,上述执行主体可以在执行完子步骤2023后先执行子步骤2024再执行子步骤2025和子步骤2026,也可以在执行完子步骤2023后先执行子步骤2025和子步骤2026再执行子步骤2024,本申请对此不做具体限定。
需要说明的是,在可信执行环境中完成的步骤2021到2025,可以通过调用一次可信执行环境所提供的API完成,而不是调用多于一次API。在可信执行环境中通过一次API调用完成的步骤2021到2025可整体视作可信执行环境对外提供的一项服务。该服务可以随可信执行环境设备迁移至远程电子设备而被拉远。作为安全增强措施,矿工节点可以远程调用可信执行环境所提供的服务,其发起指令(包括参 数)与所得到调用结果需要加密,以防在消息通信环节被攻击者截获分析或伪造内容发起攻击(即,发起中间人攻击)。
在本实施例的一些可选的实现方式中,矿工节点关联的可信执行环境可以采用密文方式与外界交互。即,当矿工节点需要在可信执行环境中执行操作时,可以将所要执行的操作对应的待处理数据和相应的操作指令用预设管理员公钥进行加密后传输给可信执行环境。然后,可信执行环境可以用预设管理员私钥对所收到的数据进行解密,得到待处理数据和相应的操作指令。其次,可信执行环境解密得到的待处理数据执行相应的操作指令,并得到操作结果。最后,可信执行环境将所得到的操作结果进行加密后输出可信执行环境。
在一些实现方式中,可信执行环境对所得到的操作结果进行加密所用的密钥可以是解密得到的待处理数据中所包括的。
在一些实现方式中,可信执行环境对所得到的操作结果进行加密所用的密钥也可以是预先设置的。
作为示例,可信执行环境将所得到的操作结果进行加密后输出可信执行环境可以是输出给矿工节点的内存、磁盘,或者可以发送给与矿工节点网络连接的其他电子设备(例如,矿工节点的同链路由节点)。
基于上述可选实现方式,步骤202也可以如下进行:
首先,可以用预设管理员公钥对记账权确定操作对应的指令进行加密,得到加密指令。
然后,可以在矿工节点关联的可信执行环境中,用矿工节点关联的可信执行环境中存储的预设管理员私钥对所得到的加密指令进行解密,得到解密后的指令。
其次,执行解密后的指令以执行记账权确定操作,例如,记账权确定操作可以包括子步骤2021到子步骤2024。或者,记账权确定操作也可以包括子步骤2021到子步骤2026。
最后,将执行记账权确定操作的执行结果用矿工节点关联的可信执行环境中存储的预设密钥加密后输出矿工节点关联的可信执行环境。
实践中,可信执行环境除了提供记账权确定操作的服务,还可提供其它服务,比如实施特定签名、创建特定身份、生成随机数等。这 些服务也都可以按上述方式将传入的待处理数据和操作指令与传出的操作结果加密。在矿工节点关联的可信执行环境位于与矿工节点网络连接的其他电子设备中的情况下,密文态的通信过程会让可信执行环境的持有者无法有针对性接受一些服务调用,拒绝另一些服务调用,从而达到这种技术效果:可信执行环境提供的多项服务将捆绑提供。
在本实施例的一些可选的实现方式中,步骤202还可以如下进行:
响应于采用工作量证明共识机制进行哈希碰撞计算所用的随机数满足预设条件,在矿工节点关联的可信执行环境中执行记账权确定操作。即,需要先采用PoW进行哈希碰撞计算,并且哈希碰撞计算所用的随机数满足了预设条件的情况下才会去在确定矿工节点的当前累计未用时长是否大于累计未用下限时长。这里,区块链中的哈希碰撞计算,以及哈希碰撞计算所用的随机数是否满足预设条件是本领域广泛研究和应用的现有技术,在此不再赘述。作为示例,哈希碰撞计算所用的随机数满足预设条件可以包括:
首先,预先设定难度目标值target=targetmax/difficulty,其中,targetmax与预设的最大难度值,difficulty为动态可调的难度系数,难度系数越大,难度目标值越小。
然后,计算当前所竞争记账权的区块的哈希值,该哈希值会随着随机数Nonce的不同取值而不同。
接着,确定计算所得的哈希值是否小于上述难度目标值,如果小于上述难度目标值,则可以确定哈希碰撞计算所用的随机数Nonce满足预设条件。
这里,在确定矿工节点的当前累计未用时长是否大于累计未用下限时长之前,先采用PoW进行哈希碰撞计算,增强了区块链系统的安全性,其技术效果具体至少可以包括:
第一,如果攻击者已准备一定数量的矿工节点,虽然远未达到51%算力要求,但攻击者可以延后执行步骤202,即,暂时搁置记账权确定操作,让可信执行环境内的“当前累计未用时长”变的很长。当攻击者所控制的各个矿工节点的“累计未用时长”都很长时,攻击者可以让这些“累计未用时长”都很长矿工节点同时开始执行记账权确定 操作以竞争记账权,这种情况下,攻击者连续获得记账权的机率大大提高,变相制造51%算力。而如果在矿工节点关联的可信执行环境中执行记账权确定操作之前,叠加上述PoW共识机制,并将PoW限制在只用CPU实现,由于目前主流计算设备的CPU算力差别不大,而GPU(Graphics Processing Unit,图形处理单元)或ASIC(Application Specific Integrated Circuit,供专门应用的集成电路)的算力差距是指数级的,攻击者想用PoW连续获得记账权仍然很困难。这里,限用CPU实现PoW是本领的现有技术,比如改用浮点运算设计哈希算法(浮点运算在GPU上没有优势),再让计算过程依赖内存空间来抵抗ASIC芯片。因其技术细节不是本发明的技术重点,这里不展开介绍。
第二,可信执行环境的硬件由官方提供,如何让官方自己也不能作弊?叠加PoW共识机制,实际抬高了官方作弊的门槛,假设区块链系统中有1000个矿工节点,官方需动用1001台同等设备才能发起51%算力攻击,门槛很高。这种叠加PoW的双共识机制更容易获得公众的信任。
可以理解的是,作为矿工节点,除了可以向相邻节点广播记账权确定信息和记账权确定信息签名外,也可以收到其他矿工节点发来的记账权确定信息和记账权确定信息签名。因此,在本实施例的一些可选的实现方式中,上述执行主体还可以执行如下步骤203到步骤205:
步骤203,响应于接收到记账权确定信息和记账权确定信息签名,利用预设公钥对所收到的记账权确定信息进行签名验证。
这里,上述执行主体可以在接收到其他相邻节点广播来的记账权确定信息和记账权确定信息签名的情况下,在可信执行环境中或者可信执行环境之外利用预设公钥对所收到的记账权确定信息进行签名验证。
如果,所收到的记账权确定信息签名是利用预设私钥进行签名而得到的,利用预设公钥对所收到的记账权确定信息进行签名验证会验证通过。
如果,所收到的记账权确定信息签名不是利用预设私钥进行签名而得到的,利用预设公钥对所收到的记账权确定信息进行签名验证会 验证不通过。
如果,步骤203中签名验证通过,上述执行主体可以转到步骤204执行。
步骤204,分别利用矿工节点的区块链中的尾部区块的哈希值和累计未用下限时长对所收到的记账权确定信息中的上一区块哈希值和累计未用下限时长进行校验。
这里,上述执行主体可以在步骤203中对所收到的记账权确定信息和记账权确定信息签名进行签名验证通过的情况下,分别利用矿工节点的区块链中的尾部区块的哈希值和累计未用下限时长对所收到的记账权确定信息中的上一区块哈希值和累计未用下限时长进行校验。如果校验通过,表明发送所收到的记账权确定信息的矿工节点没有伪造记账权确定信息,接下来可以转到步骤205。如果校验不通过,表明发送所收到的记账权确定信息的矿工节点伪造了记账权确定信息。
这里,矿工节点的区块链中的尾部区块可以是矿工节点的尚未最终确认的区块(例如,尚未最终确认的区块可以是指该矿工节点的区块链中的后面的区块少于六个区块的区块)中某个区块。例如,矿工节点M1的尚未最终确定的区块有3个区块B1、B2和B3,区块B1、B2和B3的哈希值分别是H1、H2和H3,那么上述执行主体在执行步骤204时,可以将所收到的记账权确定信息中的上一区块哈希值分别与上述哈希值H1、H2和H3进行比较,如果哈希值H1、H2和H3中有一个哈希值与所收到的记账权确定信息中的上一区块哈希值相同,则可以确定对所收到的记账权确定信息中的上一区块哈希值校验通过。
步骤205,将所收到的记账权确定信息中的账号地址确定为竞争到第一当前区块的矿工节点绑定的账号地址。
这里,上述执行主体可以在步骤204中对所收到的记账权确定信息校验通过的情况下,将所收到的记账权确定信息中的账号地址确定为竞争到第一当前区块的矿工节点绑定的账号地址。其中,第一当前区块为所收到的记账权确定信息中上一区块哈希值所指示的区块的下一区块。
本申请的上述实施例提供的共识方法通过在矿工节点关联的可信 执行环境中确定矿工节点的当前累计未用时长大于累计未用下限时长的情况下,确定矿工节点竞争到记账权,即,通过采用一种按时长平均分配的机制,克服了公有链中采用工作量证明的共识机制所导致的高耗能缺陷。
进一步参考图3,其示出了根据本申请的应用于区块链系统中矿工节点的共识方法的又一个实施例的流程300。该共识方法的流程300,包括以下步骤:
步骤301,获取累计未用下限时长。
步骤302,在矿工节点关联的可信执行环境中执行记账权确定操作。
在本实施例中,步骤301和步骤302的具体操作与图2A所示的实施例中步骤201和步骤202的操作基本相同,在此不再赘述。
步骤303,响应于确定矿工节点竞争到记账权,根据矿工节点竞争到记账权的区块,确定是否调整累计未用下限时长。
在本实施例中,共识方法的执行主体(例如图1所示的矿工节点)可以在确定矿工节点竞争到记账权的情况下,根据矿工节点竞争到记账权的区块,确定是否调整累计未用下限时长。如果确定调整累计未用下限时长,则转到步骤304执行。
在公有链的区块链系统中,每个区块都可以用区块标识来唯一指示。这里,上述执行主体可以根据矿工节点竞争到记账权的区块的区块标识,确定是否调整累计未用下限时长。
在本实施例的一些可选的实现方式中,上述执行主体可以确定矿工节点竞争到记账权的区块的区块标识是否属于预设的调整累计未用下限时长用区块标识集合,如果属于,则可以确定调整累计未用下限时长。其中,预设的调整累计未用下限时长用区块标识集合可以是由技术人员根据经验预先制定的用于指示每个累计未用下限时长调整周期的最后一个区块的区块标识的集合。
在本实施例的一些可选的实现方式中,上述执行主体可以确定矿工节点竞争到记账权的区块和上次调整累计未用下限时长对应的区块 之间是否存在预设周期区块数目减1的差个区块,如果是,则可以确定调整累计未用下限时长。例如,预设周期区块数目为1008,即,每出块1008个区块,就调整累计未用下限时长。
步骤304,执行累计未用下限时长调整操作。
在本实施例中,上述执行主体可以在步骤303中确定调整累计未用下限时长的情况下,执行累计未用下限时长调整操作。这里,累计未用下限时长调整操作可以包括以下子步骤3041到子步骤3042:
子步骤3041,根据累计未用下限时长、调整周期实等时长和期望调整周期时长确定调整后累计未用下限时长。
在本实施例中,上述执行主体可以采用各种实现方式,根据累计未用下限时长、调整周期实等时长和期望调整周期时长确定调整后累计未用下限时长。
其中,调整周期实等时长为矿工节点竞争到记账权的区块的生成时间和矿工节点的区块链中上次调整累计未用下限时长对应的区块的生成时间之间的时长。即,调整周期实等时长为矿工节点相邻两次调整累计未用下限时长之间的实际等待时长。
这里,期望调整周期时长可以是技术人员根据经验预先设定的相邻两次调整累计未用下限时长之间的期望时长。例如,假设每出1008个区块调整一次累计未用下限时长,即,每1008次出块为一个调整周期,再假设预期平均每5分钟出一个区块块,那么可以将期望调整周期时长设定为:5040(即5×1008=5040)分钟。
由于区块链中矿工节点的数量是动态变化的,从而导致当矿工节点的数量在当前累计未用下限时长调整周期内有较大幅度的增加时,区块链的调整周期实等时长,即相邻两次调整累计未用下限时长之间的实际等待时长就会变短(因为有更多矿工节点参与竞争记账权,更容易在少于预期的时间内完成竞争),反之,当矿工节点的数量在当前累计未用下限时长调整周期内有较大幅度的减少时,调整周期实等时长,即相邻两次调整累计未用下限时长之间的实际等待时长就会变长。为了达到区块链系统尽量能在期望调整周期时长T内出预设数目N个区块,即,平均每t时长内出一个区块,其中,t=T÷N,调整后累计 未用下限时长可以与累计未用下限时长和期望调整周期时长均正相关,调整后累计未用下限时长可以与调整周期实等时长负相关。
可选地,可以按照如下公式,根据累计未用下限时长、调整周期实等时长和期望调整周期时长,计算调整后累计未用下限时长:
Figure PCTCN2019090356-appb-000001
其中:
T min是累计未用下限时长;
T exp是期望调整周期时长;
T real是调整周期实等时长;
T′ min是计算得到的调整后累计未用下限时长。
可选地,还可以按照如下公式,根据累计未用下限时长、调整周期实等时长和期望调整周期时长,计算调整后累计未用下限时长:
Figure PCTCN2019090356-appb-000002
其中:
T min是累计未用下限时长;
T exp是期望调整周期时长;
T real调整周期实等时长;
α、β、γ和θ是预设的常数;
T′ min是计算得到的调整后累计未用下限时长。
子步骤3042,将累计未用下限时长更新为调整后累计未用下限时长。
在本实施例中,上述执行主体可以将矿工节点的累积未用下限时长更新为子步骤3041中计算得到的调整后累计未用下限时长。
如果上述执行主体在执行步骤302的过程中,采用了图2A所示的实施例中叠加PoW共识机制的可选实现方式,则在本实施例的一些可选的实现方式中,上述执行主体还可以执行以下步骤305:
步骤305,执行哈希碰撞难度目标值调整操作。
这里,哈希碰撞难度目标值调整操作可以包括以下子步骤3051到子步骤3053:
子步骤3051,响应于确定矿工节点竞争到记账权,根据矿工节点 竞争到记账权的区块,确定是否调整哈希碰撞的难度目标值。
在本实施例的一些可选的实现方式中,上述执行主体可以确定矿工节点竞争到记账权的区块的区块标识是否属于预设的调整哈希碰撞难度目标值用区块标识集合,如果属于,则可以确定调整哈希碰撞的难度目标值。其中,预设的调整哈希碰撞难度目标值用区块标识集合可以是由技术人员根据经验预先制定的用于指示每个哈希碰撞难度目标值调整周期的最后一个区块的区块标识的集合。
在本实施例的一些可选的实现方式中,上述执行主体可以确定矿工节点竞争到记账权的区块和上次调整累计未用下限时长对应的区块之间是否存在预设周期区块数目减1的差个区块,如果是,则可以确定调整哈希碰撞难度目标值。例如,预设周期区块数目为1008,即,每出块1008个区块,就调整哈希碰撞难度目标值。
子步骤3052,响应于确定调整哈希碰撞的难度目标值,根据当前哈希碰撞的难度目标值、调整周期实等时长和期望调整周期时长确定调整后难度目标值。
这里,调整后难度目标值与当前哈希碰撞的难度目标值和调整周期实等时长均正相关,调整后难度目标值与期望调整周期时长负相关。具体的调整后难度目标值的计算方法与子步骤2041中描述的调整后累计未用下限时长的计算方法基本相同,在此不再赘述。
子步骤3053,将当前哈希碰撞的难度目标值更新为调整后难度目标值。
可以理解的是,上述区块链系统中采用PoET共识机制之后,是否再叠加PoW共识机制是可选的。如果选择不叠加PoW共识机制,则子步骤3051至3053可以省略。
从图3中可以看出,与图2A对应的实施例相比,本实施例中的应用于区块链系统中矿工节点的共识方法的流程300多出了对累计未用下限时长进行调整的步骤。由此,本实施例描述的方案可以达到的技术效果至少可以包括:在区块链中的矿工节点数量发生变化时,实时调整累计未用下限时长以适应矿工节点数量的动态变化,尽量确保区块链系统在预设期望周期时长内的出块数目维持在预设数目个。目 前将PoET共识机制应用于联盟链中,是借助CPU随机指定一个等待时长,以此替代工作量证明共识机制来竞争记账权,这种共识方法不能支持动态调整竞争记账权的难度。而图3中所示的应用于区块链系统中矿工节点的共识方法的流程300,可以通过调整累计未用下限时长来调整竞争记账权的难度。例如,调高累计未用下限时长,就加大了竞争记账权的难度,而调低累计未用下限时长,就降低了竞争记账权的难度。
下面参考图4,图4示出了根据本申请的区块链系统的一个实施例的示例性系统架构400。
如图4所示,系统架构400可以包括并行链401、402、403和网络404、405。
网络404用以在路由节点4011和路由节点4021之间提供通信链路的介质。网络404可以包括各种连接类型,例如有线、无线通信链路或者光纤电缆等等。
网络405用以在路由节点4021和路由节点4031之间提供通信链路的介质。网络404可以包括各种连接类型,例如有线、无线通信链路或者光纤电缆等等。
并行链401包括路由节点4011,矿工节点4012、4013、4014、4015和网络4016。网络4016用以在路由节点4011和矿工节点4012、4013、4014、4015之间提供通信链路的介质。网络4016可以包括各种连接类型,例如有线、无线通信链路或者光纤电缆等等。并行链401的矿工节点4012、4013、4014、4015采用分布式数据区块链存储数据。
并行链402包括路由节点4021,矿工节点4022、4023、4024和网络4025。网络4025用以在路由节点4021和矿工节点4022、4023、4024之间提供通信链路的介质。网络4025可以包括各种连接类型,例如有线、无线通信链路或者光纤电缆等等。并行链402的矿工节点4022、4023、4024采用分布式数据区块链存储数据。
并行链403包括路由节点4031,矿工节点4032、4033、4034、4035、4036和网络4037。网络4037用以在路由节点4031和矿工节点4032、 4033、4034、4035、4036之间提供通信链路的介质。网络4037可以包括各种连接类型,例如有线、无线通信链路或者光纤电缆等等。并行链403的矿工节点4032、4033、4034、4035、4036采用分布式数据区块链存储数据。
用户可以使用矿工节点4012、4013、4014、4015通过网络4016与路由节点4011交互,以接收或发送消息等。
用户也可以使用矿工节点4022、4023、4024通过网络4025与路由节点4021交互,以接收或发送消息等。
用户还可以使用矿工节点4022、4023、4024、4025、4036通过网络4037与路由节点4031交互,以接收或发送消息等。
矿工节点4012、4013、4014、4015、4022、4023、4024、4032、4033、4034、4035、4036上可以安装有各种通讯客户端应用,例如区块链记账类应用、数字货币钱包类应用、网页浏览器应用、购物类应用、搜索类应用、即时通信工具、邮箱客户端、社交平台软件等。用户可以使用矿工节点4012、4013、4014、4015、4022、4023、4024、4032、4033、4034、4035、4036上安装的数字货币钱包类应用,实现数字货币管理、转账、收款、查看余额、查看交易记录等操作。用户还可以使用矿工节点4012、4013、4014、4015、4022、4023、4024、4032、4033、4034、4035、4036上安装的区块链记账类应用,实现竞争矿工节点所在并行链的记账权以及实现记账操作。矿工节点4012、4013、4014、4015、4022、4023、4024、4032、4033、4034、4035、4036均绑定有账号地址(例如,可以采用数字货币钱包类应用来绑定账号地址)。
需要说明的是,路由节点4011、4021、4031可以是硬件,也可以是软件。当路由节点4011、4021、4031为硬件时,可以实现成多个服务器组成的分布式服务器集群,也可以实现成单个服务器。当路由节点4011、4021、4031为软件时,可以实现成多个软件或软件模块(例如用来提供路由服务),也可以实现成单个软件或软件模块。在此不做具体限定。
需要说明的是,矿工节点4012、4013、4014、4015、4022、4023、 4024、4032、4033、4034、4035、4036可以是硬件,也可以是软件。当矿工节点4012、4013、4014、4015、4022、4023、4024、4032、4033、4034、4035、4036为硬件时,可以实现成多个服务器组成的分布式服务器集群,也可以实现成单个服务器。当矿工节点4012、4013、4014、4015、4022、4023、4024、4032、4033、4034、4035、4036为软件时,可以实现成多个软件或软件模块(例如用来提供竞争记账权和记账服务),也可以实现成单个软件或软件模块。在此不做具体限定。
矿工节点4012、4013、4014、4015、4022、4023、4024、4032、4033、4034、4035、4036可以关联有可信执行环境,且矿工节点4012、4013、4014、4015、4022、4023、4024、4032、4033、4034、4035、4036可以实现图2A所示的实施例中的共识方法,也可以实现图3所示的实施例中的共识方法。需要说明的是,矿工节点关联的可信执行环境可以是设置在矿工节点中。或者,矿工节点关联的可信执行环境也可以设置在与该矿工节点网络连接的其他电子设备中。这样,矿工节点可以借助消息通信机制(比如TCP/IP)与其关联的可信执行环境进行交互。例如,对于USB接口形式的可信执行环境设备,业界有USB over Network等成熟技术,让插在与矿工节点网络连接的电子设备的USB端口的可信执行环境等效于插在矿工节点本机使用。
需要说明的是,在某些情况下,并行链中还可以包括SPV(Simplified Payment Verification,简化支付验证)节点,SPV节点上可以安装有各种通讯客户端应用,例如简化支付验证应用、数字货币钱包类应用、网页浏览器应用、购物类应用、搜索类应用、即时通信工具、邮箱客户端、社交平台软件等。用户可以使用SPV节点上安装的简化支付验证应用,实现数字货币管理、转账、收款、查看余额、查看交易记录等操作。
应该理解,图4中的并行链的数目仅仅是示意性的。根据实现需要,可以具有任意数目的并行链。每个并行链中的路由节点、矿工节点和网络的数目也仅仅是示意性的。根据实现需要,可以具有任意数目的路由节点、矿工节点和网络。
继续参考图5,其示出了根据本申请的区块链系统的一个实施例的时序500。
本申请实施例中的区块链系统可以包括至少一个并行链(例如图4所示的并行链401、402、403),并行链可以包括路由节点(例如图4所示的路由节点4011、4021、4031)和至少一个矿工节点(例如图4所示的矿工节点4012、4013、4014、4015、4022、4023、4024、4032、4033、4034、4035、4036),每个并行链的各个矿工节点采用分布式数据区块链存储数据,至少一个并行链的路由节点之间网络连接,
如图5所示,根据本申请的区块链系统的一个实施例的时序500可以包括以下步骤:
步骤501,矿工节点获取累计未用下限时长,以及在矿工节点关联的可信执行环境中执行记账权确定操作,以竞争该矿工节点所在并行链的链内交易请求的记账权。
在本实施例中,矿工节点可以采用如图2A所示的实施例中的共识方法或者采用如图3所示的实施例中的共识方法竞争该矿工节点所在并行链的链内交易请求的记账权。
在本实施例中,交易请求可以包括出账请求和入账请求。例如,交易请求D为将账号地址A中的X个数字货币转给账号地址B。那么交易请求D可以包括出账请求D1和入账请求D2,其中,出账请求D1为将账号地址A中的数字货币减少X个,入账请求D2为将账号地址B中的数字货币增加X个。实践中,为某账号地址增加或减少X个数字货币,反映到区块链软件实现时,可以表现为归属于该账号地址的所有UTXO(Unspent Transaction Output,未花费交易输出)所表达总额的增加或减少。
这里,该矿工节点所在并行链的链内交易请求具体可以包括以下两种情况:(1)交易请求中的转出账号地址和转入账号地址对应的并行链都是该矿工节点所在的并行链,那么交易请求中的出账请求和入账请求均为该矿工节点所在并行链的链内交易请求。(2)交易请求中的转出账号地址对应的并行链是该矿工节点所在的并行链,而交易请求中的转入账号地址对应的并行链不是该矿工节点所在的并行链,那 么交易请求中的出账请求是该矿工节点所在并行链的链内交易请求,而交易请求中的入账请求不是该矿工节点所在并行链的链内交易请求,交易请求中的入账请求是交易请求中的转入账号地址对应的并行链的链内交易请求。
继续延用上述举例,且,账号地址A对应并行链L1,账号地址B对应并行链L2,那么,出账请求D1为并行链L1的链内交易请求,而入账请求D2为并行链L2的链内交易请求。
需要说明的是,用户可以使用并行链中的SPV节点或者矿工节点提交交易请求,SPV节点或者矿工节点可以将所收到的交易请求发送给交易请求中的转出账号地址对应的并行链中的路由节点,路由节点可以将接收到的交易请求签名后广播给该路由节点的同链矿工节点。这样,矿工节点就可以接收到交易请求并采用如图2A所示的实施例中的任一种共识方法或者采用如图3所示的实施例中的任一种共识方法竞争该矿工节点所在并行链的链内交易请求的记账权。
实践中,每个账号地址都可以对应一个并行链,可以采用各种实现方式将账号地址对应到区块链系统所包括的并行链中的一个并行链。例如,可以在区块链系统所包括的并行链中随机选取一个并行链作为账号地址对应的并行链。矿工节点所在的并行链可以是矿工节点绑定的账号地址对应的并行链。
步骤502,路由节点实时将该路由节点的同链矿工节点的区块链同步到本地区块链。
在本实施例中,路由节点(例如,图1所示的路由节点4011、4021、4031)还会实时将该路由节点的同链矿工节点的区块链同步到本地区块链。也就是说,路由节点不会执行竞争记账权和记账的操作,但是,路由节点中同步保存了该路由节点所在并行链的区块链(账本)。
需要说明的是,路由节点可以随时执行步骤502,并不限定于在执行完步骤501之后再执行步骤502。
实践中,每个路由节点都可以对应一个并行链,可以采用各种实现方式将路由节点对应到区块链系统所包括的并行链中的一个并行链。例如,路由节点的域名可以与该路由节点所在并行链的并行链标识相 关联。比如,“routenode0.xxx.com”是并行链标识“0”所指示的并行链的路由节点的域名,“routenode1.xxx.com”是并行链标识“1”所指示的并行链的路由节点的域名,“routenode65535.xxx.com”是并行链标识“65535”所指示的并行链的路由节点的域名。
这里,该路由节点的同链矿工节点是与该路由节点属于同一并行链的矿工节点。例如,如图4所示,矿工节点4012、4013、4014、4015是路由节点4011的同链矿工节点。
在本实施例的一些可选的实现方式中,上述时序500还可以包括步骤503到步骤505:
步骤503,路由节点响应于接收到包括上一区块哈希值、累计未用下限时长和账号地址的记账权确定信息和记账权确定信息签名,利用预设公钥对所收到的记账权确定信息进行签名验证。
由于每个并行链通常是基于对等网络(Peer to Peer,P2P)的,在步骤501中,如果矿工节点向相邻节点发送了记账权确定信息和记账权确定信息签名(具体可参考图2B所示的实施例中子步骤2025),路由节点也是并行链中的一个节点,路由节点也可以接收到同链矿工节点发出的记账权确定信息和记账权确定信息签名。因此,路由节点可以在接收到同链矿工节点发出的记账权确定信息和记账权确定信息签名的情况下,利用预设公钥对所收到的记账权确定信息进行签名验证。
这里,路由节点中也存储有矿工节点关联的可信执行环境中存储的预设密钥对中的预设公钥。
如果,路由节点所收到的记账权确定信息签名是利用预设私钥进行签名而得到的,利用预设公钥对所收到的记账权确定信息进行签名验证会验证通过。
如果,路由节点所收到的记账权确定信息和记账权确定信息签名不是利用预设私钥进行签名而得到的,利用预设公钥对所收到的记账权确定信息进行签名验证会验证不通过。
这里,路由节点可以在步骤503中签名验证通过的情况下,转到步骤504执行。
步骤504,路由节点响应于对所收到的记账权确定信息进行签名 验证通过,分别利用该路由节点的区块链中的尾部区块的哈希值和该路由节点本地存储的累计未用下限时长对所收到的记账权确定信息中的上一区块哈希值和累计未用下限时长进行校验。
这里,路由节点可以在步骤503中利用预设公钥对所收到的记账权确定信息进行签名验证通过的情况下,分别利用该路由节点的区块链中的尾部区块的哈希值和该路由节点本地存储的累计未用下限时长对所收到的记账权确定信息中的上一区块哈希值和累计未用下限时长进行校验。如果校验通过,表明发送所收到的记账权确定信息的矿工节点没有伪造记账权确定信息,接下来可以转到步骤505。如果校验不通过,表明发送所收到的记账权确定信息的矿工节点伪造了记账权确定信息。
这里,路由节点的区块链中的尾部区块可以是路由节点的尚未最终确认的区块(例如,尚未最终确认的区块可以是指该路由节点的区块链中的后面的区块少于六个区块的区块)中某个区块。例如,路由节点R1的尚未最终确定的区块有3个区块B4、B5和B6,区块B4、B5和B6的哈希值分别是H4、H5和H6,那么路由节点在执行步骤504时,可以将所收到的记账权确定信息中的上一区块哈希值分别与上述哈希值H4、H5和H6进行比较,如果哈希值H4、H5和H6中有一个哈希值与所收到的记账权确定信息中的上一区块哈希值相同,则可以确定对所收到的记账权确定信息中的上一区块哈希值校验通过。
步骤505,路由节点响应于对所收到的记账权确定信息中的上一区块哈希值和累计未用下限时长进行校验通过,将所收到的记账权确定信息中的账号地址确定为竞争到第二当前区块的矿工节点绑定的账号地址。
这里,路由节点可以在步骤504中对所收到的记账权确定信息中的上一区块哈希值和累计未用下限时长进行校验通过的情况下,将所收到的记账权确定信息中的账号地址确定为竞争到第二当前区块的矿工节点绑定的账号地址。第二当前区块为所收到的记账权确定信息中上一区块哈希值所指示的区块的下一区块。
在本实施例的一些可选的实现方式中,上述时序500还可以包括 以下步骤506:
步骤506,路由节点响应于对所收到的记账权确定信息中的上一区块哈希值和累计未用下限时长进行校验不通过,将所收到的记账权确定信息中的账号地址添加到本地存储的黑名单账号地址集合。
这里,路由节点本地存储有黑名单账号地址集合。实践中,路由节点在接收到交易请求后,会对交易请求进行合法性校验。只有合法性校验通过的交易请求才会被路由节点签名后广播给该路由节点的各个同链矿工节点。其中,合法性校验可以包括但不限于验证交易请求中的转出账号地址是否存在UTXO记录、交易请求中的转出账号地址的余额是否支持本次交易请求、交易请求中的转出账号地址或者转入账号地址是否是路由节点中存储的黑名单账号地址集合中的账号地址等等。因此,这里,如果步骤504中路由节点对所收到的记账权确定信息中的上一区块哈希值和累计未用下限时长进行校验不通过,表明发送所收到的记账权确定信息的矿工节点伪造了记账权确定信息,那么就可以将收到的记账权确定信息中的账号地址加入该路由节点存储的黑名单账号地址集合,而黑名单账号地址集合中账号地址的转出交易请求和转入交易请求都会被路由节点在合法性校验中因合法性校验不通过而阻止。
由于页面显示限制,下面继续参考图5B,需要说明的是,图5B的流程除了包括图5B中所示的流程外,还可以包括图5A中所示的各个步骤。
实践中,矿工节点的奖励来自于两部分,一是竞争到记账权会有奖励,俗称挖矿奖励;二是记账奖励,也即,将矿工节点当前区块所记录的各个交易请求的奖励,俗称记账费(或者交易手续费,交易抽成)。但是,记账奖励部分的数值与时段有关,在交易量多的时段,记账奖励较多,在交易量少的时段,记账奖励就会较少。为了使得区块链系统更稳定,不受时段的影响,在本实施例的一些可选的实现方式中,上述时序500还可以包括图5B中所示的步骤507到步骤509:
步骤507,矿工节点根据该矿工节点竞争到记账权的区块,确定是否进入新的累计未用下限时长调整周期。
这里,矿工节点可以根据该矿工节点竞争到记账权的区块,确定是否进入新的累计未用下限时长调整周期。如果上一次调整累计未用下限时长时对应的区块与为矿工节点竞争到记账权的区块间隔了预设周期区块数目减1的差个区块,则矿工节点竞争到记账权的区块对应进入新的累计未用时长调整周期,矿工节点竞争到记账权的区块为进入新的累计未用时长调整周期的第一个区块,那么可以确定进入新的累计未用下限时长调整周期,接着转到步骤508执行,反之,可以确定未进入新的累计未用下限时长调整周期,接着转到步骤509执行。
在本实施例的一些可选的实现方式中,每个区块都可以用区块标识来指示,则矿工节点可以确定矿工节点竞争到记账权的区块的区块标识是否属于预设的新周期区块标识集合,如果属于,则可以确定进入新的累计未用下限时长调整周期。其中,预设的新周期区块标识集合可以是由技术人员根据经验预先制定的用于指示进入新的累计未用下限时长调整周期的第一个区块的区块标识的集合。例如,假设预设周期区块数目为1008,即,每出块1008个区块就调整累计未用下限时长,那么,假设区块标识为从0开始递增,那么新周期区块标识集合可以包括:0,1008,…,1008×n,这里n为正整数。
步骤508,矿工节点响应于确定进入新的累计未用下限时长调整周期,执行当期每区块记账奖励确定操作。
这里,矿工节点可以在步骤507中确定进入新的累计未用下限时长调整周期,执行当期每区块记账奖励确定操作,其中,当期每区块记账奖励确定操作可以包括如图5C中所示的子步骤5081到子步骤5084:
子步骤5081,获取该矿工节点的同链路由节点绑定的账号地址对应的数字货币余额。
这里,由于进入新的累计未用下限时长调整周期,而上一累计未用下限时长调整周期中所生成的各个区块中的交易请求中的记账奖励已经转入在该矿工节点的同链路由节点绑定的账号地址中。因此,矿工节点可以获取该矿工节点的同链路由节点绑定的账号地址对应的数字货币余额,这些所获取的数字货币余额可以用于平均分配给当前累 计未用下限时长调整周期内生成的各个区块对应的矿工节点。
子步骤5082,将获取的数字货币余额除以预设周期区块数目所得到的比值的整数部分确定为当期每区块记账奖励。
这里,如果直接将所获取的数字货币余额除以预设周期区块数目所得到的比值作为当期每区块记账奖励,则当期每区块记账奖励可能为整数也可能为浮点数。如果当期每区块记账奖励为浮点数,这里,由于不同矿工节点可能存在硬件结构上的差异,每个矿工节点在除法运算上的精度存在差异。为了避免因各个矿工节点硬件结构差异可能导致计算得到的当期每区块记账奖励的不同,这里,可以将获取的数字货币余额除以预设周期区块数目所得到的比值的整数部分确定为当期每区块记账奖励,这样,即使各个矿工节点的硬件存在差异,也可以保证计算所得的当期每区块记账奖励是相同的。
这里,当期每区块记账奖励用于表征在当前累计未用下限时长调整周期内新出的每个区块,对于竞争到该区块的记账权的矿工节点,针对为该区块记账的记账奖励是相同的,即,记账奖励是当期每区块记账奖励。这里,在当前累计未用下限时长调整周期内新出的每个区块的记账奖励,仅仅与上一累计未用下限时长调整周期内的区块中的各个交易请求的记账奖励总额有关,而与该区块所要记录的交易请求的记账奖励无关。这样,对于矿工节点而言,不论是在交易量大的时段竞争记账权,还是在交易量小的时段竞争记账权都会得到相同的记账奖励,不会导致在交易量小的时段竞争记账权的矿工节点数量大量减少的情况出现。
这里,预设周期区块数目是预设的每个累计未用下限时长调整周期内所生成的区块的数目,例如,预设周期区块数可以为1008。
子步骤5083,将当期每区块记账奖励与预设周期区块数目的积确定为当期待分配奖励。
为了更直观地描述子步骤5082和子步骤5083,可以用如下公式表达:
Figure PCTCN2019090356-appb-000003
U′=U a×N (4)
其中:
U为所获取的余额;
N为预设周期区块数目;
Figure PCTCN2019090356-appb-000004
为向下取整符号;
U a为计算得到的当期每区块记账奖励;
U′为计算得到的当期待分配奖励。
这里,当期待分配奖励用于表征在当前累计未用下限时长调整周期内新生成的各个区块的矿工节点共同分享的记账奖励总和。
子步骤5084,根据所选取的待处理交易请求、当期待分配奖励转出信息、当前区块奖励转入信息和当前区块奖励转出信息生成矿工节点竞争到记账权的区块的区块数据。
这里,矿工节点本地存储有待处理交易请求集合,由于该矿工节点已经竞争到记账权,这时,矿工节点就会从本地存储的待处理交易请求集合中选取待处理交易请求,并将所选取的待处理交易请求写入当前竞争到记账权的区块。除了将所选取的待处理交易请求写入当前竞争到记账权的区块外,由于当前竞争到记账权的区块为当前累计未用下限时长调整周期的第一个区块,还会在这个区块中写入当期待分配奖励转出信息、当前区块奖励转入信息和当前区块奖励转出信息,其中,当期待分配奖励转出信息用于表征从矿工节点的同链路由节点绑定的账号地址转出当期待分配奖励,当前区块奖励转入信息用于表征将当期每区块记账奖励转入该矿工节点绑定的账号地址,而当前区块奖励转出信息用于表征将所选取的待处理交易请求对应的记账奖励转入该矿工节点的同链路由节点绑定的账号地址。即,在当前累计未用下限时长调整周期的第一个区块记录了从矿工节点的同链路由节点绑定的账号地址转出当期待分配奖励,将当期每区块记账奖励转入该矿工节点绑定的账号地址,以及将所选取的待处理交易请求对应的记账奖励转入该矿工节点的同链路由节点绑定的账号地址。
步骤509,矿工节点响应于确定未进入新的累计未用下限时长调整周期,根据所选取的待处理交易请求、当前区块奖励转入信息和当前区块奖励转出信息生成矿工节点竞争到记账权的区块的区块数据。
这里,矿工节点可以在步骤507中确定未进入新的累计未用下限时长调整周期,表明矿工节点当前竞争到记账权的区块不是当前累计未用调整周期中的第一个区块。同理,由于该矿工节点已经竞争到记账权,这时,矿工节点就会从本地存储的待处理交易请求集合中选取待处理交易请求,并将所选取的待处理交易请求写入当前竞争到记账权的区块。除了将所选取的待处理交易请求写入当前竞争到记账权的区块外,当前竞争记账权的区块不是当前累计未用下限时长调整周期的第一个区块,不需要将当前待分配奖励转出该矿工节点的同链路由节点绑定的账户地址,但每个竞争到记账权的矿工节点都会获得当期每区块记账奖励,而且,所选取的待处理交易请求中每个交易请求都对应有记账奖励,需要把所选取的待处理交易请求对应的记账奖励转入该矿工节点的同链路由节点绑定的账号地址。因此,还会在这个区块中写入当前区块奖励转入信息和当前区块奖励转出信息,同上,这里当前区块奖励转入信息用于表征将当期每区块记账奖励转入该矿工节点绑定的账号地址,而当前区块奖励转出信息用于表征将所选取的待处理交易请求对应的记账奖励转入该矿工节点的同链路由节点绑定的账号地址。
由于PoW共识算法需基于完整的区块数据,包括待处理交易需已完成打包,这样才能确定在区块头中记录的默克尔树(Merkle Tree)的树根的哈希值。
因此,如果上述区块链系统选择采用PoET共识机制再叠加PoW共识机制作为共识机制,那么步骤507、步骤508和步骤509应在步骤501之前执行,即需要在执行记账权确定操作之前确定是否进入新的累计未用下限时长调整周期,并在确定进入新的累计未用下限时长调整周期的情况下,执行当期每区块记账奖励确定操作,以及在确定未进入新的累计未用下限时长调整周期的情况下,根据所选取的待处理交易请求、当前区块奖励转入信息和当前区块奖励转出信息生成矿工节点竞争到记账权的区块的区块数据。
反之,如果上述区块链系统只采用PoET共识机制,步骤507、步骤508和步骤509可以在步骤501之后执行。
在本实施例的一些可选的实现方式中,上述时序500还可以包括如下步骤510和步骤511:
步骤510,路由节点确定该路由节点的同一同链矿工节点相邻两次竞争到记账权的时间间隔。
这里,由于路由节点中同步了该路由节点的同链矿工节点的区块链,那么路由节点可以通过本地区块链来确定该路由节点的同一同链矿工节点相邻两次竞争到记账权的时间间隔。
步骤511,路由节点响应于累计未用下限时长减去所确定的时间间隔的时长差大于预设时长阈值,将所确定的时间间隔对应的矿工节点绑定的账号地址添加到黑名单账号地址集合。
这里,由于步骤510中路由节点以及确定了该路由节点的同一同链矿工节点相邻两次竞争到记账权的时间间隔,那么,在步骤511中路由节点可以首先计算累计未用下限时长减去所确定的时间间隔的时长差,然后确定上述计算所得的时长差是否大于预设时长阈值,如果大于预设时长阈值,表明步骤510中所确定的时间间隔较短,即,步骤510中所确定的时间间隔对应的矿工节点相邻两次竞争到记账权的时间间隔较短,也就是说,步骤510中所确定的时间间隔对应的矿工节点可能存在作弊行为,那么,路由节点可以将所确定的时间间隔对应的矿工节点绑定的账号地址添加到黑名单账号地址集合,进而,该所确定的时间间隔对应的矿工节点绑定的账号地址的转出交易请求和转入交易请求都会被路由节点在合法性校验中因合法性校验不通过而阻止。
步骤510和步骤511的技术效果至少包括:
第一,可以证明可信执行环境的设备商不会作弊。
第二,可以防止区块链系统的共识算法万一被破解而导致严重安全问题。破解内容可能是:通过破坏可信执行环境中的硬件时钟来缩短等待记账权的间隔时间,或者破解可信执行环境中存储的第一密钥对等。
进一步参考图6,作为对上述各图所示方法的实现,本申请提供 了一种应用于区块链系统中矿工节点的共识装置的一个实施例,该装置实施例与图2A所示的方法实施例相对应,该装置具体可以应用于各种电子设备中。
如图6所示,本实施例的应用于区块链系统中矿工节点的共识装置600包括:第一获取单元601和记账权确定单元602。其中,第一获取单元601,被配置成获取累计未用下限时长;而记账权确定单元602,被配置成在矿工节点关联的可信执行环境中执行以下记账权确定操作:确定矿工节点的当前累计未用时长;确定当前累计未用时长是否大于累计未用下限时长;响应于确定当前累计未用时长大于累计未用下限时长,确定矿工节点竞争到记账权,以及用当前累计未用时长与累计未用下限时长的差更新当前累计未用时长。
在本实施例中,应用于区块链系统中矿工节点的共识装置600的第一获取单元601和记账权确定单元602的具体处理及其所带来的技术效果可分别参考图2A对应实施例中步骤201和步骤202的相关说明,在此不再赘述。
在本实施例的一些可选的实现方式中,所述矿工节点关联有可信执行环境可以包括:所述矿工节点关联的可信执行环境设置在所述矿工节点中;或者所述矿工节点关联的可信执行环境设置在与所述矿工节点网络连接的其他电子设备中,所述矿工节点通过消息通信机制与其关联的可信执行环境进行交互。
在本实施例的一些可选的实现方式中,所述记账权确定操作还可以包括:响应于确定所述矿工节点竞争到记账权,根据所述矿工节点竞争到记账权的区块,确定是否调整所述累计未用下限时长;响应于确定调整所述累计未用下限时长,执行以下累计未用下限时长调整操作:根据所述累计未用下限时长、调整周期实等时长和期望调整周期时长确定调整后累计未用下限时长,所述调整周期实等时长为所述矿工节点竞争到记账权的区块的生成时间和所述矿工节点的区块链中上次调整所述累计未用下限时长对应的区块的生成时间之间的时长;以及将所述累计未用下限时长更新为所述调整后累计未用下限时长。
在本实施例的一些可选的实现方式中,所述调整后累计未用下限 时长可以与所述累计未用下限时长和所述期望调整周期时长均正相关,所述调整后累计未用下限时长可以与所述调整周期实等时长负相关。
在本实施例的一些可选的实现方式中,在所述矿工节点关联的可信执行环境中执行以下记账权确定操作之前,所述装置还可以包括第二获取单元603,被配置成获取待记账区块的上一区块的哈希值;以及在所述确定所述矿工节点竞争到记账权之后,所述记账权确定操作还可以包括:在所述矿工节点关联的可信执行环境中,将记账权确定信息利用所述可信执行环境中存储的预设私钥签名,得到记账权确定信息签名,其中,所述记账权确定信息包括:待记账区块的上一区块的哈希值、所述累计未用下限时长和所述矿工节点绑定的账号地址,所述矿工节点绑定的账号地址存储在所述矿工节点关联的可信执行环境中;将所述记账权确定信息和所述记账权确定信息签名广播给所述矿工节点的相邻节点。
在本实施例的一些可选的实现方式中,所述记账权确定信息还可以包括存储在所述矿工节点关联的可信执行环境中的实名认证标识,所述实名认证标识用于表征所述矿工节点关联的可信执行环境是否已通过第三方机构的实名认证。
在本实施例的一些可选的实现方式中,所述矿工节点关联的可信执行环境可以采用密文方式与外界交互;以及所述记账权确定单元602可以进一步被配置成:用预设管理员公钥对所述记账权确定操作对应的指令进行加密,得到加密指令;在所述矿工节点关联的可信执行环境中,用所述矿工节点关联的可信执行环境中存储的预设管理员私钥对所得到的加密指令进行解密,得到解密后的指令,以及执行所述解密后的指令以执行所述记账权确定操作;将执行所述记账权确定操作的执行结果用所述矿工节点关联的可信执行环境中存储的预设密钥加密后输出所述矿工节点关联的可信执行环境。
在本实施例的一些可选的实现方式中,所述装置600还可以包括:签名验证单元604,被配置成响应于接收到记账权确定信息与记账权确定信息签名,利用预设公钥对所收到的记账权确定信息进行签名验证;校验单元605,被配置成响应于对所收到的记账权确定信息进行 签名验证通过,分别利用所述矿工节点的区块链中的尾部区块的哈希值和所述累计未用下限时长对所收到的记账权确定信息中的上一区块哈希值和累计未用下限时长进行校验;确定单元606,被配置成响应于校验通过,将所收到的记账权确定信息中的账号地址确定为竞争到第一当前区块的矿工节点绑定的账号地址,其中,所述第一当前区块为所收到的记账权确定信息中上一区块哈希值所指示的区块的下一区块。
在一些实施例的一些可选的实现方式中,所述在确定所述矿工节点的当前累计未用时长之后,所述记账权确定操作还可以包括:响应于确定所述矿工节点的当前累计未用时长大于累计未用上限时长,将所述当前累计未用时长更新为所述累计未用上限时长。
需要说明的是,本申请实施例提供的应用于区块链系统中矿工节点的共识装置中各单元的实现细节和技术效果可以参考本申请中其它实施例的说明,在此不再赘述。
下面参考图7,其示出了适于用来实现本申请实施例的矿工节点的计算机系统700的结构示意图。图7示出的矿工节点仅仅是一个示例,不应对本申请实施例的功能和使用范围带来任何限制。
如图7所示,计算机系统700包括中央处理单元(CPU,Central Processing Unit)701,其可以根据存储在只读存储器(ROM,Read Only Memory)702中的程序或者从存储部分708加载到随机访问存储器(RAM,Random Access Memory)703中的程序而执行各种适当的动作和处理。在RAM 703中,还存储有系统700操作所需的各种程序和数据。CPU 701、ROM 702以及RAM 703通过总线704彼此相连。输入/输出(I/O,Input/Output)接口705也连接至总线704。
以下部件连接至I/O接口705:包括键盘、鼠标等的输入部分706;包括诸如阴极射线管(CRT,Cathode Ray Tube)、液晶显示器(LCD,Liquid Crystal Display)等以及扬声器等的输出部分707;包括硬盘等的存储部分708;以及包括诸如LAN(局域网,Local Area Network)卡、调制解调器等的网络接口卡的通信部分709。通信部分709经由 诸如因特网的网络执行通信处理。驱动器710也根据需要连接至I/O接口705。可拆卸介质711,诸如磁盘、光盘、磁光盘、半导体存储器等等,根据需要安装在驱动器710上,以便于从其上读出的计算机程序根据需要被安装入存储部分708。
特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信部分709从网络上被下载和安装,和/或从可拆卸介质711被安装。在该计算机程序被中央处理单元(CPU)701执行时,执行本申请的方法中限定的上述功能。需要说明的是,本申请所述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本申请中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本申请中,计算机可读的信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读的信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:无线、电线、光缆、RF等等,或者上述的任意合适的组合。
可以以一种或多种程序设计语言或其组合来编写用于执行本申请的操作的计算机程序代码,所述程序设计语言包括面向对象的程序设计语言—诸如Java、Smalltalk、C++、Python,还包括常规的过程式程序设计语言—诸如”C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。
附图中的流程图和框图,图示了按照本申请各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。
描述于本申请实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。所描述的单元也可以设置在处理器中,例如,可以描述为:一种处理器包括第一获取单元和记账权确定单元。其中,这些单元的名称在某种情况下并不构成对该单元本身的限定,例如,第一获取单元还可以被描述为“获取累计未用下限时长的单元”。
作为另一方面,本申请还提供了一种计算机可读介质,该计算机可读介质可以是上述实施例中描述的装置中所包含的;也可以是单独存在,而未装配入该装置中。上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该装置执行时,使得该装置:获 取累计未用下限时长;在上述矿工节点关联的可信执行环境中执行以下记账权确定操作:确定上述矿工节点的当前累计未用时长;确定上述当前累计未用时长是否大于上述累计未用下限时长;响应于确定上述当前累计未用时长大于上述累计未用下限时长,确定上述矿工节点竞争到记账权,以及用上述当前累计未用时长与上述累计未用下限时长的差更新上述当前累计未用时长。
以上描述仅为本申请的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本申请中所涉及的发明范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离上述发明构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本申请中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。

Claims (18)

  1. 一种应用于区块链系统中矿工节点的共识方法,其中,所述矿工节点关联有可信执行环境,所述方法包括:
    获取累计未用下限时长;
    在所述矿工节点关联的可信执行环境中执行以下记账权确定操作:确定所述矿工节点的当前累计未用时长;确定所述当前累计未用时长是否大于所述累计未用下限时长;响应于确定所述当前累计未用时长大于所述累计未用下限时长,确定所述矿工节点竞争到记账权,以及用所述当前累计未用时长与所述累计未用下限时长的差更新所述当前累计未用时长。
  2. 根据权利要求1所述的方法,其中,所述矿工节点关联有可信执行环境,包括:
    所述矿工节点关联的可信执行环境设置在所述矿工节点中;或者
    所述矿工节点关联的可信执行环境设置在与所述矿工节点网络连接的其他电子设备中,所述矿工节点通过消息通信机制与其关联的可信执行环境进行交互。
  3. 根据权利要求1所述的方法,其中,所述记账权确定操作还包括:
    响应于确定所述矿工节点竞争到记账权,根据所述矿工节点竞争到记账权的区块,确定是否调整所述累计未用下限时长;
    响应于确定调整所述累计未用下限时长,执行以下累计未用下限时长调整操作:根据所述累计未用下限时长、调整周期实等时长和期望调整周期时长确定调整后累计未用下限时长,所述调整周期实等时长为所述矿工节点竞争到记账权的区块的生成时间和所述矿工节点的区块链中上次调整所述累计未用下限时长对应的区块的生成时间之间的时长;以及将所述累计未用下限时长更新为所述调整后累计未用下限时长。
  4. 根据权利要求3所述的方法,其中,所述调整后累计未用下限时长与所述累计未用下限时长和所述期望调整周期时长均正相关,所述调整后累计未用下限时长与所述调整周期实等时长负相关。
  5. 根据权利要求4所述的方法,其中,在所述矿工节点关联的可信执行环境中执行以下记账权确定操作之前,所述方法还包括:
    获取待记账区块的上一区块的哈希值;以及
    在所述确定所述矿工节点竞争到记账权之后,所述记账权确定操作还包括:
    在所述矿工节点关联的可信执行环境中,将记账权确定信息利用所述可信执行环境中存储的预设私钥签名,得到记账权确定信息签名,其中,所述记账权确定信息包括:待记账区块的上一区块的哈希值、所述累计未用下限时长和所述矿工节点绑定的账号地址,所述矿工节点绑定的账号地址存储在所述矿工节点关联的可信执行环境中;
    将所述记账权确定信息和所述记账权确定信息签名广播给所述矿工节点的相邻节点。
  6. 根据权利要求5所述的方法,其中,所述记账权确定信息还包括存储在所述矿工节点关联的可信执行环境中的实名认证标识,所述实名认证标识用于表征所述矿工节点关联的可信执行环境是否已通过第三方机构的实名认证。
  7. 根据权利要求2-6中任一所述的方法,所述矿工节点关联的可信执行环境采用密文方式与外界交互;以及
    所述在所述矿工节点关联的可信执行环境中执行以下记账权确定操作,包括:
    用预设管理员公钥对所述记账权确定操作对应的指令进行加密,得到加密指令;
    在所述矿工节点关联的可信执行环境中,用所述矿工节点关联的 可信执行环境中存储的预设管理员私钥对所得到的加密指令进行解密,得到解密后的指令,以及执行所述解密后的指令以执行所述记账权确定操作;
    将执行所述记账权确定操作的执行结果用所述矿工节点关联的可信执行环境中存储的预设密钥加密后输出所述矿工节点关联的可信执行环境。
  8. 根据权利要求7所述的方法,其中,所述方法还包括:
    响应于接收到记账权确定信息与记账权确定信息签名,利用预设公钥对所收到的记账权确定信息进行签名验证;
    响应于对所收到的记账权确定信息进行签名验证通过,分别利用所述矿工节点的区块链中的尾部区块的哈希值和所述累计未用下限时长对所收到的记账权确定信息中的上一区块哈希值和累计未用下限时长进行校验;
    响应于校验通过,将所收到的记账权确定信息中的账号地址确定为竞争到第一当前区块的矿工节点绑定的账号地址,其中,所述第一当前区块为所收到的记账权确定信息中上一区块哈希值所指示的区块的下一区块。
  9. 根据权利要求8所述的方法,其中,所述在确定所述矿工节点的当前累计未用时长之后,所述记账权确定操作还包括:
    响应于确定所述矿工节点的当前累计未用时长大于累计未用上限时长,将所述当前累计未用时长更新为所述累计未用上限时长。
  10. 一种矿工节点,包括:
    一个或多个处理器;
    存储装置,其上存储有存储一个或多个程序;
    当所述一个或多个程序被所述一个或多个处理器执行时,使得所述一个或多个处理器实现如权利要求1-9中任一所述的方法。
  11. 一种计算机可读介质,其上存储有计算机程序,其中,所述程序被处理器执行时实现如权利要求1-9中任一所述的方法。
  12. 一种区块链系统,其中,所述区块链系统包括至少一个并行链,并行链包括路由节点和至少一个矿工节点,其中,所述至少一个并行链的路由节点之间网络连接,矿工节点绑定有账号地址,矿工节点被配置成采用如权利要求1-9中任一所述的方法竞争该矿工节点所在并行链的链内交易请求的记账权,路由节点被配置成:实时将该路由节点的同链矿工节点的区块链同步到本地区块链。
  13. 根据权利要求12所述的系统,其中,路由节点还被配置成:
    响应于接收到包括上一区块哈希值、累计未用下限时长、账号地址的记账权确定信息和记账权确定信息签名,利用预设公钥对所收到的记账权确定信息进行签名验证;
    响应于对所收到的记账权确定信息进行签名验证通过,分别利用该路由节点的区块链中的尾部区块的哈希值和该路由节点本地存储的累计未用下限时长对所收到的记账权确定信息中的上一区块哈希值和累计未用下限时长进行校验;
    响应于对所收到的记账权确定信息中的上一区块哈希值和累计未用下限时长进行校验通过,将所收到的记账权确定信息中的账号地址确定为竞争到第二当前区块的矿工节点绑定的账号地址,其中,所述第二当前区块为所收到的记账权确定信息中上一区块哈希值所指示的区块的下一区块。
  14. 根据权利要求13所述的系统,其中,路由节点还被配置成:
    响应于对所收到的记账权确定信息中的上一区块哈希值和累计未用下限时长进行校验不通过,将所收到的记账权确定信息中的账号地址添加到本地存储的黑名单账号地址集合。
  15. 根据权利要求14所述的系统,其中,矿工节点还被配置成:
    根据该矿工节点竞争到记账权的区块,确定是否进入新的累计未用下限时长调整周期;
    响应于确定进入新的累计未用下限时长调整周期,执行以下当期每区块记账奖励确定操作:获取该矿工节点的同链路由节点绑定的账号地址对应的数字货币余额;将获取的数字货币余额除以预设周期区块数目所得到的比值的整数部分确定为当期每区块记账奖励;将所述当期每区块记账奖励与所述预设周期区块数目的积确定为当期待分配奖励;根据所选取的待处理交易请求、当期待分配奖励转出信息、当前区块奖励转入信息和当前区块奖励转出信息生成所述矿工节点竞争到记账权的区块的区块数据,其中,所述当期待分配奖励转出信息用于表征从该矿工节点的同链路由节点绑定的账号地址转出所述当期待分配奖励,所述当前区块奖励转入信息用于表征将所述当期每区块记账奖励转入该矿工节点绑定的账号地址,所述当前区块奖励转出信息用于表征将所选取的待处理交易请求对应的记账奖励转入该矿工节点的同链路由节点绑定的账号地址;
    响应于确定未进入新的累计未用下限时长调整周期,根据所选取的待处理交易请求、所述当前区块奖励转入信息和所述当前区块奖励转出信息生成所述矿工节点竞争到记账权的区块的区块数据。
  16. 根据权利要求15所述的系统,其中,所述在所述矿工节点关联的可信执行环境中执行以下记账权确定操作,包括:
    响应于采用工作量证明共识机制进行哈希碰撞计算所用的随机数满足预设条件,在所述矿工节点关联的可信执行环境中执行所述记账权确定操作。
  17. 根据权利要求16所述的系统,其中,矿工节点还被配置成:
    执行以下哈希碰撞难度目标值调整操作:响应于确定所述矿工节点竞争到记账权,根据所述矿工节点竞争到记账权的区块,确定是否调整哈希碰撞的难度目标值;响应于确定调整所述哈希碰撞的难度目标值,根据所述当前哈希碰撞的难度目标值、调整周期实等时长和期 望调整周期时长确定调整后难度目标值,以及将所述当前哈希碰撞的难度目标值更新为所述调整后难度目标值。
  18. 根据权利要求17所述的系统,其中,路由节点还被配置成:
    确定该路由节点的同一同链矿工节点相邻两次竞争到记账权的时间间隔;
    响应于所述累计未用下限时长减去所确定的时间间隔的时长差大于预设时长阈值,将所确定的时间间隔对应的矿工节点绑定的账号地址添加到所述黑名单账号地址集合。
PCT/CN2019/090356 2018-07-10 2019-06-06 应用于区块链系统中矿工节点的共识方法和区块链系统 WO2020010972A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US17/144,353 US20210176058A1 (en) 2018-07-10 2021-01-08 Consensus method used for miner node in blockchain system and blockchain system

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810751530.8A CN110705973B (zh) 2018-07-10 2018-07-10 应用于区块链系统中矿工节点的共识方法和区块链系统
CN201810751530.8 2018-07-10

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US17/144,353 Continuation-In-Part US20210176058A1 (en) 2018-07-10 2021-01-08 Consensus method used for miner node in blockchain system and blockchain system

Publications (1)

Publication Number Publication Date
WO2020010972A1 true WO2020010972A1 (zh) 2020-01-16

Family

ID=69143272

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/090356 WO2020010972A1 (zh) 2018-07-10 2019-06-06 应用于区块链系统中矿工节点的共识方法和区块链系统

Country Status (3)

Country Link
US (1) US20210176058A1 (zh)
CN (1) CN110705973B (zh)
WO (1) WO2020010972A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111432027A (zh) * 2020-04-14 2020-07-17 杭州复杂美科技有限公司 平行链区块同步方法、设备和存储介质

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11736271B2 (en) * 2018-09-21 2023-08-22 Nec Corporation Method for signing a new block in a decentralized blockchain consensus network
US10949548B2 (en) * 2018-10-18 2021-03-16 Verizon Patent And Licensing Inc. Systems and methods for providing multi-node resiliency for blockchain peers
CN112749304B (zh) * 2019-10-31 2023-06-02 富泰华工业(深圳)有限公司 限制服务器算力的方法、服务器、存储介质
US11531980B2 (en) * 2019-12-06 2022-12-20 Mastercard International Incorporated Method and system for optimizing blockchain parsing using a wallet's static characteristics
CN111611311B (zh) * 2020-05-11 2023-09-08 徐皓 去中心化分布式数据库的形成方法及系统、电子设备及计算机可读存储介质
CN114553604B (zh) * 2022-04-26 2022-07-08 南京邮电大学 一种物联网终端节点访问控制方法
FR3138714A1 (fr) * 2022-08-05 2024-02-09 Commissariat A L'energie Atomique Et Aux Energies Alternatives Méthode de génération de preuve de temps écoulé entre évènements dans un réseau de nœuds asynchrones
CN116781370B (zh) * 2023-07-04 2024-04-05 深圳百流科技有限公司 一种信息安全的区块链跨境电商互交易系统及方法

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106296191A (zh) * 2016-08-13 2017-01-04 深圳市樊溪电子有限公司 一种区块链功耗感知的PoW共识机制
CN108009811A (zh) * 2017-11-30 2018-05-08 中国人民解放军国防科技大学 一种面向云际计算环境价值交换的跨链通信方法
CN108182636A (zh) * 2018-01-30 2018-06-19 杨显波 基于贡献的区块链共识机制

Family Cites Families (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140310243A1 (en) * 2010-08-16 2014-10-16 Mr. Steven James McGee Heart beacon cycle
US20150363481A1 (en) * 2012-09-06 2015-12-17 Michael N. Haynes Systems, Devices, and/or Methods for Managing Information
US10291627B2 (en) * 2016-10-17 2019-05-14 Arm Ltd. Blockchain mining using trusted nodes
CN106452884B (zh) * 2016-10-21 2019-06-25 北京云图科瑞科技有限公司 区块链系统中的数据分配方法及装置
US10812270B2 (en) * 2017-04-07 2020-10-20 Citizen Hex Inc. Techniques for increasing the probability that a transaction will be included in a target block of a blockchain
CN107172135A (zh) * 2017-05-03 2017-09-15 施瑞琦 基于区块链的收视率统计方法及系统
CN107231351B (zh) * 2017-05-25 2021-01-08 远光软件股份有限公司 电子证件的管理方法及相关设备
EP3655905B1 (en) * 2017-07-17 2021-08-11 Radix DLT Limited Distributed ledger technology
CN107317730B (zh) * 2017-08-21 2020-09-04 上海点融信息科技有限责任公司 用于监控区块链节点状态的方法、设备和系统
CN107733651B (zh) * 2017-09-11 2020-06-19 联动优势科技有限公司 一种区块链生成方法、节点及系统
CN107832139A (zh) * 2017-09-26 2018-03-23 上海点融信息科技有限责任公司 用于管理区块链节点的计算资源的方法、设备和系统
CN108182581B (zh) * 2017-12-29 2020-08-11 北京欧链科技有限公司 一种区块链的记账方法及装置

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106296191A (zh) * 2016-08-13 2017-01-04 深圳市樊溪电子有限公司 一种区块链功耗感知的PoW共识机制
CN108009811A (zh) * 2017-11-30 2018-05-08 中国人民解放军国防科技大学 一种面向云际计算环境价值交换的跨链通信方法
CN108182636A (zh) * 2018-01-30 2018-06-19 杨显波 基于贡献的区块链共识机制

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111432027A (zh) * 2020-04-14 2020-07-17 杭州复杂美科技有限公司 平行链区块同步方法、设备和存储介质
CN111432027B (zh) * 2020-04-14 2023-04-14 杭州复杂美科技有限公司 平行链区块同步方法、设备和存储介质

Also Published As

Publication number Publication date
US20210176058A1 (en) 2021-06-10
CN110705973A (zh) 2020-01-17
CN110705973B (zh) 2023-05-16

Similar Documents

Publication Publication Date Title
WO2020010972A1 (zh) 应用于区块链系统中矿工节点的共识方法和区块链系统
CN110999255B (zh) 检索区块链网络的访问数据的方法及装置
CN111066287B (zh) 使用可信执行环境检索区块链网络的公开数据
JP6873270B2 (ja) ブロックチェーンにおけるスマートコントラクトに基づくトランザクション活動の取扱注意データを保護するための方法及びデバイス
US10740754B2 (en) Telecommunication system and method for settling session transactions
KR102074116B1 (ko) 블록체인 노드 통신 방법 및 장치
US10805085B1 (en) PKI-based user authentication for web services using blockchain
WO2020143431A1 (zh) 记账方法、矿池服务器、终端设备、挖矿节点及矿池
US20230208630A1 (en) Credential generation and distribution method and system for a blockchain network
US9867043B2 (en) Secure device service enrollment
US20200204530A1 (en) Self-encrypting key management system
US9887838B2 (en) Method and device for secure communications over a network using a hardware security engine
KR20200116012A (ko) 다중키 쌍 시그너처를 사용한 프로그램 실행 및 데이터 증명 체계
JP2020524421A (ja) トラステッド実行環境のための分散型鍵管理
WO2021169107A1 (zh) 一种网络身份保护方法、装置及电子设备和存储介质
WO2019242508A1 (zh) 区块链系统和应用于区块链系统的路由节点的路由方法
US10728238B2 (en) Systems and methods encrypting messages using multiple certificates
US10536271B1 (en) Silicon key attestation
KR20160095720A (ko) 암호화 화폐의 거래를 보호하는 방법 및 장치
RU2008144205A (ru) Устройство и способ защищенной передачи данных
CN113039544A (zh) 应用程序完整性证实
CN107707518B (zh) 用于基于事务的消息安全性的设备及方法
JP2022534677A (ja) ブロックチェーンを使用するオンラインアプリケーションおよびウェブページの保護
US9185113B2 (en) Method and apparatus for remote connection
WO2022227799A1 (zh) 设备注册方法及装置、计算机设备、存储介质

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: 19834383

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: 19834383

Country of ref document: EP

Kind code of ref document: A1