CN112036848A - Method for realizing transaction sequence fairness block chain consensus algorithm - Google Patents

Method for realizing transaction sequence fairness block chain consensus algorithm Download PDF

Info

Publication number
CN112036848A
CN112036848A CN202010849726.8A CN202010849726A CN112036848A CN 112036848 A CN112036848 A CN 112036848A CN 202010849726 A CN202010849726 A CN 202010849726A CN 112036848 A CN112036848 A CN 112036848A
Authority
CN
China
Prior art keywords
block
transactions
sequence
transaction
time
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.)
Withdrawn
Application number
CN202010849726.8A
Other languages
Chinese (zh)
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.)
Shandong ICity Information Technology Co., Ltd.
Original Assignee
Shandong ICity Information 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 Shandong ICity Information Technology Co., Ltd. filed Critical Shandong ICity Information Technology Co., Ltd.
Priority to CN202010849726.8A priority Critical patent/CN112036848A/en
Publication of CN112036848A publication Critical patent/CN112036848A/en
Withdrawn legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • 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
    • 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/40Authorisation, e.g. identification of payer or payee, verification of customer or shop credentials; Review and approval of payers, e.g. check credit lines or negative lists
    • G06Q20/403Solvency checks
    • G06Q20/4037Remote solvency checks
    • 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

Landscapes

  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Engineering & Computer Science (AREA)
  • Finance (AREA)
  • General Physics & Mathematics (AREA)
  • General Business, Economics & Management (AREA)
  • Physics & Mathematics (AREA)
  • Strategic Management (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Technology Law (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application discloses a method for realizing a block chain consensus algorithm with transaction sequence fairness, which is used for solving the problem that in the prior art, malicious nodes intentionally sort transactions according to a time sequence of received transactions, so that a block chain network is safe. The method comprises the following steps: sequencing the received transactions according to the receiving time sequence; receiving a first block sent by a node obtaining the accounting right through a block chain network, and obtaining a record sequence of transactions in the first block; and comparing whether the recording sequence of the transactions in the first block is consistent with the recording sequence sorted according to the receiving time sequence.

Description

Method for realizing transaction sequence fairness block chain consensus algorithm
Technical Field
The application relates to the technical field of blockchain, in particular to a realization method of a transaction sequence fairness blockchain consensus algorithm.
Background
With the development of the blockchain technology, more and more application fields are provided, and the security problem caused by the sequencing of transactions in the blockchain network is paid attention by people.
Generally, the nodes sequence the transactions according to the time sequence of the received transactions, the time of receiving the transactions is inconsistent with the actual time of the transactions due to network reasons in a few nodes, and the malicious nodes intentionally do not sequence the transactions according to the time sequence of receiving the transactions so as to obtain illegal gains and threaten the safety of the block chain network.
Disclosure of Invention
The embodiment of the application provides a method for realizing a block chain consensus algorithm with transaction sequence fairness, which is used for solving the problem that in the prior art, malicious nodes intentionally sort transactions according to a time sequence of received transactions, so that the block chain network security is caused
The embodiment of the application provides a method for realizing a block chain consensus algorithm in transaction sequence fairness, which comprises the following steps:
sequencing the received transactions according to the receiving time sequence;
receiving a first block sent by a node obtaining the accounting right through a block chain network, and obtaining a record sequence of transactions in the first block;
and comparing whether the recording sequence of the transactions in the first block is consistent with the recording sequence sorted according to the receiving time sequence.
Optionally, the method further comprises:
marking the first block according to the comparison result.
Optionally, the marking the second block according to the comparison result specifically includes:
and if the recording sequence of the transaction in the first block is inconsistent with the recording sequence sorted according to the receiving time sequence, marking the first block as a suspicious block.
Optionally, after receiving the first block sent by the node obtaining the billing right through the blockchain network, the method further includes:
and verifying the validity of the transaction in the first block, marking the valid transaction as a valid transaction, and marking the illegal transaction as an invalid transaction.
Optionally, if the transactions in the first block are the same as the transactions sorted according to the receiving time sequence, the method further includes:
packing the transactions sorted according to the receiving time sequence into a second block;
calculating a hash value of the first chunk and a hash value of the second chunk based on a consensus algorithm;
comparing the hash value of the first chunk with the hash value of the second chunk.
Optionally, after the comparing the hash value of the first chunk with the hash value of the second chunk, the method further comprises:
and if the hash value of the first block is the same as the hash value of the second block, the recording sequence of the transactions in the first block is the same as the recording sequence of the transactions in the second block.
Optionally, the sorting the received transactions according to the receiving time sequence specifically includes:
and adding time stamps to the received transactions, and sequencing according to the time sequence of the added time stamps.
Optionally, the obtaining the recording order of the transactions in the first block specifically includes:
and acquiring the time stamps of the transactions in the first block, and judging whether the recording sequence of the transactions in the first block is the time sequence of the time stamps.
Optionally, the method further comprises:
if the recording sequence of the transactions in the first block is the same as the time sequence of the time stamps, and the recording sequence of the transactions in the first block is not consistent with the recording sequence of the transactions in the second block, delaying the node network for obtaining the accounting right;
and if the recording sequence of the transactions in the first block is different from the time sequence of the timestamps, and the recording sequence of the transactions in the first block is inconsistent with the recording sequence of the transactions in the second block, the node obtaining the accounting right is a malicious node.
Optionally, the method further comprises:
and according to the marking result, joining the consensus process corresponding to the first block.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
fig. 1 is a process schematic diagram of an implementation method of a transaction sequence fairness block chain consensus algorithm according to an embodiment of the present application.
Fig. 2 is a schematic diagram illustrating an influence of a transaction sequence on a transaction result according to an embodiment of the present disclosure.
Fig. 3 is a schematic diagram illustrating an influence of another transaction sequence on a transaction result according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present disclosure more clear, the following description of the present disclosure will be made in detail and completely with reference to the embodiments of the present disclosure and the accompanying drawings. It is to be understood that the embodiments described are only a few embodiments of the present application and not all embodiments. All other embodiments obtained by a person skilled in the art without making any inventive step based on the embodiments in the description belong to the protection scope of the present application.
Aiming at the problems in the background art, the application provides a method for realizing a block chain consensus algorithm with transaction sequence fairness, which can participate in a consensus process corresponding to a second block by verifying the record sequence of the transaction in the second block sent by a node obtaining the accounting right through a block chain network, so as to ensure the safety of the block chain network.
The technical solutions provided by the embodiments of the present application are described in detail below with reference to the accompanying drawings.
Fig. 1 is a schematic process diagram of an implementation method of a transaction sequence fairness block chain consensus algorithm according to an embodiment of the present application, and the implementation method may include the following steps:
s101: sequencing the received transactions according to the receiving time sequence;
s102: receiving a first block sent by a node obtaining the accounting right through a block chain network, and obtaining a record sequence of transactions in the first block;
s103: comparing the recorded order of the transactions in the first block with the recorded order sorted by the reception time order.
The block chain network in the embodiment of the application comprises normal nodes, malicious nodes and delay nodes with network delay. The transactions in the first block and the transactions sorted in the order of the reception time need not be identical.
The nodes in the block chain network sort the received transactions according to the receiving time sequence, for example, two transactions, one transaction is generated at ten o 'clock, the other transaction is generated at ten o' clock, under normal conditions, the transaction generated at ten o 'clock is received firstly, and the transaction generated at ten o' clock is received secondly, and the two transactions are sorted according to the receiving time sequence, the transaction generated at ten o 'clock is at the front, and the transaction generated at ten o' clock is at the back.
And receiving a first block sent by the node obtaining the accounting right through the block chain network, wherein the node obtaining the accounting right can be a normal node, a malicious node and a delay node. The recording sequence of the transactions in the first block is obtained.
And comparing the obtained recording sequence of the transactions in the first block with the recording sequence sorted according to the receiving time sequence, and comparing whether the recording sequence of the transactions in the first block is the same as the recording sequence sorted according to the receiving time sequence. It should be noted that the transactions in the first block and the transactions sorted according to the receiving time sequence do not necessarily coincide completely, for example, the transactions sorted according to the receiving time sequence include 3 transactions tx1, tx2 and tx3, which are ten o ' clock, ten o ' clock and ten o ' clock respectively, and are sorted according to the receiving time sequence. The first block also includes 3 transactions, namely, a transaction tx2, a transaction tx3 and a transaction tx4 of ten-point-five, ten-point-ten and ten-point-fifteen, and only the recorded sequence of the transactions in the first block is compared with the recorded sequence of the same transactions in the transactions sorted according to the receiving time sequence. For example, the transactions tx2 and tx3 and the transactions tx2 and tx3 are included in the first block and are sorted in the order of the time of receipt.
Marking the first block according to the comparison result.
And if the transaction recording sequence in the first block is inconsistent with the recording sequence sorted according to the receiving time sequence, marking the first block as a suspicious block.
After receiving a first block sent by a node obtaining the accounting right through a blockchain network, verifying the validity of the transaction in the first block, marking the valid transaction as a valid transaction, and marking the illegal transaction as an invalid transaction.
For example, transaction tx2 contained in the first block is not chronologically ordered with transaction tx3, and transaction tx3 is ordered before transaction tx2 and is not consistent with the record order of the chronological order of receipt, at which time the first block is marked as a suspect block.
The sequence of transactions affects the final result of the transaction, and if any node intentionally adjusts the sequence of transactions, the security of the blockchain network is affected.
Fig. 2 is a schematic diagram illustrating an influence of a transaction sequence on a transaction result according to an embodiment of the present application.
For example, when A has 100, B has 0, and C has 0, two transactions occur: where transaction tx1 is a sending 5-tuple to B, transaction tx2 occurs after transaction tx1 is completed sending 5-tuple to C for B.
If the order of transaction tx1 is chronologically before transaction tx2, then both transactions are valid, resulting in a balance of 95 dollars for A, 0 dollars for B, and 5 dollars for C.
Fig. 3 is a schematic diagram illustrating an influence of another transaction sequence on a transaction result according to an embodiment of the present application. Wherein, if the node that obtains the billing right arranges the transaction tx2 before the transaction tx1, the transaction tx2 will be invalid. When B sends 5 yuan to C, the transfer fails because the balance is 0, and transaction tx2 is invalidated. And carrying out transaction tx1, wherein A sends 5 yuan to B, the balance of A is 95 yuan, the balance of B is 5 yuan, and the balance of C is 0 yuan.
If the transactions in the first block are the same as the transactions sequenced according to the receiving time sequence, packaging the transactions sequenced according to the receiving time sequence into a second block; calculating a hash value of the first chunk and a hash value of the second chunk based on a consensus algorithm; comparing the hash value of the first chunk with the hash value of the second chunk.
And if the hash value of the first block is the same as the hash value of the second block, the recording sequence of the transactions in the first block is the same as the recording sequence of the transactions in the second block.
In one embodiment of the present application, if the transactions in the first block are the same as the transactions sorted in the receiving time order, such as the transactions tx1, tx2, tx3 contained in the first block, the transactions sorted in the receiving time order include transactions tx1, tx2, tx3, and the transactions sorted in the receiving time order are packed into the second block. Calculating the hash values of the first block and the second block based on a consensus algorithm, and comparing whether the hash value of the first block is the same as the hash value of the second block. If the calculated hash value of the first block is the same as that of the second block, the transaction recording sequence in the first block is proved to be the same as that in the second block, and if the calculated hash value of the first block is different from that of the second block, the transaction recording sequence in the first block is proved to be different from that in the second block.
And adding time stamps to the received transactions, and sequencing according to the time sequence of the added time stamps.
After each transaction is received by the node, a time stamp is added to each transaction, the time of receiving the transaction is displayed, and the transactions are sequenced according to the time sequence of the added time stamps.
And acquiring the time stamps of the transactions in the first block, and judging whether the recording sequence of the transactions in the first block is the time sequence of the time stamps.
For example, after the transaction tx1 and the transaction tx2 are received by the node, the transaction tx1 and the transaction tx2 are time-stamped, and the time of the time stamp is the system time when the transaction is received by the node, for example, the time when the transaction tx1 is received is 12:00, and the time when the transaction tx2 is received is 12: 02. The method comprises the steps of obtaining a timestamp of a transaction in a first block, checking the system time of each received transaction, judging whether the recording sequence of the transaction in the first block is sorted according to the system time of each received transaction, and judging whether a transaction tx1 in the first block is arranged in front of a transaction tx2 according to the time sequence.
If the recording sequence of the transactions in the first block is the same as the time sequence of the time stamps, and the recording sequence of the transactions in the first block is not consistent with the recording sequence of the transactions in the second block, delaying the node network for obtaining the accounting right;
and if the recording sequence of the transactions in the first block is different from the time sequence of the timestamps, and the recording sequence of the transactions in the first block is inconsistent with the recording sequence of the transactions in the second block, the node obtaining the accounting right is a malicious node.
If the first block contains two transactions tx1 and tx2, the timestamp of tx1 is 1:00, transaction tx2 with a timestamp of 1:01, transaction tx1 in the first block ranked before transaction tx2, in-line with the timestamp order, and transaction tx2 in the second block with a timestamp of 00:59, transaction tx1 with a timestamp of 1:00, and transaction tx2 ranked before transaction tx1, demonstrate a node network delay to obtain accounting rights.
If the first block contains two transactions of transaction tx1, transaction tx2, transaction tx1 with a timestamp of 00:00 and transaction tx2 with a timestamp of 00:01, but the transactions in the first block are ordered such that transaction tx2 precedes transaction tx1 in a different time order from the timestamp, and transaction tx1 in the second block precedes transaction tx2, the node obtaining the accounting right is proved to be a malicious node.
According to the marking result, referring to the corresponding consensus process of the first block. Whether to accept the block is judged according to the result of the consensus process.
By verifying the transaction sequence, the fairness of the transaction sequencing is guaranteed, and the safety of the block chain network is further maintained.
The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (10)

1. A method for implementing a transaction sequence fairness block chain consensus algorithm is characterized by comprising the following steps:
sequencing the received transactions according to the receiving time sequence;
receiving a first block sent by a node obtaining the accounting right through a block chain network, and obtaining a record sequence of transactions in the first block;
and comparing whether the recording sequence of the transactions in the first block is consistent with the recording sequence sorted according to the receiving time sequence.
2. The method of claim 1, further comprising:
marking the first block according to the comparison result.
3. The method of claim 2, wherein marking the first block according to the comparison comprises:
and if the recording sequence of the transaction in the first block is inconsistent with the recording sequence sorted according to the receiving time sequence, marking the first block as a suspicious block.
4. The method of claim 1, wherein after receiving the first block sent by the node that acquired the billing right through the blockchain network, the method further comprises:
and verifying the validity of the transaction in the first block, marking the valid transaction as a valid transaction, and marking the illegal transaction as an invalid transaction.
5. The method of claim 4, wherein if the transactions in the first block are the same as the transactions sorted in the order of receipt time, the method further comprises:
packing the transactions sorted according to the receiving time sequence into a second block;
calculating a hash value of the first chunk and a hash value of the second chunk based on a consensus algorithm;
comparing the hash value of the first chunk with the hash value of the second chunk.
6. The method of claim 5, wherein after said comparing the hash value of the first chunk to the hash value of the second chunk, the method further comprises:
and if the hash value of the first block is the same as the hash value of the second block, the recording sequence of the transactions in the first block is the same as the recording sequence of the transactions in the second block.
7. The method of claim 1, wherein sorting the received transactions in order of time of receipt comprises:
and adding time stamps to the received transactions, and sequencing according to the time sequence of the added time stamps.
8. The method of claim 7, wherein the obtaining the recorded sequence of transactions in the first block comprises:
and acquiring the time stamps of the transactions in the first block, and judging whether the recording sequence of the transactions in the first block is the time sequence of the time stamps.
9. The method of claim 8, further comprising:
if the recording sequence of the transactions in the first block is the same as the time sequence of the time stamps, and the recording sequence of the transactions in the first block is not consistent with the recording sequence of the transactions in the second block, delaying the node network for obtaining the accounting right;
and if the recording sequence of the transactions in the first block is different from the time sequence of the timestamps, and the recording sequence of the transactions in the first block is inconsistent with the recording sequence of the transactions in the second block, the node obtaining the accounting right is a malicious node.
10. The method of claim 3, further comprising:
and according to the marking result, joining the consensus process corresponding to the first block.
CN202010849726.8A 2020-08-21 2020-08-21 Method for realizing transaction sequence fairness block chain consensus algorithm Withdrawn CN112036848A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010849726.8A CN112036848A (en) 2020-08-21 2020-08-21 Method for realizing transaction sequence fairness block chain consensus algorithm

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010849726.8A CN112036848A (en) 2020-08-21 2020-08-21 Method for realizing transaction sequence fairness block chain consensus algorithm

Publications (1)

Publication Number Publication Date
CN112036848A true CN112036848A (en) 2020-12-04

Family

ID=73580404

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010849726.8A Withdrawn CN112036848A (en) 2020-08-21 2020-08-21 Method for realizing transaction sequence fairness block chain consensus algorithm

Country Status (1)

Country Link
CN (1) CN112036848A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117527832A (en) * 2024-01-03 2024-02-06 杭州趣链科技有限公司 Transaction ordering method and device for blockchain, electronic equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117527832A (en) * 2024-01-03 2024-02-06 杭州趣链科技有限公司 Transaction ordering method and device for blockchain, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN103701946B (en) Method and system for client-side to be in communication with server through URL (Universal Resource Locator)
CN111405505B (en) Bill processing method, system and storage medium for roaming service
CN112395353A (en) Intelligent electric energy meter quality data sharing method and system based on alliance chain
CN112036848A (en) Method for realizing transaction sequence fairness block chain consensus algorithm
CN111209339B (en) Block synchronization method, device, computer and storage medium
US6173173B1 (en) Invalid mobile telephone call terminating system and method
CN110689343A (en) Transaction verification method and device based on directed acyclic graph
CN106888094A (en) A kind of endorsement method and server
CN110460597A (en) A kind of control frame precommpression method based on AS6802 agreement
US11621977B2 (en) Network forensic system for performing transmission metadata tracking and analysis
CN111598558B (en) Billing method, billing node server and payer node server
US7180851B1 (en) Method for quick identification of special data packets
CN112202863B (en) Data synchronization method and device, electronic equipment and readable storage medium
US7861293B2 (en) Mobile terminal and authentication method
CN112785299B (en) Method and device for roaming transaction based on blockchain
CN113326501A (en) Information layering detection method and device based on block chain
CN116781269A (en) Block chain-based data processing method, device, equipment, medium and product
CN112734521A (en) High-security electronic commerce method based on block chain
CN112116461A (en) Block chain and consensus method thereof
CN112926956A (en) Block chain financial payment management method and system
CN110766407A (en) Transaction verification method, accounting node and medium based on block chain
CN111191273A (en) Method and device for processing document, electronic equipment and readable storage medium
CN110647757A (en) Data processing method based on intelligent contract and related device
CN117036038B (en) Transaction processing method, device, equipment and storage medium based on alliance chain
CN115632800B (en) Internet of things source data storage method and device based on block chain consensus

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
WW01 Invention patent application withdrawn after publication

Application publication date: 20201204

WW01 Invention patent application withdrawn after publication