CN110011974B - Accounting method and device of block chain, terminal and computer-readable storage medium - Google Patents

Accounting method and device of block chain, terminal and computer-readable storage medium Download PDF

Info

Publication number
CN110011974B
CN110011974B CN201910171582.2A CN201910171582A CN110011974B CN 110011974 B CN110011974 B CN 110011974B CN 201910171582 A CN201910171582 A CN 201910171582A CN 110011974 B CN110011974 B CN 110011974B
Authority
CN
China
Prior art keywords
random number
block casting
node
local node
block
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN201910171582.2A
Other languages
Chinese (zh)
Other versions
CN110011974A (en
Inventor
杜力
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Gangrong Technology Co ltd
Original Assignee
Gangrong Technology Co ltd
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 Gangrong Technology Co ltd filed Critical Gangrong Technology Co ltd
Priority to CN201910171582.2A priority Critical patent/CN110011974B/en
Publication of CN110011974A publication Critical patent/CN110011974A/en
Application granted granted Critical
Publication of CN110011974B publication Critical patent/CN110011974B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • 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/0861Generation of secret information including derivation or calculation of cryptographic keys or passwords
    • H04L9/0869Generation of secret information including derivation or calculation of cryptographic keys or passwords involving random numbers or seeds
    • 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

Abstract

The invention belongs to the technical field of block chains, and particularly relates to a block chain accounting method, a block chain accounting device, a block chain accounting terminal and a computer-readable storage medium. The accounting method comprises the following steps: the local node generates a random number and broadcasts the random number to other nodes in the block chain network; the method comprises the steps that a local node receives random number information broadcasted by other nodes, caches and continuously broadcasts the random number, then sorts the received random number and the random number generated by the local node to obtain an initial random number ranking list, and then broadcasts the initial random number ranking list to the other nodes to obtain a random number ranking list identified by the whole network; the local node determines the block casting time slice to which the local node belongs in the current time period according to the random number ordered list known by the whole network, and performs block casting when the block casting time slice is reached; the method effectively avoids the waste of calculation power, avoids the problem of calculation power concentration, and improves the stability of the block chain network.

Description

Accounting method and device of block chain, terminal and computer-readable storage medium
Technical Field
The invention belongs to the technical field of block chains, and particularly relates to a block chain accounting method, a block chain accounting device, a block chain accounting terminal and a computer-readable storage medium.
Background
The block chain is a chain data structure formed by combining data blocks in a sequential connection mode according to a time sequence, and is a distributed account book which is guaranteed in a cryptographic mode and cannot be tampered and forged. One core technology of the blockchain is a consensus mechanism, i.e., a method for achieving consensus among all nodes and identifying the validity of a record.
Currently, the typical blockchain consensus mechanism mainly includes a Proof of workload (Proof of Power, PoW) algorithm and a Proof of rights (Proof of stamp, PoS) algorithm. However, in the PoW algorithm, since all miners (nodes) in the whole network are invested in the calculation blocks of the calculation power, only the blocks of one miner finally become the consensus in the whole network, and a large amount of calculation power is easily wasted. Although the PoS algorithm is not wasteful of computing power, because the election of founders is performed in a manner of pledging digital money, the probability that a node with a large amount of money becomes a founder is high, which may cause a problem that computing power is concentrated in the network, and stability of the blockchain network is reduced.
Disclosure of Invention
In view of this, embodiments of the present invention provide a block chain accounting method, an apparatus, a terminal, and a computer-readable storage medium, which can solve the technical problems of wasted computation and concentrated computation of a block chain consensus mechanism in the prior art.
A first aspect of an embodiment of the present invention provides a block chain accounting method, including:
a local node generates a random number and broadcasts random number information carrying the random number and node identification information of the local node to other nodes in a block chain network; meanwhile, the local node receives random number information broadcasted by other nodes and rebroadcasts the received random number information so that each node in the block chain network can receive the random number information of all nodes in the block chain network;
the local node sorts the random numbers in the received random number information and the random numbers generated by the local node to obtain an initial random number ranking list carrying node identification information, and then broadcasts the initial random number ranking list to other nodes to obtain a random number ranking list identified by the whole network;
and the local node determines the block casting time slice to which the local node belongs in the current time period according to the random number ordered list known by the whole network, and performs block casting when the block casting time slice is reached.
A second aspect of the embodiments of the present invention provides an accounting device for a block chain, including:
a random number generation module, configured to generate a random number by a local node, and broadcast random number information carrying the random number and node identification information of the local node to other nodes in a blockchain network; meanwhile, the local node receives random number information broadcasted by other nodes and rebroadcasts the received random number information so that each node in the block chain network can receive the random number information of all nodes in the block chain network;
a random number ranking list generating module, configured to sequence, by the local node, the random numbers in the received random number information and the random numbers generated by the local node to obtain an initial random number ranking list carrying node identification information, and then, the local node broadcasts the initial random number ranking list to the other nodes to obtain a random number ranking list that is commonly identified through the entire network;
and the block casting module is used for determining the block casting time slice to which the local node belongs in the current time period according to the random number ordered list known by the whole network, and performing block casting when the block casting time slice is reached.
A third aspect of embodiments of the present invention provides a terminal, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of the method according to the first aspect when executing the computer program.
A fourth aspect of the embodiments of the present invention provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the computer program implements the steps of the method according to the first aspect.
In the embodiment of the invention, the block casting time slices are distributed before the block casting is carried out on each node in the block chain network, so that each node only needs to carry out the block casting in the corresponding block casting time slice, and does not need to carry out the block casting at all times, namely, in one block casting time slice, all nodes in the whole network do not need to be invested in the calculation of new blocks, and the waste of calculation power is effectively avoided; meanwhile, in the embodiment of the application, the random numbers are generated by all the nodes in the block chain network, and the block casting time slices to which all the nodes belong in the current time period are determined in a mode of obtaining the random number ranking list identified by the whole network, so that the block casting time slices have high randomness, each node has an opportunity to perform block casting, the problem of calculation power concentration cannot occur, and the stability of the block chain network is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
Fig. 1 is a schematic flow chart of a first implementation of a block chain accounting method according to an embodiment of the present invention;
fig. 2 is a flowchart illustrating an implementation of step 103 of a block chain accounting method according to an embodiment of the present invention;
fig. 3 is a flowchart illustrating a second implementation of a method for accounting for a blockchain according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an accounting apparatus for a block chain according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a terminal according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. It will be apparent to one skilled in the art that the present invention may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present invention with unnecessary detail.
In order to explain the technical means of the present invention, the following description will be given by way of specific examples.
Common blockchain applications today are bitcoin items and etherhouse items. The consensus mechanisms used by these two projects include the PoW consensus algorithm and the PoS algorithm. However, both PoW and PoS algorithms have their inherent disadvantages. For example, for the PoW algorithm, since all miners in the whole network invest the calculation capacity calculation blocks, and finally only one block of miners becomes the common knowledge in the whole network, a large amount of calculation capacity is easily wasted; although the PoS algorithm is not wasteful of computing power, because the election of founders is performed in a manner of pledging digital money, the probability that a node with a large amount of money becomes a founder is high, which may cause a problem that computing power is concentrated in the network, and stability of the blockchain network is reduced.
In the embodiment of the invention, the block casting time slices are distributed before the block casting is carried out on each node in the block chain network, so that each node only needs to carry out the block casting in the corresponding block casting time slice, and does not need to carry out the block casting at all times, namely, in one block casting time slice, all nodes in the whole network do not need to be invested in the calculation of new blocks, and the waste of calculation power is effectively avoided; meanwhile, in the embodiment of the application, the random numbers are generated by all the nodes in the block chain network, and the block casting time slices to which all the nodes belong in the current time period are determined in a mode of obtaining the random number ranking list identified by the whole network, so that the block casting time slices have high randomness, each node has an opportunity to perform block casting, the problem of calculation power concentration cannot occur, and the stability of the block chain network is improved.
Fig. 1 shows a flowchart of a first implementation of a block chain accounting method provided by an embodiment of the present invention. The method is applied to a terminal (node of a block chain), and can be executed by a block chain accounting device configured on the terminal, and the block chain accounting device can be realized by means of hardware and/or software. The billing method may include steps 101 to 103.
Step 101, a local node generates a random number and broadcasts random number information carrying the random number and node identification information of the local node to other nodes in a block chain network; meanwhile, the local node receives random number information broadcasted by other nodes and rebroadcasts the received random number information so that each node in the block chain network can receive the random number information of all nodes in the block chain network.
It should be noted that, since the nodes in the blockchain network have the same status, the blockchain network performs block casting according to the same rule. Therefore, in the embodiment of the present application, the workflow of the local node may be regarded as the workflow of the whole blockchain network, and similarly, the workflow of the whole blockchain network may also be regarded as the workflow that the local node needs to execute. For example, when the local node executes the process of generating the random number, the other nodes in the blockchain network except the local node also execute the process of generating the random number in the same manner.
The local node and other nodes in the block chain network may be intelligent terminal devices such as computers and servers.
The random number generated by the local node may be a fixed byte length random number. For example, a random number of 4 bytes in length.
The node identification information may be a MAC address, name, or serial number of the node, and is used to uniquely identify the node in the block chain network.
And 102, the local node sequences the random numbers in the received random number information and the random numbers generated by the local node to obtain an initial random number sequence list carrying node identification information, and then broadcasts the initial random number sequence list to other nodes to obtain a random number sequence list identified by the whole network.
In the embodiment of the invention, the block chain is a chain data structure formed by combining data blocks in a sequential connection mode according to a time sequence, and is a distributed account book which is cryptographically guaranteed to be not falsifiable and counterfeitable. When accounting (i.e. block casting) is performed by each node in the block chain, the acquisition of accounting rights is required.
In the embodiment of the present invention, when each node acquires the accounting right, a random number is generated first, and random number information carrying the random number and node identification information of the node is broadcasted to other nodes in the blockchain network, and at the same time, the local node receives the random number information broadcasted by other nodes and rebroadcasts the received random number information, so that each node in the blockchain network can receive the random number information of all nodes in the blockchain network, and further each node in the blockchain network can perform random number sequencing according to the random numbers generated by each node in the blockchain network, thereby obtaining an initial random number sequencing list carrying the node identification information. And then, each node in the block chain network broadcasts the initial random number ordered list to other nodes in the block chain network so as to obtain a random number ordered list which is identified by the whole network. The random number ordered list may be a random number ordered list obtained by ordering the random numbers in a descending manner, or may be a random number ordered list obtained by ordering the random numbers in a descending manner.
Specifically, the step of broadcasting, by the local node, the initial random number ordered list to other nodes in the blockchain network to obtain a random number ordered list that is identified by the whole network may be: the local node broadcasts the initial random number sequence list to other nodes in the block chain network, then the local node receives the initial random number sequence list broadcasted by other nodes, compares the received initial random number sequence list with the initial random number sequence list generated by the local node, broadcasts the received initial random number sequence list again if the comparison is successful, compares the received next initial random number sequence list with the initial random number sequence list generated by the local node if the comparison is unsuccessful, and takes the received initial random number sequence list as a random number sequence list commonly identified by the whole network until the common identification time is over.
In the embodiment of the application, each node in the block chain network compares the received initial random number sequence list with the initial random number sequence list generated by the node in the block chain network, and does not broadcast the received initial random number sequence list when the comparison is unsuccessful, and broadcasts the received initial random number sequence list again when the comparison is successful, so that the initial random number sequence list received by the node in the block chain network is a random number sequence list identified by the whole network when the identification time is over.
And 103, determining the block casting time slice to which the local node belongs in the current time period according to the random number ordered list known by the whole network, and performing block casting when the block casting time slice is reached.
In the embodiment of the invention, after the random number ordered list identified by the whole network is obtained, the block casting time slice to which each block chain node in the block chain network belongs in the current time period can be determined.
For example, with a period of one week as a time period, after obtaining a random number ordered list identified by the whole network, each node may be assigned its own block casting time slice in one week according to the ordering order of the nodes corresponding to the random number ordered list, for example, the block casting time of node a is 8: 00-8: 10, Block casting time for node B was 8:10-8 on Monday: 20; by analogy, each node only needs to perform block casting in the corresponding block casting time slice, and does not need to perform block casting at every moment, so that the waste of calculation power is effectively avoided; meanwhile, in the embodiment of the application, the random numbers are generated by all the nodes in the block chain network, and the block casting time slices to which all the nodes belong in the current time period are determined in a mode of obtaining the random number ranking list identified by the whole network, so that the block casting time slices have high randomness, each node has an opportunity to perform block casting, the problem of calculation power concentration cannot occur, and the stability of the block chain network is effectively improved.
It should be noted that the time period may also be 1 day, 2 days, 3 days, or 10 days, which is not limited in this invention, and for convenience of description, in the embodiment of the present application, 7 days (one week) is taken as an example for illustration.
Optionally, as shown in fig. 2, in the step 103, the determining, by the local node, a block casting time slice in the current time period according to the ordered list of random numbers identified through the whole network, and performing block casting when the block casting time slice is reached may further include: step 201 to step 203.
And step 201, the local node groups the nodes in the block chain network according to the random number ordered list known by the whole network, and determines the block casting time period of each group in the current time period.
And step 202, the local node determines the block casting sequence of each node in the grouping according to the random number sequencing sequence of each node in the grouping.
And step 203, when the grouped block casting time period to which the local node belongs is reached, the local node performs periodical block casting time slice waiting according to the block casting sequence of each node in the group in the grouped block casting time period to which the local node belongs, and performs block casting in the block casting time slice with successful waiting.
That is, when the local node determines the block casting time slice in the current time period according to the random number ordered list identified through the whole network, all nodes in the block chain network are grouped according to the random number ordered list identified through the whole network, the block casting time period of each group in the current time period is determined, then the group to which the local node belongs is determined according to a specific grouping situation, the block casting sequence in the group is determined, when the block casting time period of the group to which the local node belongs is reached, the local node performs the rotation of the block casting time slice according to the block casting sequence of each node in the group in the block casting time period of the group to which the local node belongs, and performs the block casting in the block casting time slice with successful rotation.
Specifically, for example, assuming that the blockchain network includes 15 nodes, that is, a node a-node O, the block casting time period is one week, the block casting time period of each group is one day, the block casting time slice of each node is 10 minutes, and the local node is a node C, when block casting is performed, the node a-node O may first generate random numbers respectively, and broadcast random number information carrying the random numbers and node identification information of the nodes to other nodes in the blockchain network; then, the nodes A-O respectively receive random number information broadcasted by other nodes, and sort the random numbers in the received random number information and the random numbers generated by the local nodes to obtain an initial random number sorting list carrying node identification information; then, the nodes a to O respectively broadcast the initial random number sequence list generated by each node to the other nodes to obtain a network-wide consensus random number sequence list, for example, the network-wide consensus random number sequence list is: node A, node D, node N, node K, node F, node H, node I, node M, node G, node L, node J, node O, node C, node B, and node E. Then, all nodes in the block chain network are grouped according to the random number ordered list identified by the whole network, for example, the following 7 groups are grouped together:
the first group is: node A, node D;
the second group is: node N, node K;
the third group is: node F, node H;
the fourth group is: node I, node M;
the fifth group is: node G, node L;
the sixth group is: node J, node O;
the seventh group is: node C, node B, node E;
and the block casting time period within the current time period of each group is a day of the week, for example, the block casting time period within the current time period of each group is determined as: first group monday, second group tuesday, third group wednesday, fourth group thursday, fifth group friday, sixth group saturday, seventh group sunday.
Finally, each node determines the block casting sequence of each node in the grouping according to the random number sequencing sequence of each node in the grouping; when the block casting time period of the group to which each node belongs is reached, each node performs periodical waiting of the block casting time slices according to the block casting sequence of each node in the group in the block casting time period of the group to which the node belongs, and performs block casting in the block casting time slices in which the waiting is successful.
For example, when node C arrives at tuesday, it first block casts at the first block cast time slice 8:00:8:10, then waits for node B to block cast at its block cast time slice 8:10:8:20, and after waiting for node E to block cast at its block cast time slice 8:20:8:30, node C performs block casts at its block cast time slice 8:30:8:40, and so on. Such that each node only needs to be block cast within the corresponding block casting time slice.
Optionally, in step 203, the periodically waiting for the block casting time slices according to the block casting sequence of each node in the group by the local node during the block casting time period of the group to which the local node belongs includes: when the local node carries out periodical waiting of the block casting time slices according to the block casting sequence of each node in the group in the block casting time period of the group to which the local node belongs, if the number of times that the previous node of the local node does not successfully finish the block casting is greater than the preset number of times or the generated blocks are not identified by the whole network in the historical waiting period of the block casting time slices, the previous node of the local node is deleted in the block casting sequence of each node in the group to generate a new block casting sequence, and the local node carries out periodical waiting of the block casting time slices according to the new block casting sequence.
In the embodiment of the present application, since the number of times that the block casting is not successfully completed by the previous node of the local node is greater than the preset number of times or the generated blocks are not identified through the whole network in the historical waiting period of the block casting time slice, it indicates that the previous node of the local node may be an inconclusive node or a dishonest node, when the number of times that the previous node of the local node fails to complete the block casting is greater than the preset number of times or the generated blocks are not identified through the whole network, the previous node of the local node may be deleted from the block casting order of each node within the group, a new block casting order may be generated, and a periodic rotation of block casting time slices may be performed in accordance with the new block casting order, punishment is carried out on the inexhaustible behavior of the previous node, and the efficiency of block casting of the network is improved.
For example, if the previous node of the local node C is node E, when the node E does not successfully complete the block casting or the generated blocks are not identified through the whole network, the local node C will perform the block casting while waiting for the end of the block casting time slice of node B, that is, delete node E in the packet, and generate a new block casting sequence of node C and node B.
The preset times may be set according to an actual application scenario, for example, the preset times may be set to 2 times, 3 times, 5 times or other times, which is not limited in the present application.
In practice, during the current time period of block casting, the nodes of the whole network maintain a whole network distrust value list at the beginning of the waiting period of each block casting time slice, and every time the block casting of a node in the specified block casting time slice is not completed in time, the distrust value of the node is added with 1. When the distrust value of a certain node is larger than a preset threshold value, namely the times of unsuccessfully finishing block casting are larger than the preset times, the nodes of the whole network are deleted from the group to which the nodes belong, so that the nodes have no opportunity to participate in casting blocks in the current time period, until the block casting of the next time period is started, the trust value of each node is restored to 0, the waiting of block casting time slices is carried out again, and the block casting is carried out when the block casting time slices are reached.
Optionally, in each of the above embodiments, as shown in fig. 3, after step 103, the method may further include: step 104 to step 105.
104, when the block casting of the next time period is started, regenerating the random number by each node in the block chain network, and regenerating a random number sequence list identified by the whole network;
and 105, the local node re-determines the block casting time slice to which the local node belongs according to the regenerated random number sequence list which is identified by the whole network, and performs block casting when the block casting time slice is reached.
In the embodiment of the present application, each time the block casting in one time period is completed and the block casting in the next time period is performed, the random number ordered list identified by the whole network needs to be regenerated, that is, each node needs to be reordered by block casting, so as to avoid the problem of calculation power concentration caused by the fixed block casting sequence.
Optionally, in step 104, when entering into the block casting of the next time period, each node in the block chain network regenerates the random number and regenerates the random number ordered list identified by the whole network, including: and when the block casting of the next time period is started, the nodes which have the generated blocks and do not pass through the whole network consensus in the historical time period are renamed, so that the nodes do not participate in the step of regenerating the random number ordered list which is subjected to the whole network consensus.
The historical time period refers to a time period that has existed in the past, for example, when entering block casting for the next time period, all time periods before the next time period are the historical time period.
Since the nodes which are generated in the historical time period and not identified through the whole network are possibly malicious nodes or dishonest nodes, when the casting of the blocks in the next time period is carried out, the nodes which are generated in the historical time period and not identified through the whole network need to be named off, so that the nodes do not participate in the step of regenerating the random number sequence list identified through the whole network, the possibility that the network is attacked is reduced, and the stability of the network is improved.
For example, when a certain node generates a block, the block data is changed by tampering with the block data or forging the block data, and the generated block is broadcasted. At this time, after receiving the block generated by the node, other nodes in the block chain network verify the block, and when the verification fails, the other nodes broadcast the information of the failure of the verification, so that the node receiving the information performs the following operations according to the verification result of the node: if the self-authentication fails, the information is broadcasted; if the self-authentication is successful, this information is not broadcast. Finally, under the condition that most nodes in the whole network are honest nodes, the blocks generated by the dishonest nodes cannot be commonly known through the whole network, and are renamed by the nodes in the block chain network, so that the blocks do not participate in the step of regenerating the random number ranking list commonly known through the whole network.
In various embodiments described above, the step of the local node performing block casting when arriving at the block casting time slice may include: when the local node reaches a block casting time slice, all transactions to be packed into a block are combined into a transaction list, a Merkle Root Hash is generated through a Merkle Tree algorithm, and a block head is obtained to be used as an input of a workload certificate; continuously changing the nonce value of the block head, and performing double SHA256 operation on the changed block head until the calculation result is smaller than the current difficulty target value of the network, wherein the problem solving is successful; at this time, the block data is encrypted by using a private key, the encrypted block data is broadcast, the block data is verified by other nodes, and after the verification is successful, the account book is written.
In the embodiment of the invention, each time a new block data is generated, the node generating the block can be rewarded.
For example, each time a node in a blockchain network generates a full network block, it receives an 80% cast block monetary reward, e.g., 80% of 5 ethernet coins. Another 20% of the awards are entered into the intra-group bonus pool, i.e. one ethernet coin is put into the intra-group bonus pool. After the grouped block casting time period is finished, all rewards in the reward pool in the group are averagely distributed to the node with the shortest average time of generating blocks and the node with the largest number of generating blocks so as to stimulate the casting blocks to be faster and more accurate.
As shown in fig. 4, a schematic structural diagram of an accounting apparatus for a block chain according to an embodiment of the present invention, where the accounting apparatus 400 includes: a random number generation module 401, a random number ordered list generation module 402, and a block casting module 403.
The random number generation module 401 is configured to generate a random number by a local node, and broadcast random number information carrying the random number and node identification information of the local node to other nodes in a blockchain network; meanwhile, the local node receives random number information broadcasted by other nodes and rebroadcasts the received random number information so that each node in the block chain network can receive the random number information of all nodes in the block chain network;
the random number ordered list generation module 402 is configured to sequence, by the local node, the random numbers in the received random number information and the random numbers generated by the local node to obtain an initial random number ordered list carrying node identification information, and then, the local node broadcasts the initial random number ordered list to the other nodes to obtain a random number ordered list identified by the whole network;
the block casting module 403 is configured to determine, by the local node, the block casting time slice to which the local node belongs in the current time period according to the random number ordered list identified through the whole network, and perform block casting when the block casting time slice is reached.
Optionally, the block casting module 403 further includes:
the grouping unit is used for grouping the nodes in the block chain network by the local node according to the random number ordered list identified by the whole network and determining the block casting time period of each group in the current time period;
the local node determines the block casting sequence of each node in the grouping according to the random number sequencing sequence of each node in the grouping;
and the block casting unit is used for periodically waiting the block casting time slices of the local node in the block casting time period of the group to which the local node belongs according to the block casting sequence of each node in the group when the block casting time period of the group to which the local node belongs is reached, and performing block casting in the block casting time slices with successful waiting.
The block casting unit is further configured to: when the local node carries out periodical waiting of the block casting time slices according to the block casting sequence of each node in the group in the block casting time period of the group to which the local node belongs, if the previous node of the local node does not successfully complete the block casting or the generated block is not identified through the whole network in the waiting period of the previous block casting time slice, the previous node of the local node is deleted from the block casting sequence of each node in the group to generate a new block casting sequence, and the local node carries out periodical waiting of the block casting time slices according to the new block casting sequence.
It should be noted that, for convenience and brevity of description, the specific working process of the block chain accounting device 400 described above may refer to the corresponding process of the method described in fig. 1 to fig. 3, and is not described herein again.
Fig. 5 is a schematic structural diagram of a terminal according to an embodiment of the present invention. The terminal may be the aforementioned local node and other nodes, and the terminal 5 in this embodiment includes: a processor 50, a memory 51 and a computer program 52, such as a billing program for a blockchain, stored in said memory 51 and executable on said processor 50. The processor 50 executes the computer program 52 to implement the steps in the above-mentioned embodiments of the block chain accounting method, for example, the steps 101 to 103 shown in fig. 1, or the processor 50 executes the computer program 52 to implement the functions of the modules/units in the above-mentioned embodiments of the apparatus, for example, the functions of the modules 401 to 403 shown in fig. 4.
Illustratively, the computer program 52 may be partitioned into one or more modules/units that are stored in the memory 51 and executed by the processor 50 to implement the present invention. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution of the computer program 52 in the terminal 5.
The user terminal or the node device may include, but is not limited to, a processor 50, a memory 51. It will be appreciated by those skilled in the art that fig. 5 is only an example of a terminal 5 and does not constitute a limitation of the terminal 5 and may comprise more or less components than shown or some components may be combined or different components, e.g. the accounting box of the block chain may further comprise input output devices, network access devices, buses etc.
The Processor 50 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 51 may be an internal storage unit of the terminal 5, such as a hard disk or a memory of the terminal 5. The memory 51 may also be an external storage device of the terminal 5, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) and the like provided on the terminal 5. Further, the memory 51 may also include both an internal storage unit and an external storage device of the terminal 5. The memory 51 is used for storing the computer program and other programs and data needed for accounting of the blockchain. The memory 51 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other ways. For example, the above-described embodiments of the apparatus/terminal device are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated modules/units, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow of the method according to the embodiments of the present invention may also be implemented by a computer program, which may be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method embodiments may be implemented. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present invention, and are intended to be included within the scope of the present invention.

Claims (8)

1. A block chain accounting method is characterized by comprising the following steps:
a local node generates a random number and broadcasts random number information carrying the random number and node identification information of the local node to other nodes in a block chain network; meanwhile, the local node receives random number information broadcasted by other nodes and rebroadcasts the received random number information so that each node in the block chain network can receive the random number information of all nodes in the block chain network;
the local node sorts the random numbers in the received random number information and the random numbers generated by the local node to obtain an initial random number ranking list carrying node identification information, and then broadcasts the initial random number ranking list to other nodes to obtain a random number ranking list identified by the whole network;
the local node determines the block casting time slice to which the local node belongs in the current time period according to the random number ordered list known by the whole network, and performs block casting when the block casting time slice is reached;
the local node determines a block casting time slice in the current time period according to the random number ordered list known by the whole network, and the block casting when the block casting time slice is reached comprises the following steps:
the local node groups the nodes in the block chain network according to the random number ordered list known by the whole network and determines the block casting time period of each group in the current time period;
the local node determines the block casting sequence of each node in the grouping according to the random number sequencing sequence of each node in the grouping;
when the block casting time period of the grouping to which the local node belongs is reached, the local node carries out periodical block casting time slice waiting according to the block casting sequence of each node in the grouping in the block casting time period of the grouping to which the local node belongs, and carries out block casting in the block casting time slice with successful waiting.
2. The billing method of claim 1, wherein said local node periodically waiting block casting time slices according to the block casting order of each node within a group during the block casting period of the group to which it belongs comprises:
when the local node carries out periodical waiting of the block casting time slices according to the block casting sequence of each node in the group in the block casting time period of the group to which the local node belongs, if the number of times that the previous node of the local node does not successfully finish the block casting is greater than the preset number of times or the generated blocks are not identified by the whole network in the historical waiting period of the block casting time slices, the previous node of the local node is deleted in the block casting sequence of each node in the group to generate a new block casting sequence, and the local node carries out periodical waiting of the block casting time slices according to the new block casting sequence.
3. The accounting method of any one of claims 1-2, wherein after the local node determines the block casting time slice to which it belongs in the current time period according to the network-wide consensus random number ordered list, and performs block casting when the block casting time slice is reached, further comprising:
when entering block casting of the next time period, each node in the block chain network regenerates the random number and regenerates a random number ordered list identified by the whole network;
and the local node re-determines the block casting time slice to which the local node belongs according to the regenerated random number sequence list which is identified by the whole network, and performs block casting when the block casting time slice is reached.
4. A billing method according to claim 3 wherein each node in the blockchain network regenerates the random number upon entering blockcasting for the next time period and regenerates a ranked list of random numbers identified throughout the network comprising:
and when the block casting of the next time period is started, the nodes which have the generated blocks and do not pass through the whole network consensus in the historical time period are renamed, so that the nodes do not participate in the step of regenerating the random number ordered list which is subjected to the whole network consensus.
5. An apparatus for accounting for a blockchain, comprising:
a random number generation module, configured to generate a random number by a local node, and broadcast random number information carrying the random number and node identification information of the local node to other nodes in a blockchain network; meanwhile, the local node receives random number information broadcasted by other nodes and rebroadcasts the received random number information so that each node in the block chain network can receive the random number information of all nodes in the block chain network;
a random number ranking list generating module, configured to sequence, by the local node, the random numbers in the received random number information and the random numbers generated by the local node to obtain an initial random number ranking list carrying node identification information, and then, the local node broadcasts the initial random number ranking list to the other nodes to obtain a random number ranking list that is commonly identified through the entire network;
the block casting module is used for determining the block casting time slice which the local node belongs to in the current time period according to the random number ordered list which is identified by the whole network, and performing block casting when the block casting time slice is reached;
the block casting module further comprises:
the grouping unit is used for grouping the nodes in the block chain network by the local node according to the random number ordered list identified by the whole network and determining the block casting time period of each group in the current time period;
the local node determines the block casting sequence of each node in the grouping according to the random number sequencing sequence of each node in the grouping;
and the block casting unit is used for periodically waiting the block casting time slices of the local node in the block casting time period of the group to which the local node belongs according to the block casting sequence of each node in the group when the block casting time period of the group to which the local node belongs is reached, and performing block casting in the block casting time slices with successful waiting.
6. The accounting apparatus of claim 5, wherein the block casting unit is further configured to: when the local node carries out periodical waiting of the block casting time slices according to the block casting sequence of each node in the group in the block casting time period of the group to which the local node belongs, if the number of times that the previous node of the local node does not successfully finish the block casting is greater than the preset number of times or the generated blocks are not identified by the whole network in the historical waiting period of the block casting time slices, the previous node of the local node is deleted in the block casting sequence of each node in the group to generate a new block casting sequence, and the local node carries out periodical waiting of the block casting time slices according to the new block casting sequence.
7. A terminal comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any of claims 1 to 4 when executing the computer program.
8. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 4.
CN201910171582.2A 2019-03-07 2019-03-07 Accounting method and device of block chain, terminal and computer-readable storage medium Active CN110011974B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910171582.2A CN110011974B (en) 2019-03-07 2019-03-07 Accounting method and device of block chain, terminal and computer-readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910171582.2A CN110011974B (en) 2019-03-07 2019-03-07 Accounting method and device of block chain, terminal and computer-readable storage medium

Publications (2)

Publication Number Publication Date
CN110011974A CN110011974A (en) 2019-07-12
CN110011974B true CN110011974B (en) 2021-08-10

Family

ID=67166600

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910171582.2A Active CN110011974B (en) 2019-03-07 2019-03-07 Accounting method and device of block chain, terminal and computer-readable storage medium

Country Status (1)

Country Link
CN (1) CN110011974B (en)

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110457006B (en) * 2019-07-22 2021-08-06 上海朝夕网络技术有限公司 Distributed multi-party random number generation method and system based on hardware
CN110445852B (en) * 2019-07-29 2021-12-10 杭州复杂美科技有限公司 Method, device and storage medium for issuing general certificate
CN110661867B (en) * 2019-09-25 2021-07-23 东北大学 Block chain consensus method based on improved workload certification and equity certification
CN110585727B (en) * 2019-09-26 2023-08-29 腾讯科技(深圳)有限公司 Resource acquisition method and device
CN110852882B (en) * 2019-11-11 2020-11-20 北京众享比特科技有限公司 Packet consensus method, apparatus, device, and medium for blockchain networks
WO2021134470A1 (en) * 2019-12-31 2021-07-08 西门子股份公司 Blockchain system, data processing method, computing device and medium
CN111447274B (en) * 2020-03-26 2023-06-02 北京京东振世信息技术有限公司 Node selection method and device
CN111464544B (en) * 2020-04-01 2022-08-23 中国联合网络通信集团有限公司 Block chain account book generation method and device
CN111556115B (en) * 2020-04-22 2023-04-21 财付通支付科技有限公司 Block chain-based data processing method, device, equipment and storage medium
CN113010894B (en) * 2020-06-12 2022-12-09 腾讯科技(深圳)有限公司 Data processing method and device and computer readable storage medium
CN112040015B (en) * 2020-11-06 2021-02-12 腾讯科技(深圳)有限公司 Consensus node list generation method and related device
CN114979148B (en) * 2022-06-16 2023-07-14 中国联合网络通信集团有限公司 Data transmission method, device and computer readable storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106357405A (en) * 2016-09-19 2017-01-25 弗洛格(武汉)信息科技有限公司 Method and system for managing data on basis of block chain technology consistency algorithms
CN108269090A (en) * 2018-01-19 2018-07-10 中国科学院软件研究所 Based on the common recognition method and apparatus for block catenary system drawn lots at random without negotiation
CN108596621A (en) * 2018-04-28 2018-09-28 深圳市优学链科技有限公司 Block chain accounting nodes generation method, device, computer equipment and storage medium
CN108964879A (en) * 2018-07-20 2018-12-07 杭州复杂美科技有限公司 A kind of drawing method, common recognition method, equipment and storage medium
CN109361740A (en) * 2018-09-27 2019-02-19 百度在线网络技术(北京)有限公司 A kind of block generation method, device, equipment and the medium of block chain

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10657225B2 (en) * 2016-12-29 2020-05-19 Red Hat, Inc. Providing blockchain-based subscription-as-a-service management
US10419446B2 (en) * 2017-07-10 2019-09-17 Cisco Technology, Inc. End-to-end policy management for a chain of administrative domains

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106357405A (en) * 2016-09-19 2017-01-25 弗洛格(武汉)信息科技有限公司 Method and system for managing data on basis of block chain technology consistency algorithms
CN108269090A (en) * 2018-01-19 2018-07-10 中国科学院软件研究所 Based on the common recognition method and apparatus for block catenary system drawn lots at random without negotiation
CN108596621A (en) * 2018-04-28 2018-09-28 深圳市优学链科技有限公司 Block chain accounting nodes generation method, device, computer equipment and storage medium
CN108964879A (en) * 2018-07-20 2018-12-07 杭州复杂美科技有限公司 A kind of drawing method, common recognition method, equipment and storage medium
CN109361740A (en) * 2018-09-27 2019-02-19 百度在线网络技术(北京)有限公司 A kind of block generation method, device, equipment and the medium of block chain

Also Published As

Publication number Publication date
CN110011974A (en) 2019-07-12

Similar Documents

Publication Publication Date Title
CN110011974B (en) Accounting method and device of block chain, terminal and computer-readable storage medium
CN110599173B (en) Block chain consensus node determination method, device, equipment and storage medium
CN108596621B (en) Block chain accounting node generation method and device, computer equipment and storage medium
US11483129B2 (en) Method and apparatus for reaching blockchain consensus
CN108512650B (en) Block chain-oriented dynamic hash calculation method, device, node and storage medium
US20200026699A1 (en) Highly Performant Decentralized Public Ledger with Hybrid Consensus
CN108711212B (en) Voting certificate storage method, device and system
CN108805569A (en) Transaction processing method and device, electronic equipment based on block chain
CN112288434B (en) Privacy transaction method, device, zero knowledge proof system and privacy transaction architecture model
CN110235162B (en) Block chain system data processing method and block generation method
CN111008863A (en) Lottery drawing method and system based on block chain
CN111010284B (en) Processing method of block to be identified, related device and block chain system
CN108629588B (en) Computer readable medium for block chain consensus achievement
CN109522314A (en) Data archiving method and terminal device based on block chain
CN108665363A (en) A kind of block chain common recognition reaches device
CN111556115A (en) Data processing method, device and equipment based on block chain and storage medium
CN110738783A (en) System, method, device, equipment and readable storage medium for updating voting data
CN111966971A (en) Profit distribution method, apparatus, server and storage medium for copyright product
CN116055052A (en) Block chain-based data processing method, device, equipment and readable storage medium
CN108573181A (en) A kind of RFID reader, RFID system and block chain network
CN110515591B (en) Random number generation method and device based on block chain
CN111047306A (en) Parallel transaction processing method and device for transaction input set
CN111177262A (en) Block chain consensus method, related device and system
CN114723534A (en) E-commerce transaction rationality judgment method based on block chain and related equipment
CN112258188B (en) Processing method, device, equipment and system for block chain transaction

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: 518000 Guangdong city of Shenzhen province Qianhai Shenzhen Hong Kong cooperation zone before Bay Road No. 1 building 201 room A (located in Shenzhen Qianhai business secretary Co. Ltd.)

Applicant after: Gangrong Technology Co., Ltd.

Address before: 518000 Guangdong city of Shenzhen province Qianhai Shenzhen Hong Kong cooperation zone before Bay Road No. 1 building 201 room A (located in Shenzhen Qianhai business secretary Co. Ltd.)

Applicant before: Shenzhen Ronghui Tongjin Technology Co., Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant