CN111523897B - Anti-attack method, device and storage medium - Google Patents

Anti-attack method, device and storage medium Download PDF

Info

Publication number
CN111523897B
CN111523897B CN202010373917.1A CN202010373917A CN111523897B CN 111523897 B CN111523897 B CN 111523897B CN 202010373917 A CN202010373917 A CN 202010373917A CN 111523897 B CN111523897 B CN 111523897B
Authority
CN
China
Prior art keywords
transaction
block
pool
hash
data set
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
CN202010373917.1A
Other languages
Chinese (zh)
Other versions
CN111523897A (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.)
Hangzhou Fuzamei Technology Co Ltd
Original Assignee
Hangzhou Fuzamei 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 Hangzhou Fuzamei Technology Co Ltd filed Critical Hangzhou Fuzamei Technology Co Ltd
Priority to CN202010373917.1A priority Critical patent/CN111523897B/en
Publication of CN111523897A publication Critical patent/CN111523897A/en
Application granted granted Critical
Publication of CN111523897B publication Critical patent/CN111523897B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3825Use of electronic signatures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2255Hash tables
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3823Payment protocols; Details thereof insuring higher security of transaction combining multiple encryption tools for a transaction

Landscapes

  • Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Accounting & Taxation (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • General Business, Economics & Management (AREA)
  • Strategic Management (AREA)
  • Finance (AREA)
  • Data Mining & Analysis (AREA)
  • Computer Security & Cryptography (AREA)
  • General Engineering & Computer Science (AREA)
  • Computational Linguistics (AREA)
  • Software Systems (AREA)
  • Computing Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides an anti-attack method, equipment and a storage medium, wherein the method comprises the following steps: in the transaction broadcasting stage, the transaction is checked for duplication according to the transaction full hash; when the packaging right of a first block with the first block height is obtained, packaging a plurality of transactions from a local transaction pool to generate a first block, and generating a first data set according to the first block; broadcasting the first set of data to other blockchain nodes for the other blockchain nodes: searching each transaction of the first block in a local transaction pool according to a first transaction full hash list of the first data set; and after the verification of the Merkel root, assembling and restoring the first block according to the first data set and the searched transactions. The method improves the stability of the block chain.

Description

Anti-attack method, device and storage medium
Technical Field
The present application relates to the field of blockchain technologies, and in particular, to an anti-attack method, device, and storage medium.
Background
In the transaction broadcast mechanism previously proposed by the applicant (specifically, refer to patent texts such as transaction broadcasts or block broadcasts applied by the applicant), the transaction hash is generated from the transaction content of the transaction, the merkel root in the block header information of the block is generated by the transaction hash calculation of each transaction of the block, the block link node receives one transaction, and assuming that the transaction content is content (X), the block link node first determines whether another transaction identical to the content (X) exists locally: if yes, discarding the newly received transaction; and if not, storing the newly received transaction into a local transaction pool. In the block verification mechanism previously proposed by the applicant (refer to patent texts such as each item of block generation, block broadcast or block verification, etc. applied by the applicant), the block chaining node of the generated block sends the data set of the generated block (including the block header information and the transaction hash list of the generated block) to other block chaining nodes; when other block chain nodes receive the block, all transactions of the received block are searched in a local transaction pool according to the transaction hash list, the Merkel root is calculated according to the transaction hash of the searched transactions, when the calculated Merkel root is judged to be the same as the Merkel root in the block header information, the first block is assembled and restored according to the received data set and the searched transactions, the restored first block is executed to obtain an execution result, and when the execution result is not consistent with the execution result in the block header information, the block chain node points consider that the problem (the Merkel root is the same, the execution result is different) is caused by inconsistent versions, and the block chain node points stop running and wait for version updating.
Assuming that there are four ABCD blockchain nodes in a blockchain, a user a is a malicious user, and the user a signs the same transaction content with private keys of two accounts to generate two different transactions tx1 (sig _ a1 (content (M))) and tx2 (sig _ a2 (content (M))); suppose that A and B receive tx1 first, and C and D receive tx2 first; A. after receiving tx1 and then receiving tx2, A and B can not store tx2 into the local transaction pool because the transaction contents of tx1 and tx2 are the same; similarly, the tx1 is not stored in the local transaction pool by the C and the D; suppose a generates a block (N) comprising tx1 and broadcasts a block header (N) and a transaction hash list of block (N) to B, C, D; since the transaction hash is generated from the transaction content of the transaction, the mekerr roots of a, B, C, D are all the same; b, C and D assemble a reduction block (N) according to the searched transaction under the condition that the Mekerr roots are the same; b finds tx1 locally according to hash (content (M)), and C, D find tx2 locally according to hash (content (M)); therefore, the first execution results generated by executing block (N) by a and B are the same, the second execution results generated by executing block (N) by C and D are the same, and the first execution results are different from the second execution results. C. D considers that the problem is caused by version inconsistency, and C and D stop running and wait for version updating. Therefore, in the transaction broadcasting mechanism, one transaction can cause a plurality of block chain link points to be incapable of working normally, and the stability of the operation of the block chain is reduced.
Disclosure of Invention
In view of the above-mentioned shortcomings or drawbacks in the prior art, it is desirable to provide an anti-attack method, apparatus, and storage medium that improve the stability of a blockchain.
In a first aspect, the present invention provides an anti-attack method applied to a blockchain node, where a blockchain system does not support generation and execution of a transaction group, the method including:
receiving a first transaction sent by a client or broadcast by other blockchain nodes, and generating a first transaction full hash according to first transaction content and first signature information of the first transaction;
when a second transaction which is identical to the first transaction in full hash does not exist in the local transaction pool, storing the first transaction and broadcasting the first transaction to other block link nodes;
when the packaging right of a first block with the first block height is obtained, packaging a plurality of transactions from a local transaction pool to generate a first block, and generating a first data set according to the first block; the first data set comprises first block header information of a first block and a first transaction full-hash list, wherein the first block header information comprises a first Merkel root, and the first Merkel root is generated by transaction full-hash of packaged transactions; and the number of the first and second groups,
broadcasting the first set of data to other blockchain nodes for the other blockchain nodes:
searching each transaction of the first block in a local transaction pool according to the first transaction full hash list;
calculating a second Merkel root according to the found transaction full hash of each transaction, and judging whether the second Merkel root is the same as the first Merkel root:
if yes, the first block is assembled and restored according to the first data set and the searched transactions;
otherwise, the first block is requested from the current node.
In a second aspect, the present invention provides an anti-attack method applicable to blockchain nodes, where the blockchain network is configured with a corresponding transaction pool network, the transaction pool network includes a plurality of transaction pool nodes that communicate with each other, each blockchain node is respectively registered with a push address for pushing a new transaction at any transaction pool node, and the blockchain system does not support generation and execution of a transaction group, where the method includes:
receiving and storing a first transaction sent by a client, generating a first transaction full hash according to first transaction content and first signature information of the first transaction, broadcasting the first transaction full hash to other block chain nodes, sending the first transaction to a first transaction pool node for broadcasting the first transaction to other transaction pool nodes, and pushing the first transaction to a plurality of block chain nodes according to registered push addresses;
receiving second transaction full hashes broadcast by other blockchain nodes, and monitoring whether a second transaction is received or not when the second transaction which is the same as the first transaction full hashes does not exist in the local transaction pool;
receiving and storing a third transaction pushed by the first transaction pool node;
when the packaging right of a first block with the first block height is obtained, packaging a plurality of transactions from a local transaction pool to generate a first block, and generating a first data set according to the first block; the first data set comprises first block header information of a first block and a first transaction full-hash list, wherein the first block header information comprises a first Meckel root, and the first Meckel root is generated by transaction full-hashes of packaged transactions; and (c) a second step of,
broadcasting the first set of data to other blockchain nodes for the other blockchain nodes:
searching each transaction of the first block in a local transaction pool according to the first transaction full hash list;
calculating a second Merkel root according to the searched transaction full hash of each transaction, and judging whether the second Merkel root is the same as the first Merkel root:
if yes, the first block is assembled and restored according to the first data set and the searched transactions;
otherwise, the first block is requested from the current node.
In a third aspect, the present invention also provides an apparatus comprising one or more processors and a memory, wherein the memory contains instructions executable by the one or more processors to cause the one or more processors to perform the anti-attack methods provided according to the embodiments of the present invention.
In a fourth aspect, the present invention also provides a storage medium storing a computer program that causes a computer to execute the attack prevention method provided according to the embodiments of the present invention.
According to the attack prevention method, the attack prevention device and the attack prevention storage medium provided by the embodiments of the invention, a first transaction full hash is generated according to a first transaction content and first signature information of a first transaction by receiving the first transaction sent by a client or broadcasted by other block chain nodes; when a second transaction which is identical to the first transaction in full hash does not exist in the local transaction pool, storing the first transaction and broadcasting the first transaction to other block link nodes; when the packaging right of a first block with the first block height is obtained, packaging a plurality of transactions from a local transaction pool to generate a first block, and generating a first data set according to the first block; the first data set comprises first block header information of a first block and a first transaction full-hash list, wherein the first block header information comprises a first Merkel root, and the first Merkel root is generated by transaction full-hash of packaged transactions; and broadcasting the first set of data to other blockchain nodes for the other blockchain nodes to: searching each transaction of the first block in a local transaction pool according to the first transaction full hash list; calculating a second Merkel root according to the found transaction full hash of each transaction, and judging whether the second Merkel root is the same as the first Merkel root: if yes, the first block is assembled and restored according to the first data set and the searched transactions; and if not, requesting the first block method from the current node, and improving the stability of the block chain.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
fig. 1 is a flowchart of an attack prevention method according to an embodiment of the present invention.
Fig. 2 is a flowchart of another anti-attack method according to an embodiment of the present invention.
Fig. 3 is a schematic structural diagram of an apparatus according to an embodiment of the present invention.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the present invention are shown in the drawings.
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
Fig. 1 is a flowchart of an attack prevention method according to an embodiment of the present invention. As shown in fig. 1, in this embodiment, the present invention provides an anti-attack method applied to a blockchain node, where a blockchain system does not support generation and execution of a transaction group, and the method includes:
s12: receiving a first transaction sent by a client or broadcast by other blockchain nodes, and generating a first transaction full hash according to first transaction content and first signature information of the first transaction;
s14: when a second transaction which is identical to the first transaction in full hash does not exist in the local transaction pool, storing the first transaction and broadcasting the first transaction to other block link nodes;
s161: when the packaging right of a first block with the first block height is obtained, packaging a plurality of transactions from a local transaction pool to generate a first block, and generating a first data set according to the first block; the first data set comprises first block header information of a first block and a first transaction full-hash list, wherein the first block header information comprises a first Merkel root, and the first Merkel root is generated by transaction full-hash of packaged transactions; and (c) a second step of,
s162: broadcasting the first set of data to other blockchain nodes for the other blockchain nodes:
searching each transaction of the first block in a local transaction pool according to the first transaction full hash list;
calculating a second Merkel root according to the found transaction full hash of each transaction, and judging whether the second Merkel root is the same as the first Merkel root:
if yes, the first block is assembled and restored according to the first data set and the searched transactions;
otherwise, the first block is requested from the current node.
Specifically, suppose there are four ABCD blockchain nodes in a blockchain, a user a is a malicious user, and the user a signs the same transaction content with the private keys of two accounts to generate two different transactions tx1 (sig _ a1 (content (M))) and tx2 (sig _ a2 (content (M))); A. b receives tx1 first, C and D receive tx2 first; assuming that a generates block (N) including tx1 (sig _ a1 (content (M))), tx3 (sig _ B (content (R))), tx4 (sig _ C (content (S))), a broadcasts a transaction hash list of block header (N) and block (N) to B, C, D;
in the transaction broadcast mechanism previously proposed by the applicant (specifically, refer to the various transaction broadcasts or the block broadcast patent texts applied by the applicant), the transaction hash is generated from the transaction content of the transaction, the merkel root in the block header information of the block is generated by the transaction hash calculation of each transaction of the block, and when a block link node receives a transaction, assuming that the transaction content is content (X), the block link node first determines whether another transaction identical to the content (X) already exists locally: if yes, discarding the newly received transaction; and if not, storing the newly received transaction into a local transaction pool. In the block verification mechanism previously proposed by the applicant (refer to patent texts such as each item of block generation, block broadcast or block verification, etc. applied by the applicant), the block chaining node of the generated block sends the data set of the generated block (including the block header information and the transaction hash list of the generated block) to other block chaining nodes; when other block chain nodes receive the block, all transactions of the received block are searched in a local transaction pool according to the transaction hash list, the Merkel root is calculated according to the transaction hash of the searched transactions, when the calculated Merkel root is judged to be the same as the Merkel root in the block header information, the first block is assembled and restored according to the received data set and the searched transactions, the restored first block is executed to obtain an execution result, and when the execution result is not consistent with the execution result in the block header information, the block chain node points consider that the problem (the Merkel root is the same, the execution result is different) is caused by inconsistent versions, and the block chain node points stop running and wait for version updating.
A. After receiving tx1 and then receiving tx2, A and B can not store tx2 into the local transaction pool because the transaction contents of tx1 and tx2 are the same; similarly, the tx1 is not stored in the local transaction pool by the C and the D; a broadcasts blockheader (N) (including Merkel root (generated from hash (content (M)), hash (content (R)), hash (content (S)), transaction hash list (hash (content (M)), hash (content (R)), hash (content (S))) to B, C, D;
b finds tx1 locally according to hash (content (M)), and C, D find tx2 locally according to hash (content (M)); since the transaction hash is generated from the transaction content of the transaction, the mekerr roots of a, B, C, D are all the same; under the condition that the Meckels root is the same, B, C and D assemble and restore block (N) according to the searched transaction, but first execution results generated when A and B execute block (N) are the same (actually executed are tx1, tx3 and tx 4), second execution results generated when C and D execute block (N) are the same (actually executed are tx2, tx3 and tx 4), and the first execution results are different from the second execution results. C. D considers that the problem is caused by version inconsistency, and C and D stop running and wait for version updating. Therefore, in the transaction broadcasting mechanism, one transaction can ensure that a plurality of block chain link points can not work normally, and the stability of block chain operation is reduced.
The problems generated by the above scenario can be solved through steps S12 to S162;
a, signing the same transaction content by using private keys of two accounts to generate two different transactions tx1 (sig _ a1 (content (M))) and tx2 (sig _ a2 (content (M))), A and B firstly receive tx1 (namely tx1 already exists in local transaction pools of A and B at the moment), and C and D firstly receive tx2 (namely tx1 already exists in local transaction pools of C and D at the moment); assuming that there are tx1, tx3, tx4 in the local transaction pool of a, and at this time, a receives tx2 again, a packages all transactions in the local transaction pool to generate a block (N ') (i.e., if tx2 is different from tx1, tx3, tx4, then block (N ') includes tx1, tx2, tx3, tx4; if tx2 is the same as tx1 or tx3 or tx4, then block (N ') includes tx1, tx3, tx 4);
step S12 is executed by a, receiving tx2, and generating a full hash of the transaction fullhash _ tx2 according to content (M) and sig _ a2, fullhash _ tx2= hash ((content (M) + sig _ a 2));
a performs step S14, since the transactions of the transactions in the local transaction pool are fully hashed to fullhash _ tx1 (fullhash _ tx1= hash ((content (M) + sig _ a 1))), fullhash _ tx3 (fullhash _ tx3= hash ((content (R) + sig _ B))), fullhash _ tx4 (fullhash _ tx4= hash ((content (S) + sig _ C))), fullhash _ tx1, fullhash _ tx3, and fullhash _ tx4 are all different from fullhash _ tx2, tx2 is stored and broadcasted to B, C, D;
B. c, executing steps S12 and S14 by the step D:
B. c, executing the step S12 by the step D is completely the same as executing the step S12 by the step A;
the execution of step S14 by B is identical to the execution of step S14 by a;
C. d, when the step S14 is executed, judging that fullhash _ tx2 exists in the local trading pool, and discarding tx2 by C and D;
step S161 is executed by a, which packs tx1, tx2, tx3, tx4 from the local trading pool to generate block (N '), and generates a data set of block (N ') from block (N ');
the data set of block (N ') comprises a block header (N ') and a block (N ') full hash list; the blockheader (N ') comprises a merklehashroot (N '), and the merklehashroot (N ') is generated according to fullhash _ tx1, fullhash _ tx2, fullhash _ tx3 and fullhash _ tx4; the full hash list is hash (content (M) + sig _ a 1), hash (content (M) + sig _ a 2), hash (content (R) + sig _ b), hash (content (S) + sig _ c);
a executes step S162, and broadcasts the data set of block (N') to B, C and D;
B. c, D, searching each transaction of block (N') according to the full hash list;
assuming that the transactions searched by the B and the C are tx1, tx2, tx3 and tx4, and D is tx1, tx2, tx3 and tx4' due to the error of the local transaction pool database;
B. c, calculating a Merkel root according to the transaction full hash of tx1, tx2, tx3 and tx4, and assembling a reduction block (N ') according to the data set of the block (N ') and tx1, tx2, tx3 and tx4 if the calculated Merkel root is the same as merkleashroot (N ');
d, calculating a Merkel root according to the transaction full hash of tx1, tx2, tx3 and tx4', and requesting block (N ') from A if the calculated Merkel root is different from merklehashroot (N ').
In the above embodiment, the block link point does not stop operating, increasing the stability of the block chain operation.
Preferably, the transaction further comprises a round, storing the first transaction and broadcasting the first transaction to other tile linked points comprises:
judging whether the first round of the first transaction reaches a first value:
if yes, storing the first transaction and broadcasting the first transaction full hash to other blockchain nodes;
if not, storing the first transaction and broadcasting the first transaction to other block chain nodes.
Assuming that the preconfigured first value is 5 and that every time a transaction is received by one node, the round = round +1, the initial value of the round is 0;
when the round of tx2 received is [0,4], A stores tx2 and broadcasts tx2 to B, C, D;
when the round of tx2 reception is [5, ∞ ], A stores tx2 and broadcasts fullhash _ tx2 to B, C, D.
The above embodiments reduce the size of the transmitted data in the blockchain network.
Fig. 2 is a flowchart of another anti-attack method according to an embodiment of the present invention. As shown in fig. 2, in this embodiment, the present invention provides an anti-attack method applied to a blockchain node, where the blockchain network is configured with a corresponding transaction pool network, the transaction pool network includes a plurality of transaction pool nodes that communicate with each other, each blockchain node is respectively registered with a push address for pushing a new transaction at any transaction pool node, and the blockchain system does not support generation and execution of a transaction group, where the method includes:
s22: receiving and storing a first transaction sent by a client, generating a first transaction full hash according to first transaction content and first signature information of the first transaction, broadcasting the first transaction full hash to other block chain nodes, sending the first transaction to a first transaction pool node for broadcasting the first transaction to other transaction pool nodes, and pushing the first transaction to a plurality of block chain nodes according to registered push addresses;
s24: receiving second transaction full hashes broadcast by other blockchain nodes, and monitoring whether a second transaction is received or not when the second transaction which is the same as the first transaction full hashes does not exist in the local transaction pool;
s26: receiving and storing a third transaction pushed by the first transaction pool node;
s281: when the packaging right of a first block with the first block height is obtained, packaging a plurality of transactions from a local transaction pool to generate a first block, and generating a first data set according to the first block; the first data set comprises first block header information of a first block and a first transaction full-hash list, wherein the first block header information comprises a first Merkel root, and the first Merkel root is generated by transaction full-hash of packaged transactions; and the number of the first and second groups,
s282: broadcasting the first set of data to other blockchain nodes for the other blockchain nodes:
searching each transaction of the first block in a local transaction pool according to the first transaction full hash list;
calculating a second Merkel root according to the found transaction full hash of each transaction, and judging whether the second Merkel root is the same as the first Merkel root:
if yes, the first block is assembled and restored according to the first data set and the searched transactions;
otherwise, the first block is requested from the current node.
In the above embodiments, the steps S281 and S282 may refer to the methods of S161 and S162 shown in fig. 1, and are not described herein again.
Steps S22 to S26 of the above embodiment are different from steps S12 to S14 shown in fig. 1 in that, in the method shown in fig. 1, a, B, C, and D are connected to each other, then B will receive tx2 at least 3 times, whereas in the present application, B will receive tx2 only once, and has a data volume much smaller than tx2 for at least 3 times, so S22 to S26 reduce transaction redundancy and improve transmission efficiency.
In the above embodiment, the block link point also does not stop running, increasing the stability of the block chain running.
Preferably, monitoring whether the second transaction is received comprises:
when a second transaction corresponding to the second transaction hash is not received within a preconfigured first time length, requesting the second transaction from the block chain node which sends the second transaction full hash;
a second transaction is received and stored.
Fig. 3 is a schematic structural diagram of an apparatus according to an embodiment of the present invention.
As shown in fig. 3, as another aspect, the present application also provides an apparatus 300 including one or more Central Processing Units (CPUs) 301 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 302 or a program loaded from a storage section 308 into a Random Access Memory (RAM) 303. In the RAM303, various programs and data necessary for the operation of the apparatus 300 are also stored. The CPU301, ROM302, and RAM303 are connected to each other via a bus 304. An input/output (I/O) interface 305 is also connected to bus 304.
The following components are connected to the I/O interface 305: an input portion 306 including a keyboard, a mouse, and the like; an output section 307 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 308 including a hard disk and the like; and a communication section 309 including a network interface card such as a LAN card, a modem, or the like. The communication section 309 performs communication processing via a network such as the internet. A drive 310 is also connected to the I/O interface 305 as needed. A removable medium 311 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 310 as necessary, so that a computer program read out therefrom is mounted into the storage section 308 as necessary.
In particular, according to an embodiment of the present disclosure, the method described in any of the above embodiments may be implemented as a computer software program. For example, embodiments of the present disclosure include a computer program product comprising a computer program tangibly embodied on a machine-readable medium, the computer program comprising program code for performing any of the methods described above. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 309, and/or installed from the removable medium 311.
As yet another aspect, the present application also provides a computer-readable storage medium, which may be the computer-readable storage medium included in the apparatus of the above-described embodiment; or it may be a separate computer readable storage medium not incorporated into the device. The computer readable storage medium stores one or more programs for use by one or more processors in performing the methods described in the present application.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units or modules described in the embodiments of the present application may be implemented by software or hardware. The described units or modules may also be provided in a processor, for example, each of the described units may be a software program provided in a computer or a mobile intelligent device, or may be a separately configured hardware device. Wherein the designation of such a unit or module does not in some way constitute a limitation on the unit or module itself.
The above description is only a preferred embodiment of the application and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention herein disclosed is not limited to the particular combination of features described above, but also encompasses other arrangements formed by any combination of the above features or their equivalents without departing from the spirit of the present application. For example, the above features may be replaced with (but not limited to) features having similar functions disclosed in the present application.

Claims (6)

1. An anti-attack method, wherein a blockchain system does not support generation and execution of transaction groups, the method being applicable to blockchain nodes, the method comprising:
receiving a first transaction sent by a client or broadcast by other blockchain nodes, and generating a first transaction full hash according to first transaction content and first signature information of the first transaction;
when a second transaction which is identical to the first transaction in full hash does not exist in a local transaction pool of a current node, storing the first transaction and broadcasting the first transaction to other block chain nodes;
when the packaging right of a first block with the height of the first block is obtained, packaging a plurality of transactions from a local transaction pool of a current node to generate the first block, and generating a first data set according to the first block; wherein the first data set comprises first chunk header information and a first transaction full hash list of the first chunk, the first chunk header information comprising a first Merkel root, the first Merkel root generated from transaction full hashes of the packaged transactions; and the number of the first and second groups,
broadcasting the first data set to each other block link point for each other block link point to execute the following steps:
searching each transaction of the first block in the local transaction pools of the other block chain nodes according to the first transaction full hash list;
calculating a second Merkel root according to the found transaction full hash of each transaction, and judging whether the second Merkel root is the same as the first Merkel root:
if yes, the first block is assembled and restored according to the first data set and the searched transactions;
and if not, requesting the first block from the current node.
2. The method of claim 1, wherein a transaction further comprises a round, and wherein storing the first transaction and broadcasting the first transaction to other tile link points comprises:
judging whether the first round of the first transaction reaches a first value:
if yes, storing the first transaction and broadcasting the first transaction full hash to other block chain nodes;
and if not, storing the first transaction and broadcasting the first transaction to other block link points.
3. An anti-attack method is characterized in that a blockchain network is configured with a corresponding transaction pool network, the transaction pool network comprises a plurality of mutually communicated transaction pool nodes, each blockchain node is respectively registered with a push address for pushing a new transaction at any transaction pool node, a blockchain system does not support generation and execution of a transaction group, and the method is applicable to the blockchain nodes and comprises the following steps:
receiving and storing a first transaction sent by a client, generating a first transaction full hash according to first transaction content and first signature information of the first transaction, broadcasting the first transaction full hash to other block chain nodes, sending the first transaction to a first transaction pool node for broadcasting the first transaction to other transaction pool nodes, and pushing the first transaction to a plurality of block chain nodes according to registered push addresses;
receiving second transaction full hashes broadcast by other blockchain nodes, and monitoring whether a second transaction is received or not when the second transaction which is the same as the first transaction full hash does not exist in a local transaction pool of the current node;
receiving and storing a third transaction pushed by the first transaction pool node;
when the packaging right of a first block with the height of the first block is obtained, packaging a plurality of transactions from a local transaction pool of a current node to generate the first block, and generating a first data set according to the first block; wherein the first data set comprises first chunk header information and a first transaction full hash list of the first chunk, the first chunk header information comprising a first Merkel root, the first Merkel root generated from transaction full hashes of the packaged transactions; and the number of the first and second groups,
broadcasting the first data set to each other block link point for each other block link point to execute the following steps:
searching each transaction of the first block in a local transaction pool of the other block link nodes according to the first transaction full hash list;
calculating a second Merkel root according to the found transaction full hash of each transaction, and judging whether the second Merkel root is the same as the first Merkel root:
if yes, the first block is assembled and restored according to the first data set and the searched transactions;
and if not, requesting the first block from the current node.
4. The method of claim 3, wherein the monitoring whether the second transaction is received comprises:
when a second transaction corresponding to the second transaction hash is not received within a preconfigured first time length, requesting the second transaction to a block link node which sends the second transaction hash;
receiving and storing the second transaction.
5. An apparatus, characterized in that the apparatus comprises:
one or more processors;
a memory for storing one or more programs,
the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method recited in any of claims 1-4.
6. A storage medium storing a computer program, characterized in that the program, when executed by a processor, implements the method according to any one of claims 1-4.
CN202010373917.1A 2020-05-06 2020-05-06 Anti-attack method, device and storage medium Active CN111523897B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010373917.1A CN111523897B (en) 2020-05-06 2020-05-06 Anti-attack method, device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010373917.1A CN111523897B (en) 2020-05-06 2020-05-06 Anti-attack method, device and storage medium

Publications (2)

Publication Number Publication Date
CN111523897A CN111523897A (en) 2020-08-11
CN111523897B true CN111523897B (en) 2023-04-07

Family

ID=71908629

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010373917.1A Active CN111523897B (en) 2020-05-06 2020-05-06 Anti-attack method, device and storage medium

Country Status (1)

Country Link
CN (1) CN111523897B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112732720B (en) * 2021-01-11 2022-05-24 杭州复杂美科技有限公司 Data storage method, data query method, computer device and storage medium
CN113626530A (en) * 2021-09-03 2021-11-09 杭州复杂美科技有限公司 Block generation method, computer device and storage medium

Family Cites Families (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10198325B2 (en) * 2016-05-24 2019-02-05 Mastercard International Incorporated Method and system for desynchronization recovery for permissioned blockchains using bloom filters
CN106650495B (en) * 2016-12-16 2019-07-16 杭州嘉楠耘智信息科技有限公司 File verification method and device
KR101924026B1 (en) * 2017-11-10 2018-11-30 부산대학교 산학협력단 System and method for blockchain using hash-based signature scheme
CN108108487B (en) * 2018-01-10 2019-11-22 杭州复杂美科技有限公司 A kind of common recognition method of block chain
CN108984662B (en) * 2018-06-28 2021-02-09 杭州复杂美科技有限公司 Block chain data synchronization method
CN109034807B (en) * 2018-08-15 2021-07-06 杭州复杂美科技有限公司 Block chain data synchronization method
US11196542B2 (en) * 2018-08-29 2021-12-07 International Business Machines Corporation Checkpointing for increasing efficiency of a blockchain
CN109146484A (en) * 2018-08-31 2019-01-04 深圳付贝科技有限公司 Common recognition verification method, digging mine machine and block catenary system based on block chain
CN109447641B (en) * 2018-10-26 2022-03-04 众安信息技术服务有限公司 Method and apparatus for transmitting blockchain data to blockchain browser
CN109409889B (en) * 2018-11-13 2021-11-12 杭州秘猿科技有限公司 Block determining method and device in block chain and electronic equipment
CN109586934A (en) * 2018-12-27 2019-04-05 链极智能科技(上海)有限公司 A kind of block chain bottom-layer network transaction Synchronous fluorimetry method
CN109784928B (en) * 2019-01-23 2024-04-12 众安信息技术服务有限公司 Information processing method and information processing device based on block chain
CN110336676A (en) * 2019-07-15 2019-10-15 杭州复杂美科技有限公司 A kind of block chain transaction broadcasting method and system, equipment and storage medium
CN110443610A (en) * 2019-07-15 2019-11-12 杭州复杂美科技有限公司 For reducing method and system, equipment and the storage medium of trading group repeated broadcast
CN110503558B (en) * 2019-08-29 2023-10-03 深圳前海微众银行股份有限公司 Processing method and device based on block chain system
CN110647582B (en) * 2019-09-17 2024-01-02 腾讯科技(深圳)有限公司 Method, device, storage medium and computer equipment for block chain network consensus verification

Also Published As

Publication number Publication date
CN111523897A (en) 2020-08-11

Similar Documents

Publication Publication Date Title
KR102548540B1 (en) Method and apparatus for cross-ledger transfer between distributed ledgers and systems using cross-ledger transfer
US20210243032A1 (en) Sending cross-chain authenticatable messages
WO2020143853A2 (en) Distributed blockchain data storage under account model
CN110751475A (en) Cross-chain method, system, equipment and storage medium for blockchain transaction
CN102970284B (en) User profile processing method and server
EP3837652A2 (en) Distributed blockchain data storage under account model
US20200366485A1 (en) Method and apparatus for inter-blockchain transmission of authenticable message
CN112583811B (en) Wallet finding method, equipment and storage medium
CN111523897B (en) Anti-attack method, device and storage medium
CN112600664B (en) Delayed transaction generation method, delayed transaction execution device and storage medium
EP3769230B1 (en) Taking snapshots of blockchain data
WO2023016426A1 (en) Asynchronous binary agreement method and apparatus, and electronic device and storage medium
CN105553727A (en) Method, device and system for updating configuration information
CN102984277B (en) Prevent the system and method that malice connects
CN111523896B (en) Attack prevention method, apparatus and storage medium
WO2020098817A2 (en) Taking snapshots of blockchain data
US20240202356A1 (en) Methods for verifying database query results and devices thereof
CN104580428A (en) Data routing method, data management device and distributed storage system
CN110928952A (en) Data synchronization method and device based on block chain
CN102984276B (en) For the distributor distributed multiple socket server and distribution method
CN111524011B (en) Parallel link consensus validation method, apparatus, and storage medium
CN103701844A (en) User information management method and system
CN116542668A (en) Block chain-based data processing method, equipment and readable storage medium
CN111639939A (en) Block restoring method, equipment and storage medium
WO2021222078A1 (en) High performance distributed system of record with unspent transaction output (utxo) database snapshot integrity

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
GR01 Patent grant
GR01 Patent grant