Improved anti-replay device based on storage space swap
By dividing the memory into a work segment and a backup segment in the blockchain network and switching when the threshold condition is reached, a method of quickly identifying and replaying attacks is realized, solving the low efficiency of replay attacks in the blockchain network. The problem of the problem improves the recognition efficiency and accuracy.
Patent Information
- Application Number
- CN202210473217.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-06-26
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2039-06-26
AI Technical Summary
Existing technologies are difficult to quickly identify replay attacks, especially in blockchain networks, resulting in waste of computing resources and security threats.
By dividing the memory into a work segment and a backup segment, only the most recent transaction information is stored in the work segment and switching the segment when the threshold condition is reached, fast search and redundant storage are achieved to accelerate the identification of playback attacks.
It improves the efficiency and accuracy of identifying playback attacks, reduces computing resource consumption, stabilizes memory overhead, and provides a seamless segment switching mechanism.
Smart Images

Figure CN114666163B_ABST
Abstract
Description
Technical Field
[0001] This paper deals with identifying replay attacks (or replay attacks), in which transactions or transmissions are maliciously or fraudulently repeated, and proposes an improved anti-replay device based on storage space interchange. Background Art
[0002] A distributed ledger system (DLS), which may also be referred to as a consensus network and / or a blockchain network, enables participating entities to store data securely and immutably. Without reference to any specific use case, a DLS is often referred to as a blockchain network. Examples of types of blockchain networks may include public blockchain networks, private blockchain networks, and consortium blockchain networks. Consortium blockchain networks are provided for a select group of entities that control the consensus process and include an access control layer.
[0003] A replay attack may refer to an attacker sending packets that have already been received by the target host, such as transactions in a blockchain network. The purpose of a replay attack is to deceive the blockchain network. A replay attack may be performed by an initiator, such as a malicious computer user, who intercepts (e.g., by stealing) a transaction and resends data related to the transaction. Replay attacks can occur in any network communication process and are one of the most common attack methods used by malicious computer users.
[0004] Bloom filters can be used to identify whether a transaction has occurred. Bloom filters are data structures optimized for efficient insertion and querying, and can accept queries such as "something (transaction) must not exist or may exist" and return a probability value. Bloom filters have the advantages of being more efficient and consuming less computing resources (e.g., storage space) than traditional data structures. One disadvantage of Bloom filters is that the return value is probabilistic (i.e., inaccurate).
[0005] It is desirable to speed up the process of identifying duplicate transactions to more quickly identify replay attacks. Summary of the invention
[0006] This article describes techniques for identifying replay attacks using storage space swaps. These techniques generally involve storing transaction information (e.g., transaction identification (ID)). The memory used to store transaction information can be divided into a working segment and a backup segment. The working segment can be used to store current transaction information. Once the working segment is close to being full, the transaction can be stored in the backup segment. During the overlapping phase, transaction information can be stored in the working segment and the backup segment to provide redundancy. At the time of switching, the backup segment can be designated as the new working segment with transaction information written. Storing and searching transaction information only for the most recent transactions can speed up search time.
[0007] The present invention also provides one or more non-transitory computer-readable storage media coupled to one or more processors and having instructions stored thereon, which, when executed by the one or more processors, will cause the one or more processors to perform operations in accordance with an embodiment of the method provided herein.
[0008] The present invention also provides a system for implementing the method provided herein. The system includes one or more processors and a computer-readable storage medium coupled to the one or more processors and having instructions stored thereon, and when the instructions are executed by the one or more processors, the instructions will cause the one or more processors to perform operations according to the embodiments of the method provided herein.
[0009] It should be understood that the method according to this article may include any combination of aspects and features described herein. That is, the method according to this article is not limited to the combination of aspects and features specifically described herein, but also includes any combination of aspects and features provided.
[0010] The details of one or more embodiments of the present invention are set forth in the accompanying drawings and the description below. Other features and advantages of the present invention will be apparent from the description and drawings, and from the claims. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1 is a diagram illustrating an example of an environment that can be used to perform embodiments herein.
[0012] Figure 2 An exemplary architecture according to embodiments herein is described.
[0013] Figure 3 is a block diagram illustrating an example of a replay attack scenario according to embodiments of the present invention.
[0014] Figure 4 is a block diagram illustrating an example of a conventional system for detecting a replay attack according to an embodiment of this document.
[0015] Figure 5 is a block diagram illustrating an example of a system for detecting a replay attack according to an embodiment of the present invention.
[0016] Figure 6 is a flow chart describing an example of a method for detecting and disabling replay attacks.
[0017] Figure 7 Examples of modules of an apparatus according to embodiments herein are described.
[0018] Like reference numbers and designations in the various drawings indicate like elements. DETAILED DESCRIPTION
[0019] The present disclosure describes a scheme involving techniques for using storage space swapping to more efficiently identify replay attacks. Only information about recent transactions is stored in a working segment of a memory. When a threshold condition is determined to be reached, such as when the working segment is at a threshold percentage of being full, a switch is performed. During the switch, the backup segment becomes the working segment. During the overlap phase, transaction information may be stored in the working segment and the backup segment to provide redundancy. Storing and searching transaction information only for recent transactions may speed up search time. For example, the transaction may be a transaction in a blockchain.
[0020] To provide further context for the embodiments herein, and as described above, a distributed ledger system (DLS), which may also be referred to as a consensus network (e.g., composed of peer-to-peer nodes) and a blockchain network, enables participating entities to conduct transactions and store data securely and immutably. Although the term "blockchain" is often associated with a specific network and / or use case, "blockchain" is used herein to refer generally to a DLS without reference to any specific use case.
[0021] Blockchain is a data structure that stores transactions in a way that transactions cannot be tampered with. Therefore, transactions recorded on the blockchain are reliable and trustworthy. Blockchain includes one or more blocks. Each block in the chain is linked to the previous block by the cryptographic hash value of the previous block immediately before it in the chain. Each block also includes a timestamp, its own cryptographic hash value, and one or more transactions. Transactions that have been verified by nodes in the blockchain network are hashed and compiled into a Merkle tree. A Merkle tree is a data structure in which the data at the leaf nodes of the tree are hashed, and all hash values in each branch of the tree are concatenated at the root of the branch. This process continues along the tree until the root of the entire tree, where a hash value representing all the data in the tree is stored. By determining whether the hash value is consistent with the structure of the tree, it is possible to quickly verify whether the hash value is the hash value of the transaction stored in the tree.
[0022] A blockchain is a decentralized or at least partially decentralized data structure for storing transactions, and a blockchain network is a network of computing nodes that manage, update, and maintain one or more blockchains by broadcasting, verifying, and confirming transactions. As described above, a blockchain network may be provided as a public blockchain network, a private blockchain network, or a consortium blockchain network. The embodiments of the present invention are further described in detail herein with reference to a consortium blockchain network. However, it is contemplated that the embodiments of the present invention may be implemented in any suitable type of blockchain network.
[0023] Typically, a consortium blockchain network is private among participating entities. In a consortium blockchain network, the consensus process is controlled by an authorized set of nodes, which may be referred to as consensus nodes, and one or more consensus nodes are operated by the respective entity (e.g., financial institution, insurance company). For example, a consortium consisting of ten (10) entities (e.g., financial institutions, insurance companies) may operate a consortium blockchain network, with each entity operating at least one node in the consortium blockchain network.
[0024] In some examples, within a consortium blockchain network, a global blockchain is provided as a blockchain replicated across all nodes. That is, all consensus nodes are in full consensus with respect to the global blockchain. In order to reach consensus (e.g., agree to add a block to the blockchain), a consensus protocol is implemented within the consortium blockchain network. For example, the consortium blockchain network can implement Practical Byzantine Fault Tolerance (PBFT) consensus, which is described in further detail below.
[0025] Figure 1 1 is a diagram showing an example of an environment 100 that can be used to perform embodiments of the present invention. In some examples, the environment 100 enables entities to participate in a consortium blockchain network 102. The environment 100 includes computing devices 106, 108 and a network 110. In some examples, the network 110 includes a local area network (LAN), a wide area network (WAN), the Internet, or a combination thereof, and connects websites, user devices (e.g., computing devices), and backend systems. In some examples, the network 110 can be accessed through a wired and / or wireless communication link. In some examples, the network 110 enables communication with the consortium blockchain network 102 or communication within the consortium blockchain network 102. In general, the network 110 represents one or more communication networks. In some cases, the computing devices 106, 108 can be nodes of a cloud computing system (not shown), or each computing device 106, 108 can be a separate cloud computing system that includes multiple computers interconnected by a network and used as a distributed processing system.
[0026] In the depicted example, computing devices 106, 108 may each include any suitable computing device capable of participating as a node in consortium blockchain network 102. Examples of computing devices include, but are not limited to, servers, desktop computers, laptops, tablets, and smartphones. In some examples, computing devices 106, 108 host one or more computer-implemented services for interacting with consortium blockchain network 102. For example, computing device 106 may host a computer-implemented service, such as a transaction management system, for a first entity (e.g., user A), for example, the first entity uses the transaction management system to manage its transactions with one or more other entities (e.g., other users). Computing device 108 may host a computer-implemented service, such as a transaction management system, for a second entity (e.g., user B), for example, the second entity uses the transaction management system to manage its transactions with one or more other entities (e.g., other users). Figure 1 In the example of , the consortium blockchain network 102 is shown as a peer-to-peer network of nodes, and the computing devices 106 and 108 provide nodes of a first entity and a second entity participating in the consortium blockchain network 102, respectively.
[0027] Figure 2 An exemplary conceptual architecture 200 according to embodiments herein is depicted. The exemplary conceptual architecture 200 includes participant systems 202, 204, 206 corresponding to participant A, participant B, and participant C, respectively. Each participant (e.g., user, enterprise) participates in a blockchain network 212 provided as a peer-to-peer network that includes a plurality of nodes 214, at least some of which immutably record information in a blockchain 216. As further detailed herein, although a single blockchain 216 is schematically depicted in the blockchain network 212, multiple copies of the blockchain 216 are provided and maintained on the blockchain network 212.
[0028] In the depicted example, each participant system 202, 204, 206 is provided by or on behalf of participant A, participant B, and participant C, respectively, and functions as a respective node 214 in the blockchain network. As used herein, a node generally refers to a single system (e.g., computer, server) that is connected to the blockchain network 212 and enables the corresponding participant to participate in the blockchain network. Figure 2In the example of , a participant corresponds to each node 214. However, it is contemplated that one participant may operate multiple nodes 214 within the blockchain network 212, and / or multiple participants may share a node 214. In some examples, the participant systems 202, 204, 206 communicate with or through the blockchain network 212 using a protocol (e.g., Hypertext Transfer Protocol Secure (HTTPS)) and / or using remote procedure calls (RPCs).
[0029] Nodes 214 may have different levels of participation within blockchain network 212. For example, some nodes 214 may participate in the consensus process (e.g., as miner nodes that add blocks to blockchain 216), while other nodes 214 do not participate in this consensus process. As another example, some nodes 214 store a complete copy of blockchain 216, while other nodes 214 store only a copy of a portion of blockchain 216. For example, data access privileges may limit the blockchain data that a corresponding participant stores within their corresponding system. Figure 2 In the example of FIG. 2 , participant systems 202 , 204 , 206 store complete copies 216 ′, 216 ″, 216 ′″ of blockchain 216 , respectively.
[0030] Blockchain (e.g. Figure 2 The blockchain 216 includes a chain of blocks, each of which stores data. Examples of data include transaction data representing a transaction between two or more participants. Although "transaction" is used herein by way of non-limiting example, it is contemplated that any suitable data (e.g., documents, images, videos, audio) may be stored in the blockchain. Examples of transactions may include, but are not limited to, exchanging valuables (e.g., assets, products, services, currency). Transaction data is stored in an unalterable manner in the blockchain. That is, the transaction data cannot be changed.
[0031] Before storing the transaction data in the block, the transaction data is hashed. Hashing is the process of converting the transaction data (provided as string data) into a fixed-length hash value (also provided as string data). The hash value cannot be un-hashed to obtain the transaction data. Hashing ensures that even a slight change in the transaction data will result in a completely different hash value. In addition, as mentioned above, the hash value has a fixed length. That is, regardless of the size of the transaction data, the length of the hash value is fixed. Hashing includes processing the transaction data through a hash function to generate a hash value. Examples of hash functions include (but are not limited to) the Secure Hash Algorithm (SHA)-256, which outputs a 256-bit hash value.
[0032] The transaction data of multiple transactions are hashed and stored in a block. For example, the hashes of two transactions are provided and they themselves are hashed to provide another hash. The process is repeated until a single hash is provided for all transactions to be stored in a block. This hash is called the Merkle root hash and is stored in the header of the block. Changes in any transaction will cause its hash to change and ultimately the Merkle root hash to change.
[0033] Blocks are added to the blockchain through a consensus protocol. Multiple nodes in the blockchain network participate in the consensus protocol and perform the work of adding blocks to the blockchain. Such nodes are called consensus nodes. The PBFT introduced above is used as a non-limiting example of a consensus protocol. Consensus nodes execute the consensus protocol to add transactions to the blockchain and update the overall state of the blockchain network.
[0034] In more detail, the consensus node generates a block header, hashes all transactions in the block, and combines the hashes in pairs to generate further hashes until a single hash (Merkle root hash) is provided for all transactions in the block. This hash is added to the block header. The consensus node also determines the hash of the latest block in the blockchain (i.e., the last block added to the blockchain). The consensus node also adds a random number (nonce) and a timestamp to the block header.
[0035] In general, PBFT provides practical Byzantine state machine replication that tolerates Byzantine faults (e.g., faulty nodes, malicious nodes). This is achieved in PBFT by assuming that failures will occur (e.g., assuming that there are independent node failures and / or manipulated messages sent by consensus nodes). In PBFT, consensus nodes are provided in a sequence that includes a primary consensus node and a backup consensus node. The primary consensus node is changed periodically, and transactions are added to the blockchain by reaching a consensus on the global state of the blockchain network by all consensus nodes within the blockchain network. In this process, messages are transmitted between consensus nodes, and each consensus node proves that the message is received from a designated peer node and verifies that the message has not been tampered with during transmission.
[0036] In PBFT, the consensus protocol is provided in multiple stages with all consensus nodes starting in the same state. First, the client sends a request to the primary consensus node to invoke a service operation (e.g., execute a transaction within the blockchain network). In response to receiving the request, the primary consensus node multicasts the request to the backup consensus nodes. The backup consensus nodes execute the request and each sends a reply to the client. The client waits until a threshold number of replies are received. In some examples, the client waits until f+1 replies are received, where f is the maximum number of faulty consensus nodes that can be tolerated within the blockchain network. The end result is that a sufficient number of consensus nodes agree on the order in which records are added to the blockchain, and the record is either accepted or rejected.
[0037] In some blockchain networks, cryptography is implemented to maintain the privacy of transactions. For example, if two nodes want to keep a transaction private so that other nodes in the blockchain network cannot see the details of the transaction, the two nodes can encrypt the transaction data. Examples of encryption include, but are not limited to, symmetric encryption and asymmetric encryption. Symmetric encryption refers to encryption that uses a single key to both encrypt (generate ciphertext from plaintext) and decrypt (generate plaintext from ciphertext). In symmetric encryption, the same key can be used for multiple nodes, so each node can encrypt / decrypt transaction data.
[0038] Asymmetric encryption uses key pairs, each of which consists of a private key and a public key, where the private key is known only to the corresponding node and the public key is known to any or all other nodes in the blockchain network. A node can encrypt data using the public key of another node, and the encrypted data can be decrypted using the private key of the other node. For example, referring again to Figure 2 , participant A can use participant B's public key to encrypt data and send the encrypted data to participant B. Participant B can use its private key to decrypt the encrypted data (ciphertext) and extract the original data (plaintext). Messages encrypted using a node's public key can only be decrypted using the node's private key.
[0039] Asymmetric encryption is used to provide digital signatures, which enables participants in a transaction to confirm the other participants in the transaction and the validity of the transaction. For example, a node can digitally sign a message, and another node can confirm that the message was sent by the node based on the digital signature of participant A. Digital signatures can also be used to ensure that the message has not been tampered with during transmission. For example, again referring to Figure 2, participant A sends a message to participant B. Participant A generates a hash value of the message and then encrypts the hash value using its private key to provide a digital signature that is the encrypted hash value. Participant A appends the digital signature to the message and sends the message with the digital signature to participant B. Participant B decrypts the digital signature using participant A's public key and extracts the hash value. Participant B hashes the message and compares the hash values. If the hash values are the same, participant B can confirm that the message is indeed from participant A and has not been tampered with.
[0040] In some cases, a blockchain can be attacked by a malicious agent. For example, a malicious agent such as a software robot (also known as, for example, an Internet robot, a web robot, a World Wide Web (WWW) robot, or a robot) can launch a replay attack on a blockchain. A replay attack can attempt to cause transactions in a blockchain to be reprocessed, which can cause other problems: waste of computing resources (e.g., processing speed, network bandwidth, memory usage, and data storage usage) or loss of property (e.g., a certain amount of currency).
[0041] Figure 3 304. The replay attack scenario 300 includes a replay attack that includes replaying a transaction that was about to occur between a sender bank Alice 302 and a receiver bank Bob 304. The transaction includes a remittance request information 306 and a correct MAC value 308 provided by Alice 302. For example, during the transaction, stealing and saving 310 may occur by a malicious agent who steals or saves transaction information, including stealing the remittance request information 312 and stealing (or stealing from) the correct MAC value 314 provided by Alice 302. In this example, the malicious agent is an active attacker Mallory 316. The active attacker Mallory 316 may use the remittance request information 320 and the correct MAC value 322 to launch a replay attack 318. During the replay attack 324, the active attacker Mallory 316 may repeatedly send a combination of previously stolen and saved information and MAC values.
[0042] Anti-replay attack techniques, such as the techniques described in this disclosure for preventing replay attacks 324, are generally more difficult to implement in decentralized systems than in centralized systems. The techniques described in this disclosure can provide improved high-performance, anti-replay techniques, such as enabling rapid searches of transaction information in stable storage spaces.
[0043] Figure 4 4 is a block diagram illustrating an example of a conventional system 400 for detecting a replay attack according to an embodiment of the present invention. The conventional system 400 includes a client 402 and a server 404.
[0044] At 406 , the client 402 prepares for the transaction. Flow proceeds from 406 to 408 .
[0045] At 408 , the client 402 initiates a transaction request 408 . The flow proceeds from 408 to 410 .
[0046] At 410 , server 404 performs a search for transactions in the Bloom filter.
[0047] At 412, a determination is made as to whether the transaction is found in the Bloom filter. If the transaction is not found in the Bloom filter, the process proceeds to 414, the transaction is executed normally, and the transaction request is processed. However, if the transaction is found in the Bloom filter, the process proceeds to 416, where the transaction is looked up in the blockchain.
[0048] At 418, it is determined whether the transaction is found in the blockchain. If the transaction is not found in the blockchain, the process proceeds to 414, the transaction is executed normally, and the transaction request is processed. However, if the transaction is found in the blockchain, the process proceeds to 420, and the transaction is bypassed.
[0049] For proper operation of a system such as conventional system 400, the size of the memory containing transaction information (e.g., transaction hash values (tx_hash) of processed transactions) is typically made as large as possible. For example, the memory size can be proportional to the size of the transaction information and the number of transactions. However, the techniques used by the present disclosure can take into account and use patterns of typical time distributions of typical replays. For example, the time window that includes normal transactions and also includes attempts to replay transactions is typically short. As a result, replay attempts of a combined transmission control protocol (TCP) associated with network retransmissions can be ignored after 5 minutes from the time a normal transaction occurs.
[0050] Figure 5 is a block diagram illustrating an example of a system 500 for detecting a replay attack according to embodiments herein. While system 500 includes components similar to those in system 400, it should be noted that system 500 includes optimizations to system 400. For example, in some embodiments, the optimizations can speed up identification of a replay attack. For example, system 500 can be used to perform a re-finding of transactions, such as after searching for transactions using a Bloom filter.
[0051] Processing within system 500 may begin in the same manner as conventional system 400. For example, at 406, client 402 prepares for a transaction.
[0052] At 408 , the client 402 initiates a transaction request 408 . The flow proceeds from 406 to 502 .
[0053] At 502 , a current working area 504 is determined. For example, at least initially in the current example, the current working area 504 may be segment A, while segment B may be used as a backup working area. Flow proceeds from 502 to 506 .
[0054] At 506, a search for transactions may be performed in the work section. Flow proceeds from 506 to 508.
[0055] At 508, it is determined whether the transaction is found in the working segment. If the transaction is not found in the working segment, then, at 510, it is determined whether a threshold for initiating a segment switch is exceeded. There may be a threshold such as when the working segment reaches a preset percentage of capacity (e.g., 95%).
[0056] If it is determined at 510 that the threshold is exceeded, then at 512 the backup segment is emptied to prepare the backup segment as a new working segment.
[0057] At 514 , the transaction information is written to the backup section. Flow proceeds from 514 to 516 .
[0058] During the overlapping phase when the transaction information is written in two locations in the memory, the writing is done in two segments. The redundancy of the written information can be used to form a backup segment with the most recent transactions until a switch is performed. At the time of the switch, the backup segment becomes the new working segment, and the transaction information is only written to the new working segment.
[0059] At 516, the transaction information is written to the current working section and the transaction is processed normally.
[0060] If it is determined at 508 that the transaction is found in the working section, the process proceeds to 518 to find the transaction in the blockchain.
[0061] At 520, a determination is made as to whether the transaction is found in the blockchain.
[0062] At 522, if the transaction is found in the blockchain at 520, the transaction is considered to be a duplicate transaction and is skipped at 522. Otherwise, at 516 the transaction information is written to the current working section and the transaction is processed normally.
[0063] In some embodiments, the system 500 operates smoothly and efficiently because the storage space of the system 500 can be divided into equal parts (e.g., segment A and segment B) that can be used interchangeably to perform the retrieval operation. The storage space can store transaction information (e.g., transaction ID), which can be used for the retrieval operation. At any given time, only one of the segments is used as a working segment in the memory, and the other segment is a backup segment in the memory. The search performed at 508 during the retrieval operation is performed only on one half of the memory, specifically on the working segment. In the current example, segment A is initially the working segment in the memory, and segment B is initially the backup segment in the memory. When segment A is the working segment, the retrieval operation searches only segment A.
[0064] After a period of time, the storage space in segment A may be filled with transaction information. At some point in time, such as when a threshold condition is reached, it is necessary to prepare for a memory segment switch to occur at some time. When the switch is completed, segment A (initially the working segment in the current example) will stop being the working segment and will become the backup segment. At the same time, segment B will stop being the backup segment and will become the working segment.
[0065] In preparation for the switch, there may be an overlapping phase during which transaction information written to the working segment may be redundantly written to the backup segment. For example, when the switch is about to occur, transaction information may be written to segment A and segment B. This occurs, for example, when segment A is still the working segment and segment B (currently the backup segment) is about to become the working segment. Segment B requires at least transaction information for a smaller number of transactions, so that when segment A is no longer the working segment, transaction information for a useful number of transactions will be written to segment B (e.g., for searching in a re-find operation).
[0066] During normal operation, the workflow of system 500 skips steps 512 and 514. However, during a switch (determined at 510 to exceed the threshold), steps 512 and 514 are performed. At the switch, or more specifically at the beginning of the overlap phase, the backup segment is cleared to prepare for writing transaction information.
[0067] In some embodiments, various thresholds may be used at 510. For example, in addition to a threshold of a percentage of the working area used (eg, 95%), a switch may be initiated when the false positive rate of the working segment exceeds 10%.
[0068] Advantages may include one or more of the following. First, the memory overhead used to determine anti-replay during system operation remains stable. Second, dividing the memory into two identical partitions (working segment and backup segment) can improve the efficiency of the anti-replay algorithm. For example, hash map algorithms may suffer from conflicts between used spaces, and Bloom filters may cause a probability of misjudgment that is proportional to the sum of the allocated space and historical data. In addition, a double write mechanism during switching can provide seamless switching between the working segment and the backup segment.
[0069] Figure 6 is a flow chart describing an example of a method 600 for detecting and inhibiting replay attacks. For convenience, the method 600 will be described as being performed by a system of one or more computers located in one or more locations and appropriately programmed according to the present disclosure. For example, an appropriately programmed system for detecting and inhibiting replay attacks (e.g., Figure 5 The system 500) can execute the method 600.
[0070] At 602, a transaction to be completed in a blockchain is received. For example, client 402 may initiate a transaction request 408 that may be received by server 404. In some embodiments, the transaction request may be a transaction that may be sent within a blockchain. Method 600 proceeds from 602 to 604.
[0071] At 604, a current working segment in a memory for storing transaction information is determined, the current working segment being designated for identifying processed historical transactions. The memory also stores a backup segment that provides an alternative storage segment storage solution for transaction information when used in combination with the current working segment. For example, the system 500 (e.g., at 502) can determine whether the current working segment in the memory is segment A or segment B. From 604, the method 600 proceeds to 606.
[0072] At 606, a determination is made using the current working segment whether the transaction has been previously processed. For example, the system 500 may access (e.g., at 506) transaction information in segment A and determine (e.g., at 508) that the transaction has been processed. In some embodiments, a database flag or other indication may indicate which segment in memory, such as segment A or segment B, is the current working segment. From 606, the method 600 proceeds to 608.
[0073] At 608, when it is determined that the transaction has been previously processed, the transaction is skipped. As an example, the system 500 (e.g., at 516) can process the transaction normally. In addition, the system 500 can write the transaction information to the current working section. From 608, the method 600 proceeds to 610.
[0074] At 610, when it is determined that the transaction has not been previously processed, the transaction is processed and the transaction information of the transaction is written to the current working segment. As an example, the system 500 can skip the transaction at 516, for example, write the transaction information to segment A and process the transaction normally. After 610, the method 600 can stop.
[0075] In some embodiments, the method 600 further includes a step for performing a switch between the current working segment and the backup segment. For example, the system 500 may determine whether a threshold condition for initiating a switch between the current working segment and the backup segment is met. In some embodiments, the threshold condition is an indication of a preset percentage (e.g., 95%) of the used storage capacity of the current working segment. In some embodiments, the threshold condition is an indication that the misjudgment rate of the current working segment exceeds a preset rate (e.g., 10%). When it is determined that the threshold condition is met, the switch is initiated, including starting an overlap phase, in which the transaction information is written to the current working segment and the backup segment. When the overlap phase is started, the backup segment is cleared. During the overlap phase, the transaction information is written to the backup segment.
[0076] In some embodiments, method 600 may further include a step that occurs at the end of the overlap phase, for example, system 500 may determine whether the end of the overlap phase has been reached. At this point, system 500 may cease writing transaction information to the current working segment, and system 500 may designate the backup segment as the current working segment.
[0077] In some embodiments, method 600 also includes a step for determining whether the transaction is in the blockchain, for example, system 500 can search the blockchain to determine whether the transaction is in the blockchain. When it is determined that the transaction is in the blockchain, system 500 can skip the transaction.
[0078] In some embodiments, method 600 also includes using a Bloom filter to determine the probability that a transaction already exists. For example, before determining that a transaction has been previously processed, system 500 can use a Bloom filter to determine the probability that a transaction has been previously processed. A high probability can indicate that a transaction has been previously processed.
[0079] Figure 7 An example of modules of an apparatus 700 according to embodiments herein is depicted.
[0080] The device 700 may be an example of an embodiment of a device for detecting and inhibiting replay attacks. The device 700 may correspond to the embodiment described above, and the device 700 includes the following: a receiving module 702 for receiving a transaction to be completed in a blockchain; a first determining module 704 for determining a current working segment in a memory for storing transaction information, the current working segment being designated for identifying processed historical transactions, the memory also storing a backup segment, the backup segment providing a replacement storage segment storage solution for the transaction information when used in combination with the current working segment; a second determining module 706 for determining whether the transaction has been previously processed according to the current working segment; a skipping module 708 for skipping the transaction when it is determined that the transaction has been previously processed; when it is determined that the transaction has not been previously processed: a processing module 710 for processing the transaction; and a writing module 712 for writing the transaction information of the transaction into the current working segment.
[0081] In an optional embodiment, the apparatus 700 further includes a determination module (eg, the first determination module 704, the second determination module 706, or another determination module) for determining whether a threshold condition for initiating a switch between the current working segment and the backup segment is met.
[0082] In an optional embodiment, the device 700 also includes, when it is determined that the threshold condition is met: an initiating module for initiating switching, including starting an overlapping phase, in which transaction information is written to the current working segment and the backup segment; a clearing module for clearing the backup segment; and a writing module (for example, the writing module 712 or another writing module) for writing the transaction information to the backup segment.
[0083] In an optional embodiment, the device 700 also includes: a determination module (for example, a first determination module 704, a second determination module 706 or another determination module) for determining that the end of the overlapping phase has been reached; a stop module for stopping writing transaction information to the current working segment; and a designation module for designating the backup segment as the current working segment.
[0084] In an optional embodiment, the threshold condition is an indication of a preset percentage of used storage capacity of the current working section, or an indication that a false positive rate of the current working section exceeds a preset rate.
[0085] In an optional embodiment, the device 700 also includes a determination module (e.g., the first determination module 704, the second determination module 706, or another determination module) for determining whether the transaction is in the blockchain; and a skip module (e.g., the skip module 710 or another skip module) for skipping the transaction when it is determined that the transaction is in the blockchain.
[0086] In an optional embodiment, the apparatus 700 further includes: a determination module (eg, the first determination module 704, the second determination module 706 or another determination module) for determining the probability that the transaction has been previously processed using a Bloom filter before determining whether the transaction has been previously processed.
[0087] The systems, devices, modules or units shown in the previous embodiments may be implemented by using a computer chip or entity, or may be implemented by using a product with specific functions. A typical implementation device is a computer, which may be a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver device, a game console, a tablet computer, a wearable device or any combination of these devices.
[0088] For the embodiments of the functions and roles of each module in the device, reference may be made to the embodiments of the corresponding steps in the previous method. For simplicity, the details are omitted here.
[0089] Since the device embodiment basically corresponds to the method embodiment, for the relevant parts, reference can be made to the relevant description in the method embodiment. The device embodiment described previously is only an example. The modules described as separate parts may or may not be physically separated, and the parts shown as modules may or may not be physical modules, may be located in one location, or may be distributed on multiple network modules. Some or all modules may be selected based on actual needs to achieve the goals of the scheme herein. Those of ordinary skill in the art can understand and implement the embodiments of the present application without paying creative work.
[0090] Reference again Figure 7 , which can be interpreted as showing the internal functional modules and structure of the device for detecting and prohibiting replay attacks. In essence, the execution subject can be an electronic device, which includes: one or more processors; a memory configured to store executable instructions of one or more processors.
[0091] One or more processors are configured to receive a transaction to be completed in a blockchain; determine a current working segment in a memory for storing transaction information, the current working segment being designated for identifying processed historical transactions, the memory also storing a backup segment, the backup segment providing an alternative storage segment storage solution for the transaction information when used in combination with the current working segment. Determine whether the transaction has been previously processed based on the current working segment; when it is determined that the transaction has been previously processed, skip the transaction; and when it is determined that the transaction has not been previously processed: process the transaction; and write the transaction information of the transaction to the current working segment.
[0092] The techniques described herein can produce one or more technical effects. In some embodiments, a memory for storing transaction information is divided into a current working segment and a backup segment. In other embodiments, when performing a search in the memory, only half of the memory including the current working segment needs to be searched, which saves computing resources and speeds up the overall search time. In other embodiments, when a threshold condition indicates that a segment in the memory is to be switched (i.e., a switch between the current working segment and the backup segment), the backup segment becomes the new current working segment, and the segment that was already the current working segment is designated as the new backup segment.
[0093] Embodiments of the described subject matter may include one or more features alone or in combination.
[0094] For example, in a first embodiment, a computer-implemented method for detecting and inhibiting replay attacks includes: receiving a transaction to be completed in a blockchain; determining a current working segment in a memory for storing transaction information, the current working segment being designated for identifying processed historical transactions, the memory also storing a backup segment, the backup segment providing an alternative storage segment storage solution for the transaction information when used in combination with the current working segment; determining whether the transaction has been previously processed based on the current working segment; when it is determined that the transaction has been previously processed, skipping the transaction; and when it is determined that the transaction has not been previously processed: processing the transaction; and writing the transaction information of the transaction to the current working segment. The previous or other described embodiments may each optionally include one or more of the following features:
[0095] The first feature, which can be combined with any of the following features, further includes: determining whether a threshold condition for initiating a switch between the current working segment and the backup segment is met.
[0096] The second feature, which can be combined with any previous or following features, also includes: when it is determined that the threshold condition is met: initiating the switching, including starting an overlapping phase, in which the transaction information is written to the current working segment and the backup segment; clearing the backup segment; and writing the transaction information to the backup segment.
[0097] The third feature, which can be combined with any previous or following features, also includes: determining that the end of the overlapping phase has been reached; stopping writing the transaction information to the current working segment; and designating the backup segment as the current working segment.
[0098] A fourth feature, which can be combined with any previous or following feature, specifies that the threshold condition is an indication of a preset percentage of used storage capacity of the current working segment.
[0099] A fifth feature, which can be combined with any previous or following feature, specifies that the threshold condition is an indication that the misjudgment rate of the current working section exceeds a preset rate.
[0100] The sixth feature, which can be combined with any previous or following features, further includes: determining whether the transaction is in the blockchain; and when it is determined that the transaction is in the blockchain, skipping the transaction.
[0101] The seventh feature, which can be combined with any previous or following feature, further includes: before determining whether the transaction has been previously processed, using a Bloom filter to determine the probability that the transaction has been previously processed.
[0102] The embodiments of the subject matter, actions, and operations described herein may be implemented in digital electronic circuits, tangibly embodied computer software or firmware, computer hardware, including the structures disclosed herein and their structural equivalents, or a combination of one or more of them. The embodiments of the subject matter described herein may be implemented as one or more computer programs, for example, one or more computer program instruction modules encoded on a computer program carrier, for execution by a data processing device or for controlling the operation of a data processing device. For example, a computer program carrier may include one or more computer-readable storage media on which instructions are encoded or stored. The carrier may be a tangible, non-transitory computer-readable medium, such as a magnetic disk, a magneto-optical disk or an optical disk, a solid-state drive, a random access memory (RAM), a read-only memory (ROM), or other types of media. Alternatively or additionally, the carrier may be an artificially generated propagation signal, for example, a machine-generated electrical signal, an optical signal, or an electromagnetic signal, which is generated to encode information for transmission to a suitable receiver device for execution by a data processing device. A computer storage medium may be or may be partly a machine-readable storage device, a machine-readable storage substrate, a random or serial access memory device, or a combination of one or more of them. A computer storage medium is not a propagation signal.
[0103] A computer program may also be referred to or described as a program, software, software application, app, module, software module, engine, script or code, and may be written in any form of programming language, including compiled or deductive languages, declarative or procedural languages; it may be configured in any form, including as a stand-alone program, or as a module, component, engine, subroutine or other unit suitable for execution in a computing environment, which may include one or more computers at one or more locations interconnected by a communications data network.
[0104] A computer program may, but need not, correspond to a file in a file system. A computer program may be stored in: a portion of a file that holds other programs or data, such as one or more scripts stored in a markup language document; a single file dedicated to the program in question; or multiple coordinated files, such as multiple files storing one or more modules, subroutines, or code portions.
[0105] Processors for executing computer programs include, for example, both general and special purpose microprocessors, and any one or more processors of any kind of digital computer. Typically, the processor will receive instructions for executing the computer program and data from a non-transitory computer readable medium coupled to the processor.
[0106] The term "data processing apparatus" includes all types of apparatus, devices and machines for processing data, including, for example, a programmable processor, a computer or multiple processors or computers. The data processing apparatus may include special-purpose logic circuits, such as an FPGA (field programmable gate array), an ASIC (application-specific integrated circuit) or a GPU (graphics processing unit). In addition to hardware, the apparatus may also include code that creates an execution environment for a computer program, for example, code that constitutes processor firmware, a protocol stack, a database management system, an operating system, or a combination of one or more of them.
[0107] The processes and logic flows described herein may be performed by one or more computers or processors executing one or more computer programs to perform operations by operating on input data and generating output. The processes and logic flows may also be performed by a special purpose logic circuit such as an FPGA, ASIC, GPU, etc., or a combination of a special purpose logic circuit and one or more programmed computers.
[0108] Computers suitable for executing computer programs may be based on general and / or special purpose microprocessors, or any other kind of central processing unit. Typically, the central processing unit will receive instructions and data from a read-only memory and / or a random access memory. The elements of a computer may include a central processing unit for executing instructions, and one or more memory devices for storing instructions and data. The central processing unit and the memory may be supplemented with or integrated in a special purpose logic circuit.
[0109] Typically, the computer will also include or be operably coupled to one or more storage devices to receive data from one or more storage devices or transfer data to one or more storage devices. The storage device can be, for example, a disk, a magneto-optical disk or an optical disk, a solid-state drive, or any other type of non-transient computer-readable medium. However, such a device is not required for the computer. Therefore, the computer can be coupled to one or more storage devices such as one or more memories, local and / or remote. For example, the computer can include one or more local memories as computer components, or the computer can be coupled to one or more remote memories in a cloud network. In addition, the computer can be embedded in another device, such as a mobile phone, a personal digital assistant (PDA), a mobile audio or video player, a game console, a global positioning system (GPS) receiver, or a portable storage device, such as a universal serial bus (USB) flash drive, to name a few.
[0110] Components may be "coupled" to one another by communicating with one another, such as by electrical or optical connections, directly or via one or more intermediaries. Components may also be "coupled" to one another if one of the components is integrated into another. For example, a storage component (e.g., an L2 cache component) integrated into a processor is "coupled to" the processor.
[0111] To provide interaction with a user, embodiments of the subject matter described herein may be implemented on or configured to communicate with a computer having: a display device, such as an LCD (liquid crystal display) monitor, for displaying information to a user; and an input device through which a user can provide input to the computer, such as a keyboard and a pointer device such as a mouse, trackball, or touchpad. Other types of devices may also be used to provide interaction with a user; for example, the feedback provided to the user may be any form of sensory feedback, such as visual feedback, auditory feedback, or tactile feedback; and any form of input from the user may be received, including sound, voice, or tactile input. In addition, a computer may interact with a user by sending documents to and receiving documents from a device used by a user; for example, by sending a web page to a web browser on a user's device in response to a request received from the web browser, or by interacting with an application (app) running on a user's device, such as a smart phone or electronic tablet. In addition, a computer may interact with a user by sending text messages or other forms of messages to a personal device (e.g., a smart phone running a messaging application) in turn, and receiving a response message from the user.
[0112] The term "configured to" is used herein in relation to systems, devices, and computer program components. For a system of one or more computers configured to perform a particular operation or action, it means that the system has installed thereon software, firmware, hardware, or a combination thereof that causes the system to perform the operation or action in operation. For one or more computer programs configured to perform a particular operation or action, it means that the one or more programs include instructions that, when executed by a data processing device, cause the device to perform the operation or action. For a dedicated logic circuit configured to perform a particular operation or action, it means that the circuit has electronic logic to perform the operation or action.
[0113] Although many specific embodiment details are included herein, these should not be interpreted as limitations on the scope of the claims defined by the claims themselves, but rather as descriptions of specific features of specific embodiments. Multiple specific features described in the context of multiple individual embodiments herein may also be implemented in combination in a single embodiment. On the contrary, the various features described in the context of a single embodiment may also be implemented in multiple embodiments individually or in any suitable sub-combination. In addition, although the above features may be described as working in certain combinations and even initially claimed as such, in some cases, one or more features of the combination may be deleted from the claimed combination, and variants directed to a sub-combination or sub-combination may be claimed.
[0114] Similarly, although operations are depicted in the drawings and described in the claims in a particular order, this should not be understood as requiring that the operations be performed in the particular order shown or in sequence in order to achieve the desired result, or requiring that all of the operations shown be performed. In some cases, multi-tasking parallel processing may be advantageous. In addition, the division of various system modules and components in the above-described embodiments should not be understood as requiring such division in all embodiments, but it should be understood that the described program components and systems can generally be integrated together in a single software product or packaged into multiple software products.
[0115] Specific embodiments of the subject matter have been described. Other embodiments are within the scope of the following claims. For example, the actions recited in the claims can be performed in a different order and still achieve the desired results. As an example, the processes depicted in the accompanying drawings do not require the specific order or sequence shown to achieve the desired results. In some cases, multitasking and parallel processing may be advantageous.
Claims
1. A computer-implemented method for detecting and inhibiting replay attacks, the method comprising: Receive transactions to be completed in the blockchain; determining whether the transaction has been previously processed based on the current working section in the memory; The memory also includes a backup section; When it is determined that the transaction has not been previously processed: processing the transaction, and writing transaction information of the transaction into the current working section; When it is determined that a threshold condition for initiating a switch between the current working segment and the backup segment is met, the switch is initiated, including starting an overlap phase, in which the transaction information is written to the current working segment and the backup segment, and the threshold condition is a preset percentage of the used storage capacity of the current working segment, or an indication that the misjudgment rate exceeds a preset rate.
2. The method of claim 1, further comprising: When it is determined that the transaction has been previously processed, the transaction is skipped.
3. The method of claim 1, when determining that a threshold condition for initiating a switch between the current working segment and the backup segment is satisfied, the method further comprises: Clearing the backup section; as well as The transaction information is written into the backup section.
4. The method of claim 1, further comprising: determining that an end of the overlap phase has been reached; Stop writing the transaction information into the current working section; as well as The backup segment is designated as the current working segment.
5. The method of claim 1, further comprising: determining whether the transaction is in the blockchain; as well as When it is determined that the transaction is in the blockchain, skipping the transaction.
6. The method according to any preceding claim, further comprising: Prior to determining whether the transaction has been previously processed, a Bloom filter is used to determine the probability that the transaction has been previously processed.
7. A system for detecting and inhibiting replay attacks, comprising: one or more processors; as well as One or more computer readable memories coupled to the one or more processors and having instructions stored thereon, the instructions being executable by the one or more processors to perform the method of any one of claims 1 to 6.
8. An apparatus for detecting and inhibiting replay attacks, the apparatus comprising a plurality of modules for executing the method according to any one of claims 1 to 6.
