WO2024021406A1 - Network attack prevention method and device - Google Patents

Network attack prevention method and device Download PDF

Info

Publication number
WO2024021406A1
WO2024021406A1 PCT/CN2022/135118 CN2022135118W WO2024021406A1 WO 2024021406 A1 WO2024021406 A1 WO 2024021406A1 CN 2022135118 W CN2022135118 W CN 2022135118W WO 2024021406 A1 WO2024021406 A1 WO 2024021406A1
Authority
WO
WIPO (PCT)
Prior art keywords
node
proof
requesting node
request
blockchain network
Prior art date
Application number
PCT/CN2022/135118
Other languages
French (fr)
Chinese (zh)
Inventor
焦梦洪
曾超
Original Assignee
蚂蚁区块链科技(上海)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 蚂蚁区块链科技(上海)有限公司 filed Critical 蚂蚁区块链科技(上海)有限公司
Publication of WO2024021406A1 publication Critical patent/WO2024021406A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3247Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving digital signatures
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/14Network architectures or network communication protocols for network security for detecting or protecting against malicious traffic
    • H04L63/1441Countermeasures against malicious traffic
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/14Network architectures or network communication protocols for network security for detecting or protecting against malicious traffic
    • H04L63/1441Countermeasures against malicious traffic
    • H04L63/1458Denial of Service
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/08Key distribution or management, e.g. generation, sharing or updating, of cryptographic keys or passwords
    • H04L9/0861Generation of secret information including derivation or calculation of cryptographic keys or passwords
    • H04L9/0869Generation of secret information including derivation or calculation of cryptographic keys or passwords involving random numbers or seeds
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3236Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions
    • H04L9/3239Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions involving non-keyed hash functions, e.g. modification detection codes [MDCs], MD5, SHA or RIPEMD

Definitions

  • the embodiments of this specification belong to the field of network security technology, and particularly relate to a method and device for preventing network attacks.
  • the purpose of the present invention is to provide a method and device for preventing network attacks.
  • a method for preventing network attacks is proposed, which is applied to access nodes in a blockchain network, including: receiving a connection request sent by the requesting node, and converting the workload proof A request is sent to the requesting node, where the proof-of-work request includes a random number used to generate a proof-of-work task; and an execution result obtained by the requesting node executing the proof-of-work task in response to the proof-of-work request is received.
  • a device for preventing network attacks which is applied to an access node in a blockchain network and includes: a request receiving unit configured to receive a connection sent by the requesting node. Request, send a workload proof request to the requesting node, the workload proof request includes a random number used to generate a workload proof task; a result receiving unit, used to receive the request node's response to the workload proof Request the execution result obtained by executing the workload proof task and the signature generated for the execution result; the result verification unit is used to verify the signature based on the node public key of the requesting node, and based on the execution As a result, the proof-of-work task is verified; a connection establishment unit is configured to establish a connection with the requesting node when the signature verification is successful and the verification of the proof-of-work task passes.
  • an electronic device including: a processor; and a memory for storing instructions executable by the processor.
  • the processor implements the method described in the first aspect by running the executable instructions.
  • a computer-readable storage medium on which computer instructions are stored, and when the instructions are executed by a processor, the steps of the method described in the first aspect are implemented.
  • connection establishment mechanism that requires additional computing power.
  • the requesting node needs to provide the access node in the blockchain network with identity proof and the execution results obtained after executing the workload proof task.
  • the connection can only be established with the access node after passing the verification of the access node. This increases the computational cost and time cost required for the attacker to invade the blockchain network, thereby limiting the attacker from being able to pass through the area in a short time.
  • the blockchain network establishes a large number of connections to launch large-scale attacks, which improves the blockchain network's ability to prevent cyber attacks.
  • Figure 1 is a schematic diagram of a blockchain network provided by an exemplary embodiment.
  • Figure 2 is a flow chart of a method for preventing network attacks provided by an exemplary embodiment.
  • Figure 3 is a schematic structural diagram of a device provided by an exemplary embodiment.
  • Figure 4 is a block diagram of a device for preventing network attacks provided by an exemplary embodiment.
  • P2P Peer to Peer
  • P2P network that is, point-to-point network, or peer-to-peer network
  • C/S client/server
  • All nodes in the P2P network are in a peer-to-peer position with each other, and each node can act as both a client and a server to provide resources and services to other nodes.
  • the blockchain network is a typical P2P network.
  • the P2P network involved in the embodiments of this specification can be a blockchain network, and the nodes included in the P2P network all belong to the blockchain in the blockchain network. node.
  • FIG 1 is a schematic diagram of a blockchain network provided by an exemplary embodiment.
  • the blockchain network contains 5 nodes that have been connected to the network, namely nodeA, nodeB, nodeC, nodeD and nodeE.
  • nodeA Only connections are established with nodeB, nodeC and nodeD but no connection is established with nodeE.
  • Each node maintains an independent node list locally.
  • the node list records the node information of other nodes in the same blockchain network that are connected to the node. Therefore, the node list is also called a neighbor table.
  • nodeA maintains The node information of nodeB, nodeC and nodeD is recorded in the node list.
  • the node list can also be used as a routing table to guide message transmission.
  • the node information of any node may include the node identification, network address (such as IP address, port number, etc.) of any node, and/or the node's identity information (such as node public key), etc. , this manual does not limit this.
  • the connection involved in the embodiment of this specification refers to a network connection, such as a TCP or TLS connection at the session layer, and the embodiment of this specification does not impose any limitation on this.
  • the node corresponding to the node information maintained in the node list maintained by any node does not necessarily have a physical direct connection with the node, that is, other nodes that have network connections with the node may be connected to the node. There is a multi-hop relationship between any of the nodes.
  • the node responsible for accessing new nodes or establishing new connections in the blockchain network is called an access node. If there is a new node outside the blockchain network that wants to join the blockchain network, it needs to connect with the node in the blockchain network.
  • the entry node applies for it, and after the application is passed, it establishes a connection with the access node to join the blockchain network where the access node is located.
  • the access node can be any node that has joined the blockchain network.
  • the access node usually needs to ensure that it is trustworthy and open source. For example, the access node can be used when the blockchain network is initially established.
  • the initial node serves as the access node, or the communication pillar node in the blockchain network (usually has more connections with other nodes in the blockchain network) as the access node.
  • nodeF that does not belong to the blockchain network can send a network access request to nodeE in the blockchain network to apply to join the blockchain network.
  • nodeE serves as the access node of the blockchain network
  • nodeF serves as the requesting node
  • nodeA which has not established a connection with nodeE, can send a connection request to nodeE to apply for establishing a connection with nodeE.
  • nodeE also serves as the access node of the blockchain network
  • nodeA serves as the requesting node. .
  • Figure 2 is a flow chart of a method for preventing network attacks provided by an exemplary embodiment. As shown in Figure 2, the method is applied to access nodes in the blockchain network and may include the following steps 202-208.
  • Step 202 Receive the connection request sent by the requesting node, and send the workload proof request to the requesting node, where the workload proof request includes a random number used to generate a workload proof task.
  • the requesting nodes involved in the embodiments of this specification may include nodes in the blockchain network that have not established a connection with the access node, or nodes that do not currently belong to the blockchain network.
  • the connection request here is also called a network access request.
  • the access node responds to the connection request sent by the requesting node and sends the proof-of-work request to the requesting node.
  • the proof-of-work request is used to cause the requesting node to trigger the generation and execution of the corresponding proof-of-work task, and finally returns it to the access node.
  • the execution results obtained by executing the proof-of-work task.
  • a random number needs to be provided to the requesting node to generate a random proof-of-work task.
  • the proof of work request can also include the proof difficulty value used to generate the proof of work task, thereby instructing the requesting node to perform the proof of work task according to the corresponding proof difficulty value.
  • Step 204 Receive the execution result obtained by the requesting node from executing the workload proof task in response to the workload proof request and the signature generated for the execution result.
  • the requesting node After receiving the proof-of-work request, the requesting node first generates the corresponding proof-of-work task based on the random number it contains.
  • the proof-of-work task specifically refers to: by continuously changing the undetermined value, continuously constructing the random number and the undetermined value according to the A string composed of a preset sequence (or a string composed of the node public key of the requesting node, a random number and a pending value in a preset sequence), and the hash value corresponding to the string is calculated at the same time.
  • the hash value satisfies specific formal rules, the undetermined value determined in that string is determined as the execution result of the workload proof task.
  • the above-mentioned specific formal rules may include, for example, several consecutive identical characters (such as "0") appearing at the beginning or end of the hash value.
  • the specific number of consecutive identical characters required to appear depends on the proof corresponding to the workload proof task.
  • the difficulty value proves that the higher the difficulty value, the more consecutive identical characters need to appear. It is easy to understand that the higher the proof difficulty value, the higher the computing power cost and time cost required to perform the workload proof task and obtain the final execution result.
  • the above workload proof task takes advantage of the irreversible characteristics of hash operations and the lack of regularity between output values and input values. It requires the prover to obtain the final execution result only by exhaustively enumerating the undetermined values. Therefore, as the request node of the prover Additional computing power is required to establish a connection with the access node, which increases the cost of requesting the node to establish a connection.
  • the requesting node in order to prove that the execution result obtained is obtained by the requesting node itself to perform the workload proof task, it is also necessary to provide the corresponding identity certificate to the access node. Specifically, after obtaining the execution result, the requesting node will also generate a corresponding signature for the execution result. The signature is obtained by encrypting the execution result using the node private key of the requesting node it holds.
  • the requesting node will send the execution result it obtains and the signature generated for the execution result to the access node for verification.
  • the requesting node can also send the node public key of the requesting node at the same time. Sent to access node.
  • Step 206 Verify the signature based on the node public key of the requesting node, and verify the workload proof task based on the execution result.
  • the access node When the access node verifies the signature, it needs to use the node public key of the requesting node that it has maintained in advance or that is temporarily provided by the requesting node to decrypt the signature, and compare the obtained decryption result with the execution result. If the comparison is consistent, it means that the source of the execution result is indeed the requesting node, thereby determining that the signature verification is successful. If the comparison is inconsistent, it means that the source of the execution result is not the requesting node, thus determining that the signature verification is successful. The above signature verification failed.
  • the access node verifies the workload proof task
  • its actual process is similar to the process of requesting the node to perform the workload proof task.
  • the string to be verified is generated based on the execution result and the random number, and then the string is generated.
  • the string to be tested is subjected to a hash operation to obtain the corresponding hash result; finally, when the hash result meets the workload proof requirements corresponding to the proof difficulty value, it is determined that the workload proof task is verified, Otherwise, it is determined that the proof-of-work task verification fails.
  • the proof difficulty value maintained by the access node requires that the hash result satisfies the workload proof requirement: the beginning of the hash result contains 8 consecutive characters "0", then only when the hash result Only when the beginning does contain 8 consecutive characters "0" will the proof-of-work task be deemed to have passed the verification, that is, the requesting node will be considered to have indeed executed the proof-of-work task correctly and compliantly.
  • the proof of work request may also include the proof difficulty value used to generate the proof of work task, so that the request The node fully considers the proof difficulty value when generating the workload proof task, and based on this, generates execution results that meet the workload proof requirements corresponding to the proof difficulty value.
  • generating a string to be verified based on the execution result and the random number includes: combining the execution result, the random number and the node public key of the requesting node in a preset order to Generate the string to be tested.
  • the string constructed in the workload proof task mentioned above may also include the node public key of the requesting node. In this way, a strong binding between the requesting node and the execution result can be further realized. This can more effectively prove that the execution result comes from the requesting node corresponding to the node public key in the string.
  • the string to be verified should also be generated according to the same combination of construction rules mentioned above and further verified during the process of verifying a proof-of-work task.
  • the above-mentioned process of verifying the signature based on the node public key of the requesting node and the process of verifying the workload proof task based on the execution result may be independent processes, That is, there is no necessary order of execution between the two processes. The two processes can be executed sequentially or simultaneously. The embodiments of this specification do not impose any restrictions on this.
  • the verification of the proof-of-work task based on the execution result includes: verifying the proof-of-work task based on the execution result if the signature verification is successful. It is worth mentioning that in the embodiment of this specification, the process of the access node verifying the workload proof task can be executed when the signature verification is successful. In this way, the signature can be verified successfully.
  • the signature verification is unsuccessful, there is no need to further perform the verification process of the relatively more time-consuming workload proof task, thus saving the computing resources of the access node to a certain extent and preventing the attacker from sending excessive execution results and their signatures.
  • it also includes: adjusting the proof difficulty value according to the number of failed proof-of-work verifications within the first preset time period before the current moment, where the proof difficulty value is directly related to the number of times, and the number of times is the number of times since the current moment. The sum of the number of times any signature verification fails and the number of times any proof-of-work task fails verification within the first preset time period before the current time.
  • the access node maintains a certification difficulty value, and can adjust the certification difficulty value according to the number of recent encounters with costless access behaviors (ie, the aforementioned signature verification failure or workload proof task verification failure).
  • the number of costless access behaviors is the number of failed proof-of-work verifications. This number refers to the sum of the number of failed signature verifications and the number of failed verifications of any proof-of-work task (that is, for each connection request, If the signature provided by the requesting node fails to be verified or the proof-of-work task fails to be verified, this number will be increased by one). When counting this number, signatures may appear in the execution results and signatures provided by the requesting node corresponding to each connection request.
  • embodiments of this specification can enable the blockchain network to increase the cost of establishing a connection by new requesting nodes when encountering network attacks. To further increase the cost of cyber attacks for attackers by establishing a large number of connections to the blockchain network, and further improve the ability of the blockchain network to prevent cyber attacks.
  • the adjustment of the proof difficulty value is carried out dynamically, for example, when the number of costless access behaviors encountered recently decreases, the current proof difficulty value can be appropriately reduced, thereby reducing the normal access level without encountering network attacks.
  • the cost required for entry behavior should be paid attention to, and the phenomenon of "accidental killing" should be avoided as much as possible.
  • the network management contract deployed by the blockchain network maintains the proof difficulty value; the proof difficulty value is adjusted according to the number of workload proof verification failures within the first preset time period before the current time. , including: initiating a proof difficulty value adjustment transaction including the said number of times to the network management contract deployed on the blockchain network, so that the network management contract adjusts the said number maintained in the network management contract based on the said number of times. Prove the difficulty value.
  • the proof difficulty value maintained by the access node is specifically stored in the network management contract deployed by it. Therefore, in this case, each blockchain node in the blockchain network actually shares the same proof difficulty value by maintaining the same network management contract, which allows any one of the blockchain nodes to detect When a network attack occurs, the proof difficulty value maintained in the network management contract is adjusted by initiating a proof difficulty value adjustment transaction to the network management contract to inform other blockchain nodes in the blockchain network of the change in proof difficulty value. , enabling the blockchain network to have the function of overall adjusting the access strategies of all nodes according to changes in the current network environment, and improving the overall ability of the blockchain network to prevent network attacks.
  • Step 208 If the signature verification is successful and the proof-of-work task verification passes, establish a connection with the requesting node.
  • connection establishment mechanism that requires additional computing power.
  • the requesting node needs to provide the access node in the blockchain network with identity proof and the execution results obtained after executing the workload proof task.
  • the connection can only be established with the access node after passing the verification of the access node. This increases the computational cost and time cost required for the attacker to invade the blockchain network, thereby limiting the attacker from being able to pass through the area in a short time.
  • the blockchain network establishes a large number of connections to launch large-scale attacks, which improves the blockchain network's ability to prevent cyber attacks.
  • the access node will only establish a connection with it after confirming that the signature verification is successful and the proof-of-work task verification is passed.
  • the method further includes: when the signature verification is successful and the proof-of-work task verification passes, adding the requesting node to the network.
  • the blockchain network In the embodiment of this specification, if the requesting node itself does not belong to the blockchain network, then the access node will add the requesting node to the blockchain network by default after confirming that the signature verification is successful and the workload proof task verification is passed. in the blockchain network.
  • adding the requesting node to the blockchain network includes: storing the node information of the requesting node in a node list maintained by the access node, and adding the node information of the access node to the blockchain network.
  • Node information is sent to the requesting node.
  • each node in the blockchain network maintains a node list to store node information of other nodes that are connected to the node.
  • the access node will first store the node information of the requesting node in the node list maintained by the access node.
  • the access node will send the node information of the access node to the requesting node and notify the request
  • the node has successfully joined the blockchain network, then the requesting node will establish a node list maintained by itself, and store the node information of the access node in the node list maintained by the requesting node.
  • the requesting node joins the blockchain network through the access node, it initially only knows the access node in the blockchain network. If it needs to further discover other nodes in the blockchain network and establish connections with them, it needs to The access node sends a node discovery request, so that the access node returns the node list maintained by the access node to the requesting node in response to the node discovery request.
  • the access node knows other nodes in the blockchain network through the received node list. , and establish connections with other nodes through the received node information in the node list and send them new node discovery requests. Iterating the above process can theoretically make the requesting nodes newly added to the blockchain network aware of the information in the blockchain network. of all nodes and establish connections with all nodes. Take nodeF joining the blockchain network through nodeE in Figure 1 as an example. nodeF first sends a node discovery request to nodeE to obtain the node list maintained by nodeE, and obtain the nodes of nodeB and nodeD that have a connection relationship with nodeE from the node list.
  • nodeF then establishes connections with nodeB and nodeD respectively and sends node discovery requests respectively, thereby further obtaining the node list maintained by nodeB and the node list maintained by nodeD.
  • nodeF will finally be able to learn all the nodes in the blockchain network.
  • the node information of the node and theoretically can also establish connections with all nodes.
  • adding the requesting node to the blockchain network includes: initiating a node joining transaction containing the node information of the requesting node to the network management contract in the blockchain network, so that the requesting node can be added to the blockchain network.
  • the network management contract maintains node information of the requesting node.
  • the network management contract deployed by the blockchain network maintains the node information of each blockchain node as all members of the blockchain network. Therefore, after a new node (requesting node) joins, The entry node can also initiate a node joining transaction to the network management contract so that the node information of the requesting node is updated and maintained in the network management contract.
  • the node identifier of the requesting node is generated by the access node, or the node identifier of the requesting node is generated by the requesting node.
  • the access node when the node identification of the requesting node is generated by the access node, the access node generates it when the signature verification is successful and the proof-of-work task verification is passed, so that It avoids generating a node identifier every time a connection request is received, reducing the computing burden on the access node. It also prevents the attacker from forcing the access node to execute a large number of node identifiers that consume computing resources in a short period of time by sending an excessive number of connection requests.
  • the node identification of the requesting node is generated by hashing the node public key of the requesting node, so the global uniqueness of the node public key can be used to ensure that no hash collision occurs. Global uniqueness of the node ID of each node.
  • it also includes: when it is detected that the node identification of the requesting node is not globally unique in the blockchain network, sending a node identification provision request to the requesting node or generating the blockchain network
  • the globally unique first node identifier in the requesting node is re-determined to be the node identifier of the requesting node.
  • the node identifier providing request is used to cause the requesting node to re-provide the second node identifier to the access node to be re-determined to be the requesting node.
  • the node ID of the requesting node is used to cause the requesting node to re-provide the second node identifier to the access node to be re-determined to be the requesting node.
  • the access node finds that the node identification of the requesting node is the same as the node identification of an existing node in the blockchain network, it will regenerate a new node identification to serve as the node identification of the requesting node. Or require the requesting node to re-provide a new node identification as the node identification of the requesting node, thereby ensuring that the node identification of each node in the blockchain network is globally unique.
  • it also includes: refusing to respond to the same initiator when the number of historical messages based on any protocol initiated by the same initiator exceeds a preset threshold within a second preset time period before the current moment.
  • Messages initiated based on any of the protocols which include at least a connection request in a connection protocol, a node discovery request in a node discovery protocol, etc.
  • the embodiments of this specification do not limit the type of the protocol, but The protocol must be pre-established and maintained in the blockchain network so that nodes in the blockchain network can identify and process messages corresponding to the protocol.
  • Figure 3 is a schematic structural diagram of a device provided by an exemplary embodiment.
  • the device includes a processor 302, an internal bus 303, a network interface 306, a memory 308 and a non-volatile memory 310.
  • the processor 302 reads the corresponding computer program from the non-volatile memory 310 into the memory 308 and then runs it.
  • the execution party of the following processing flow is not limited to each A logic unit can also be a hardware or logic device.
  • Figure 4 is a block diagram of a device for preventing network attacks provided in this specification according to an exemplary embodiment.
  • This device can be applied to the equipment shown in Figure 3 to implement the technical solution of this specification.
  • the device is applied to access nodes in a blockchain network and includes: a request receiving unit 401, used to receive a connection request sent by a requesting node, and send a workload proof request to the requesting node, where the workload proof request includes Random numbers used to generate proof-of-work tasks;
  • the result receiving unit 402 is used to receive the execution result obtained by the requesting node from executing the workload proof task in response to the workload proof request and the signature generated for the execution result; the result verification unit 403 is used to based on the workload proof task.
  • the node public key of the requesting node verifies the signature, and verifies the workload proof task based on the execution result; the connection establishment unit 404 is used to verify the signature when the signature verification is successful and the workload If the verification task passes, a connection is established with the requesting node.
  • the workload proof request also includes a proof difficulty value used to generate the workload proof task;
  • the result verification unit 403 is specifically configured to: generate a character to be verified based on the execution result and the random number. String, perform a hash operation on the string to be tested to obtain the corresponding hash result; when the hash result meets the workload proof requirements corresponding to the proof difficulty value, determine the workload proof task The verification passes, otherwise it is determined that the verification of the workload proof task fails.
  • the result verification unit 403 is further configured to: combine the execution result, the random number and the node public key of the requesting node in a preset order to generate the string to be verified.
  • a difficulty value adjustment unit 405 configured to adjust the proof difficulty value according to the number of workload proof verification failures within the first preset time period before the current time, and the proof difficulty value is positively related to the proof difficulty value.
  • the number of times described above is the sum of the number of times any signature verification fails and the number of times any proof-of-work task fails verification within the first preset time period before the current moment.
  • the network management contract deployed on the blockchain network maintains the certification difficulty value;
  • the difficulty value adjustment unit 405 is specifically configured to: initiate a certificate containing the certification to the network management contract deployed on the blockchain network.
  • the number of proof difficulty value adjustment transactions is such that the network management contract adjusts the proof difficulty value maintained in the network management contract based on the number of times.
  • the result verification unit 403 is specifically configured to verify the workload proof task based on the execution result if the signature verification is successful.
  • the device when the requesting node does not belong to the blockchain network, the device further includes:
  • the node adding unit 406 is configured to add the requesting node to the blockchain network when the signature verification is successful and the proof-of-work task verification passes.
  • the node joining unit 406 is specifically configured to: store the node information of the requesting node in the node list maintained by the access node, and send the node information of the access node to the requesting node. node.
  • the node joining unit 406 is specifically configured to: initiate a node joining transaction containing the node information of the requesting node to the network management contract in the blockchain network, so that the network management contract maintains the Node information for the requested node.
  • the node information includes node identification, node public key and/or network address.
  • the node identification of the requesting node is generated by the access node when the signature verification is successful and the proof-of-work task verification passes, or the node identification of the requesting node is generated by the access node. Request node generation.
  • a node identification re-determination unit 407 configured to send a node identification provision to the requesting node when it is detected that the node identification of the requesting node is not globally unique in the blockchain network.
  • the second node identification is redetermined as the node identification of the requesting node.
  • a response rejection unit 408 configured to receive a number of historical messages based on any protocol initiated by the same initiator within the second preset time period before the current moment exceeding the preset threshold, Do not respond to messages based on any protocol initiated by the same initiator, and the messages of any protocol at least include a connection request in the connection protocol.
  • PLD Programmable Logic Device
  • FPGA Field Programmable Gate Array
  • HDL Hardware Description Language
  • the controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer readable medium storing computer readable program code (eg, software or firmware) executable by the (micro)processor. , logic gates, switches, Application Specific Integrated Circuit (ASIC), programmable logic controllers and embedded microcontrollers.
  • controllers include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, For Microchip PIC18F26K20 and Silicone Labs C8051F320, the memory controller can also be implemented as part of the memory's control logic.
  • the controller in addition to implementing the controller in the form of pure computer-readable program code, the controller can be completely programmed with logic gates, switches, application-specific integrated circuits, programmable logic controllers and embedded logic by logically programming the method steps. Microcontroller, etc. to achieve the same function. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be considered as structures within the hardware component. Or even, the means for implementing various functions can be considered as structures within hardware components as well as software modules implementing the methods.
  • the systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions.
  • a typical implementation device is a server system.
  • the computer that implements the functions of the above embodiments may be, for example, a personal computer, a laptop computer, a vehicle-mounted human-computer interaction device, a cellular phone, a camera phone, a smart phone, or a personal digital assistant. , media player, navigation device, email device, game console, tablet, wearable device, or a combination of any of these devices.
  • the functions are divided into various modules and described separately.
  • the functions of each module can be implemented in the same or multiple software and/or hardware, or the modules that implement the same function can be implemented by a combination of multiple sub-modules or sub-units, etc. .
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical function division. In actual implementation, there may be other division methods.
  • multiple units or components may be combined or integrated. to another system, or some features can be ignored, or not implemented.
  • the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the devices or units may be in electrical, mechanical or other forms.
  • These computer program instructions may also be stored in a computer-readable memory that causes a computer or other programmable data processing apparatus to operate in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction means, the instructions
  • the device implements the functions specified in a process or processes of the flowchart and/or a block or blocks of the block diagram.
  • These computer program instructions may also be loaded onto a computer or other programmable data processing device, causing a series of operating steps to be performed on the computer or other programmable device to produce computer-implemented processing, thereby executing on the computer or other programmable device.
  • Instructions provide steps for implementing the functions specified in a process or processes of a flowchart diagram and/or a block or blocks of a block diagram.
  • a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
  • processors CPUs
  • input/output interfaces network interfaces
  • memory volatile and non-volatile memory
  • Memory may include non-permanent storage in computer-readable media, random access memory (RAM) and/or non-volatile memory in the form of read-only memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
  • RAM random access memory
  • ROM read-only memory
  • flash RAM flash random access memory
  • Computer-readable media includes both persistent and non-volatile, removable and non-removable media that can be implemented by any method or technology for storage of information.
  • Information may be computer-readable instructions, data structures, modules of programs, or other data.
  • Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), and read-only memory.
  • PRAM phase change memory
  • SRAM static random access memory
  • DRAM dynamic random access memory
  • RAM random access memory
  • read-only memory read-only memory
  • ROM read-only memory
  • EEPROM electrically erasable programmable read-only memory
  • flash memory or other memory technology
  • compact disc read-only memory CD-ROM
  • DVD digital versatile disc
  • Magnetic tape cartridges magnetic tape disk storage, graphene storage or other magnetic storage devices or any other non-transmission medium can be used to store information that can be accessed by a computing device.
  • computer-readable media does not include transitory media, such as modulated data signals and carrier waves.
  • one or more embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, one or more embodiments of the present description may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment that combines software and hardware aspects. Furthermore, one or more embodiments of the present description may employ a computer program implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein. Product form.
  • computer-usable storage media including, but not limited to, disk storage, CD-ROM, optical storage, etc.
  • program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types.
  • program modules may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communications network.
  • program modules may be located in both local and remote computer storage media including storage devices.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The present description provides a network attack prevention method and device, which are applied to an access node in a blockchain network. The method comprises: receiving a connection request sent by a request node, and sending a proof-of-work request to the request node, the proof-of-work request comprising a random number for generating a proof-of-work task; receiving an execution result obtained by the request node executing the proof-of-work task in response to the proof-of-work request, and a signature generated with respect to the execution result; verifying the signature on the basis of a public key of the request node, and verifying the proof-of-work task on the basis of the execution result; and establishing connection with the request node if the signature passes verification and the proof-of-work task passes verification.

Description

一种防范网络攻击的方法及装置A method and device for preventing network attacks 技术领域Technical field
本说明书实施例属于网络安全技术领域,尤其涉及一种防范网络攻击的方法及装置。The embodiments of this specification belong to the field of network security technology, and particularly relate to a method and device for preventing network attacks.
背景技术Background technique
现阶段,针对通信网络的攻击事件层出不穷,攻击方法也不尽相同,其中,针对P2P网络的攻击案例数量较为常见。例如对于区块链网络,攻击方可以根据区块链网络对应的底层P2P网络的自身特性设计攻击算法,从而实现对区块链网络的攻击。At this stage, attacks on communication networks are emerging one after another, and the attack methods are also different. Among them, the number of attack cases on P2P networks is relatively common. For example, for blockchain networks, attackers can design attack algorithms based on the characteristics of the underlying P2P network corresponding to the blockchain network, thereby achieving attacks on the blockchain network.
发明内容Contents of the invention
本发明的目的在于提供一种防范网络攻击的方法及装置。The purpose of the present invention is to provide a method and device for preventing network attacks.
根据本说明书一个或多个实施例的第一方面,提出了一种防范网络攻击的方法,应用于区块链网络中的接入节点,包括:接收请求节点发送的连接请求,将工作量证明请求发送至所述请求节点,所述工作量证明请求包括用于生成工作量证明任务的随机数;接收所述请求节点响应于所述工作量证明请求执行所述工作量证明任务得到的执行结果以及针对所述执行结果生成的签名;基于所述请求节点的节点公钥对所述签名进行验签,并基于所述执行结果对所述工作量证明任务进行验证;在所述签名验签成功且所述工作量证明任务验证通过的情况下,与所述请求节点建立连接。According to the first aspect of one or more embodiments of this specification, a method for preventing network attacks is proposed, which is applied to access nodes in a blockchain network, including: receiving a connection request sent by the requesting node, and converting the workload proof A request is sent to the requesting node, where the proof-of-work request includes a random number used to generate a proof-of-work task; and an execution result obtained by the requesting node executing the proof-of-work task in response to the proof-of-work request is received. and a signature generated for the execution result; verifying the signature based on the node public key of the requesting node, and verifying the workload proof task based on the execution result; when the signature verification is successful And if the verification of the workload proof task passes, a connection is established with the requesting node.
根据本说明书一个或多个实施例的第二方面,提出了一种防范网络攻击的装置,应用于区块链网络中的接入节点,包括:请求接收单元,用于接收请求节点发送的连接请求,将工作量证明请求发送至所述请求节点,所述工作量证明请求包括用于生成工作量证明任务的随机数;结果接收单元,用于接收所述请求节点响应于所述工作量证明请求执行所述工作量证明任务得到的执行结果以及针对所述执行结果生成的签名;结果验证单元,用于基于所述请求节点的节点公钥对所述签名进行验签,并基于所述执行结果对所述工作量证明任务进行验证;连接建立单元,用于在所述签名验签成功且所述工作量证明任务验证通过的情况下,与所述请求节点建立连接。According to the second aspect of one or more embodiments of this specification, a device for preventing network attacks is proposed, which is applied to an access node in a blockchain network and includes: a request receiving unit configured to receive a connection sent by the requesting node. Request, send a workload proof request to the requesting node, the workload proof request includes a random number used to generate a workload proof task; a result receiving unit, used to receive the request node's response to the workload proof Request the execution result obtained by executing the workload proof task and the signature generated for the execution result; the result verification unit is used to verify the signature based on the node public key of the requesting node, and based on the execution As a result, the proof-of-work task is verified; a connection establishment unit is configured to establish a connection with the requesting node when the signature verification is successful and the verification of the proof-of-work task passes.
根据本说明书一个或多个实施例的第三方面,提出了一种电子设备,包括:处理器;用于存储处理器可执行指令的存储器。其中,所述处理器通过运行所述可执行指令以实现如第一方面所述的方法。According to a third aspect of one or more embodiments of this specification, an electronic device is proposed, including: a processor; and a memory for storing instructions executable by the processor. Wherein, the processor implements the method described in the first aspect by running the executable instructions.
根据本说明书一个或多个实施例的第四方面,提出了一种计算机可读存储介质,其上存储有计算机指令,该指令被处理器执行时实现如第一方面所述方法的步骤。According to a fourth aspect of one or more embodiments of this specification, a computer-readable storage medium is proposed, on which computer instructions are stored, and when the instructions are executed by a processor, the steps of the method described in the first aspect are implemented.
基于本说明书的前述实施例,提出了一种需要额外消耗算力的连接建立机制,请求节点需要向区块链网络中的接入节点提供身份证明以及执行工作量证明任务后得到的执行结果,并在通过接入节点的验证后才能与接入节点建立连接,这增加了攻击方侵入区块链网络时所需的计算成本和时间成本,从而能够限制攻击方无法在短时间内通过与区块链网络建立大量连接来发起大规模攻击,提高了区块链网络防范网络攻击的能力。Based on the foregoing embodiments of this specification, a connection establishment mechanism is proposed that requires additional computing power. The requesting node needs to provide the access node in the blockchain network with identity proof and the execution results obtained after executing the workload proof task. And the connection can only be established with the access node after passing the verification of the access node. This increases the computational cost and time cost required for the attacker to invade the blockchain network, thereby limiting the attacker from being able to pass through the area in a short time. The blockchain network establishes a large number of connections to launch large-scale attacks, which improves the blockchain network's ability to prevent cyber attacks.
附图说明Description of drawings
为了更清楚地说明本说明书实施例的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本说明书中记载的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to explain the technical solutions of the embodiments of this specification more clearly, the drawings needed to be used in the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some of the embodiments recorded in this specification. , for those of ordinary skill in the art, other drawings can also be obtained based on these drawings without exerting creative labor.
图1是一示例性实施例提供的一种区块链网络的示意图。Figure 1 is a schematic diagram of a blockchain network provided by an exemplary embodiment.
图2是一示例性实施例提供的一种防范网络攻击的方法的流程图。Figure 2 is a flow chart of a method for preventing network attacks provided by an exemplary embodiment.
图3是一示例性实施例提供的一种设备的结构示意图。Figure 3 is a schematic structural diagram of a device provided by an exemplary embodiment.
图4是一示例性实施例提供的一种防范网络攻击的装置的框图。Figure 4 is a block diagram of a device for preventing network attacks provided by an exemplary embodiment.
具体实施方式Detailed ways
为了使本技术领域的人员更好地理解本说明书中的技术方案,下面将结合本说明书实施例中的附图,对本说明书实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本说明书一部分实施例,而不是全部的实施例。基于本说明书中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都应当属于本说明书保护的范围。In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of this specification. Obviously, the described The embodiments are only some of the embodiments of this specification, but not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by those of ordinary skill in the art without creative efforts should fall within the scope of protection of this specification.
P2P(Peer to Peer)网络,即点对点网络,或称为对等网络,是一种有别于C/S(客户端/服务器)模式的分布式网络。在P2P网络中所有的节点彼此之间都处于对等地位,每个节点既能充当客户端又能作为服务器向其他节点提供资源与服务。例如,区块链网络就属于一种典型的P2P网络,本说明书实施例所涉及的P2P网络可以为区块链网络,而P2P网络中包含的节点均属于该区块链网络中的区块链节点。P2P (Peer to Peer) network, that is, point-to-point network, or peer-to-peer network, is a distributed network that is different from the C/S (client/server) model. All nodes in the P2P network are in a peer-to-peer position with each other, and each node can act as both a client and a server to provide resources and services to other nodes. For example, the blockchain network is a typical P2P network. The P2P network involved in the embodiments of this specification can be a blockchain network, and the nodes included in the P2P network all belong to the blockchain in the blockchain network. node.
图1是一示例性实施例提供的一种区块链网络的示意图。如图1所示,区块链网络中的包含有5个节点已入网,分别为nodeA、nodeB、nodeC、nodeD和nodeE,其中,这5个节点之间并非是全连接的关系,例如nodeA就只与nodeB、nodeC和nodeD建立有连接而未与nodeE建立有连接。每个节点本地维护有独立的节点列表,该节点列表中记录有与该节点建立有连接的同一区块链网络中其他节点的节点信息,因此该节点列表 也被称为邻居表,例如nodeA维护的节点列表中就记录有nodeB、nodeC和nodeD的节点信息。另外,从功能性的角度上来说,该节点列表还可以作为路由表指导消息传输。在本说明书实施例中,任一节点的节点信息可以包括所述任一节点的节点标识、网络地址(如IP地址、端口号等)和/或该节点的身份信息(如节点公钥)等,本说明书并不对此进行限定。本说明书实施例所涉及的连接是指网络连接,例如会话层的TCP或TLS连接等,本说明书实施例对此并不作任何限制。需要注意的是,任一节点维护的节点列表中维护的节点信息对应的节点并不一定与该任一节点存在物理上直连关系,即与该任一节点建立有网络连接的其他节点可能与该任一节点之间存在多跳关系。Figure 1 is a schematic diagram of a blockchain network provided by an exemplary embodiment. As shown in Figure 1, the blockchain network contains 5 nodes that have been connected to the network, namely nodeA, nodeB, nodeC, nodeD and nodeE. Among them, the relationship between these 5 nodes is not fully connected. For example, nodeA Only connections are established with nodeB, nodeC and nodeD but no connection is established with nodeE. Each node maintains an independent node list locally. The node list records the node information of other nodes in the same blockchain network that are connected to the node. Therefore, the node list is also called a neighbor table. For example, nodeA maintains The node information of nodeB, nodeC and nodeD is recorded in the node list. In addition, from a functional perspective, the node list can also be used as a routing table to guide message transmission. In the embodiment of this specification, the node information of any node may include the node identification, network address (such as IP address, port number, etc.) of any node, and/or the node's identity information (such as node public key), etc. , this manual does not limit this. The connection involved in the embodiment of this specification refers to a network connection, such as a TCP or TLS connection at the session layer, and the embodiment of this specification does not impose any limitation on this. It should be noted that the node corresponding to the node information maintained in the node list maintained by any node does not necessarily have a physical direct connection with the node, that is, other nodes that have network connections with the node may be connected to the node. There is a multi-hop relationship between any of the nodes.
区块链网络中负责接入新节点或建立新连接的节点称为接入节点,如果有区块链网络外部的新节点希望加入区块链网络,则需要与该区块链网络中的接入节点进行申请,并在申请通过后与接入节点建立连接从而加入接入节点所在的区块链网络。在本说明书实施例中,接入节点可以是已加入区块链网络当中的任何一个节点,接入节点通常需要确保自身是可信的、开源的,例如可以将最初建立区块链网络时的初始节点作为接入节点,或者将区块链网络中的通信支柱节点(通常与区块链网络中的其他节点建立有较多的连接)作为接入节点。以图1为例,不属于区块链网络中的nodeF可以向区块链网络中的nodeE发送入网请求从而申请加入区块链网络,此时nodeE就作为区块链网络的接入节点,而nodeF则作为请求节点;又或者,未与nodeE建立有连接的nodeA可以向nodeE发送连接请求从而申请与nodeE建立连接,此时nodeE同样作为区块链网络的接入节点,而nodeA则作为请求节点。The node responsible for accessing new nodes or establishing new connections in the blockchain network is called an access node. If there is a new node outside the blockchain network that wants to join the blockchain network, it needs to connect with the node in the blockchain network. The entry node applies for it, and after the application is passed, it establishes a connection with the access node to join the blockchain network where the access node is located. In the embodiment of this specification, the access node can be any node that has joined the blockchain network. The access node usually needs to ensure that it is trustworthy and open source. For example, the access node can be used when the blockchain network is initially established. The initial node serves as the access node, or the communication pillar node in the blockchain network (usually has more connections with other nodes in the blockchain network) as the access node. Taking Figure 1 as an example, nodeF that does not belong to the blockchain network can send a network access request to nodeE in the blockchain network to apply to join the blockchain network. At this time, nodeE serves as the access node of the blockchain network, and nodeF serves as the requesting node; or nodeA, which has not established a connection with nodeE, can send a connection request to nodeE to apply for establishing a connection with nodeE. At this time, nodeE also serves as the access node of the blockchain network, and nodeA serves as the requesting node. .
请参见图2,图2是一示例性实施例提供的一种防范网络攻击的方法的流程图。如图2所示,所述方法应用于区块链网络中的接入节点,可以包括下述步骤202-208。Please refer to Figure 2. Figure 2 is a flow chart of a method for preventing network attacks provided by an exemplary embodiment. As shown in Figure 2, the method is applied to access nodes in the blockchain network and may include the following steps 202-208.
步骤202:接收请求节点发送的连接请求,将工作量证明请求发送至所述请求节点,所述工作量证明请求包括用于生成工作量证明任务的随机数。Step 202: Receive the connection request sent by the requesting node, and send the workload proof request to the requesting node, where the workload proof request includes a random number used to generate a workload proof task.
本说明书实施例所涉及的请求节点可以包括区块链网络中的未与接入节点建立连接的节点,或暂不属于区块链网络中的节点。在请求节点不属于区块链网络即不为区块链网络中的节点的情况下,此处的连接请求也称为入网请求。The requesting nodes involved in the embodiments of this specification may include nodes in the blockchain network that have not established a connection with the access node, or nodes that do not currently belong to the blockchain network. When the requesting node does not belong to the blockchain network, that is, it is not a node in the blockchain network, the connection request here is also called a network access request.
接入节点响应于请求节点发送的连接请求,将工作量证明请求发送至请求节点,该工作量证明请求用于使请求节点触发生成并执行对应的工作量证明任务,并最终向接入节点返回执行工作量证明任务得到的执行结果。为了确保工作量证明任务的随机性,防止请求节点预先获得执行结果而非临时执行工作量证明任务,因此需要向请求节点提供随机数以生成随机的工作量证明任务。另外,工作量证明请求中还可以包括用于生成工 作量证明任务的证明难度值,从而指导请求节点按照对应的证明难度值执行工作量证明任务。The access node responds to the connection request sent by the requesting node and sends the proof-of-work request to the requesting node. The proof-of-work request is used to cause the requesting node to trigger the generation and execution of the corresponding proof-of-work task, and finally returns it to the access node. The execution results obtained by executing the proof-of-work task. In order to ensure the randomness of the proof-of-work task and prevent the requesting node from obtaining the execution results in advance instead of temporarily executing the proof-of-work task, a random number needs to be provided to the requesting node to generate a random proof-of-work task. In addition, the proof of work request can also include the proof difficulty value used to generate the proof of work task, thereby instructing the requesting node to perform the proof of work task according to the corresponding proof difficulty value.
步骤204:接收所述请求节点响应于所述工作量证明请求执行所述工作量证明任务得到的执行结果以及针对所述执行结果生成的签名。Step 204: Receive the execution result obtained by the requesting node from executing the workload proof task in response to the workload proof request and the signature generated for the execution result.
请求节点在接收到工作量证明请求后,首先基于其包含的随机数生成对应的工作量证明任务,该工作量证明任务具体是指:通过不断变更待定值,不断构造由随机数和待定值按照预设顺序组合而成的字符串(或者由请求节点的节点公钥、随机数和待定值按照预设顺序组合而成的字符串),同时计算该字符串对应的哈希值,在该哈希值满足特定的形式规则的情况下,则将那次字符串中确定的待定值确定为工作量证明任务的执行结果。上述特定的形式规则例如可以包括哈希值的开头或结尾出现若干个连续的相同的字符(如“0”),而具体需要出现多少个连续的相同字符则取决于工作量证明任务对应的证明难度值,证明难度值越高,需要出现的连续相同字符的数量就越多。容易理解的是,证明难度值越高,则执行工作量证明任务并获得最终的执行结果所需的算力成本和时间成本就越高。After receiving the proof-of-work request, the requesting node first generates the corresponding proof-of-work task based on the random number it contains. The proof-of-work task specifically refers to: by continuously changing the undetermined value, continuously constructing the random number and the undetermined value according to the A string composed of a preset sequence (or a string composed of the node public key of the requesting node, a random number and a pending value in a preset sequence), and the hash value corresponding to the string is calculated at the same time. When the hash value satisfies specific formal rules, the undetermined value determined in that string is determined as the execution result of the workload proof task. The above-mentioned specific formal rules may include, for example, several consecutive identical characters (such as "0") appearing at the beginning or end of the hash value. The specific number of consecutive identical characters required to appear depends on the proof corresponding to the workload proof task. The difficulty value proves that the higher the difficulty value, the more consecutive identical characters need to appear. It is easy to understand that the higher the proof difficulty value, the higher the computing power cost and time cost required to perform the workload proof task and obtain the final execution result.
上述工作量证明任务利用了哈希运算不可逆、输出值与输入值之间缺乏规律的特性,要求证明方只能通过穷举待定值的方式才能获得最终的执行结果,因此作为证明方的请求节点需要消耗额外的算力才能与接入节点建立连接,这增加了请求节点建立连接的成本。The above workload proof task takes advantage of the irreversible characteristics of hash operations and the lack of regularity between output values and input values. It requires the prover to obtain the final execution result only by exhaustively enumerating the undetermined values. Therefore, as the request node of the prover Additional computing power is required to establish a connection with the access node, which increases the cost of requesting the node to establish a connection.
与此同时,为了证明得到的执行结果是请求节点自身执行工作量证明任务所得到的,因此还需要向接入节点提供对应的身份证明。具体而言,请求节点在得到执行结果后,还会针对所述执行结果生成对应的签名,该签名是请求节点使用自身持有的请求节点的节点私钥对所述执行结果进行加密得到的。At the same time, in order to prove that the execution result obtained is obtained by the requesting node itself to perform the workload proof task, it is also necessary to provide the corresponding identity certificate to the access node. Specifically, after obtaining the execution result, the requesting node will also generate a corresponding signature for the execution result. The signature is obtained by encrypting the execution result using the node private key of the requesting node it holds.
最后,请求节点会将自身得到的执行结果和针对该执行结果生成的签名发送至接入节点,以供接入节点进行验证,当然,请求节点还可以同时将请求节点的节点公钥也一并发送至接入节点。Finally, the requesting node will send the execution result it obtains and the signature generated for the execution result to the access node for verification. Of course, the requesting node can also send the node public key of the requesting node at the same time. Sent to access node.
步骤206:基于所述请求节点的节点公钥对所述签名进行验签,并基于所述执行结果对所述工作量证明任务进行验证。Step 206: Verify the signature based on the node public key of the requesting node, and verify the workload proof task based on the execution result.
接入节点在对所述签名进行验签时,需要使用自身预先维护的或请求节点临时提供的请求节点的节点公钥对所述签名进行解密,将得到的解密结果与执行结果进行比对,如果比对一致则说明该执行结果的来源方的确为所述请求节点,从而确定所述签名验签成功,如果比对不一致则说明该执行结果的来源方不为所述请求节点,从而确定所述签 名验签失败。When the access node verifies the signature, it needs to use the node public key of the requesting node that it has maintained in advance or that is temporarily provided by the requesting node to decrypt the signature, and compare the obtained decryption result with the execution result. If the comparison is consistent, it means that the source of the execution result is indeed the requesting node, thereby determining that the signature verification is successful. If the comparison is inconsistent, it means that the source of the execution result is not the requesting node, thus determining that the signature verification is successful. The above signature verification failed.
接入节点在对所述工作量证明任务进行验证时,其实际过程与请求节点执行工作量证明任务的过程类似,首先基于所述执行结果与所述随机数生成待检验字符串,然后将所述待检验字符串通过哈希运算以得到对应的哈希结果;最后在所述哈希结果满足所述证明难度值对应的工作量证明要求的情况下,确定所述工作量证明任务验证通过,否则确定所述工作量证明任务验证不通过。例如,接入节点维护的证明难度值要求所述哈希结果满足的工作量证明要求为:所述哈希结果的开头包含8个连续的字符“0”,那么只有在所述哈希结果的开头确实包含8个连续的字符“0”的情况下才会认为工作量证明任务验证通过,即认为请求节点确实正确合规地执行了工作量证明任务。如前所述,为了使请求节点能够提供满足证明难度值对应工作量证明要求的执行结果,所述工作量证明请求还可以包括用于生成所述工作量证明任务的证明难度值,以使请求节点在生成工作量证明任务时就充分考虑到该证明难度值并在此基础上生成满足证明难度值对应工作量证明要求的执行结果。When the access node verifies the workload proof task, its actual process is similar to the process of requesting the node to perform the workload proof task. First, the string to be verified is generated based on the execution result and the random number, and then the string is generated. The string to be tested is subjected to a hash operation to obtain the corresponding hash result; finally, when the hash result meets the workload proof requirements corresponding to the proof difficulty value, it is determined that the workload proof task is verified, Otherwise, it is determined that the proof-of-work task verification fails. For example, the proof difficulty value maintained by the access node requires that the hash result satisfies the workload proof requirement: the beginning of the hash result contains 8 consecutive characters "0", then only when the hash result Only when the beginning does contain 8 consecutive characters "0" will the proof-of-work task be deemed to have passed the verification, that is, the requesting node will be considered to have indeed executed the proof-of-work task correctly and compliantly. As mentioned above, in order to enable the requesting node to provide execution results that meet the proof of work requirements corresponding to the proof difficulty value, the proof of work request may also include the proof difficulty value used to generate the proof of work task, so that the request The node fully considers the proof difficulty value when generating the workload proof task, and based on this, generates execution results that meet the workload proof requirements corresponding to the proof difficulty value.
可选的,所述基于所述执行结果与所述随机数生成待检验字符串,包括:将所述执行结果、所述随机数与所述请求节点的节点公钥按照预设顺序进行组合以生成所述待检验字符串。在本说明书实施例中,上述的工作量证明任务所涉及构造的字符串还可以包括所述请求节点的节点公钥,这样一来就能够进一步实现请求节点与执行结果之间的强绑定,从而能够更加有效地证明该执行结果来源于字符串中节点公钥对应的请求节点。由于验证工作量证明任务与执行工作量证明任务的实质过程相当,因此,在验证工作量证明任务的过程中也应按照上述相同的构造规则组合生成待检验字符串并进行进一步的验证。Optionally, generating a string to be verified based on the execution result and the random number includes: combining the execution result, the random number and the node public key of the requesting node in a preset order to Generate the string to be tested. In the embodiment of this specification, the string constructed in the workload proof task mentioned above may also include the node public key of the requesting node. In this way, a strong binding between the requesting node and the execution result can be further realized. This can more effectively prove that the execution result comes from the requesting node corresponding to the node public key in the string. Since the substantive process of verifying a proof-of-work task is equivalent to that of executing a proof-of-work task, the string to be verified should also be generated according to the same combination of construction rules mentioned above and further verified during the process of verifying a proof-of-work task.
在本说明书实施例中,上述基于所述请求节点的节点公钥对所述签名进行验签的过程,以及基于所述执行结果对所述工作量证明任务进行验证的过程可以是独立的过程,即两个过程之间没有必然的执行顺序,二者可以一先一后按顺序执行或者同时执行,本说明书实施例对此并不做任何限制。可选的,所述基于所述执行结果对所述工作量证明任务进行验证,包括:在所述签名验签成功的情况下基于所述执行结果对所述工作量证明任务进行验证。值得一提的是,在本说明书实施例中,接入节点对工作量证明任务进行验证的过程可以放在对所述签名验签成功的情况下执行,这样一来,就可以在所述签名验签不成功的情况下无需进一步执行相对更加耗时的工作量证明任务的验证过程,从而一定程度上节省接入节点的计算资源,还能够防止攻击方通过发送超量的执行结果及其签名来迫使接入节点在短时间内执行大量消耗计算资源的验签/验证任务从而导致接 入节点宕机的现象,一定程度上起到了防网络攻击的效果。In the embodiment of this specification, the above-mentioned process of verifying the signature based on the node public key of the requesting node and the process of verifying the workload proof task based on the execution result may be independent processes, That is, there is no necessary order of execution between the two processes. The two processes can be executed sequentially or simultaneously. The embodiments of this specification do not impose any restrictions on this. Optionally, the verification of the proof-of-work task based on the execution result includes: verifying the proof-of-work task based on the execution result if the signature verification is successful. It is worth mentioning that in the embodiment of this specification, the process of the access node verifying the workload proof task can be executed when the signature verification is successful. In this way, the signature can be verified successfully. If the signature verification is unsuccessful, there is no need to further perform the verification process of the relatively more time-consuming workload proof task, thus saving the computing resources of the access node to a certain extent and preventing the attacker from sending excessive execution results and their signatures. To force the access node to perform a large number of signature verification/verification tasks that consume computing resources in a short period of time, causing the access node to go down, and to a certain extent, it has the effect of preventing network attacks.
可选的,还包括:根据距当前时刻之前的第一预设时长内工作量证明验证失败的次数调整所述证明难度值,所述证明难度值正相关于所述次数,所述次数为距所述当前时刻之前的第一预设时长内任一签名验签失败的次数与任一工作量证明任务验证不通过的次数之和。Optionally, it also includes: adjusting the proof difficulty value according to the number of failed proof-of-work verifications within the first preset time period before the current moment, where the proof difficulty value is directly related to the number of times, and the number of times is the number of times since the current moment. The sum of the number of times any signature verification fails and the number of times any proof-of-work task fails verification within the first preset time period before the current time.
在本说明书实施例中,接入节点维护有证明难度值,并且可以根据近期遭遇无成本接入行为(即前述验签失败或工作量证明任务验证失败)的次数来调整所述证明难度值。无成本接入行为的次数即工作量证明验证失败的次数,该次数是指任一签名验签失败的次数与任一工作量证明任务验证不通过的次数之和(即针对每一个连接请求,如果请求节点提供的签名验签失败或工作量证明任务验证失败,则该次数加一),该次数在进行统计时,针对每一次连接请求对应的请求节点提供的执行结果和签名,可能出现签名验签不成功同时工作量证明任务验证不成功的情况,此时仅将工作量证明验证失败的次数算作一次(而非两次),从而避免重复统计导致该次数较实际值偏高。由于无成本接入行为的次数客观上反映了区块链网络遭遇网络攻击的强度,因此本说明书实施例可以使得区块链网络在遭遇网络攻击的情况下增加新的请求节点建立连接的成本,来进一步提高攻击方通过与区块链网络建立大量连接来进行网络攻击的成本,进一步提高区块链网络防范网络攻击的能力。另外,由于对于证明难度值的调节是动态进行的,例如当近期遭遇无成本接入行为的次数减少时,又可以适当减少当前的证明难度值,从而在未遭遇网络攻击的情况下降低正常接入行为所需要的成本,尽可能避免“误杀”的现象。In the embodiment of this specification, the access node maintains a certification difficulty value, and can adjust the certification difficulty value according to the number of recent encounters with costless access behaviors (ie, the aforementioned signature verification failure or workload proof task verification failure). The number of costless access behaviors is the number of failed proof-of-work verifications. This number refers to the sum of the number of failed signature verifications and the number of failed verifications of any proof-of-work task (that is, for each connection request, If the signature provided by the requesting node fails to be verified or the proof-of-work task fails to be verified, this number will be increased by one). When counting this number, signatures may appear in the execution results and signatures provided by the requesting node corresponding to each connection request. If the signature verification fails and the proof-of-work task verification fails, then only the number of failed proof-of-work verifications will be counted once (instead of twice) to avoid repeated statistics that may cause the number to be higher than the actual value. Since the number of costless access behaviors objectively reflects the intensity of network attacks encountered by the blockchain network, embodiments of this specification can enable the blockchain network to increase the cost of establishing a connection by new requesting nodes when encountering network attacks. To further increase the cost of cyber attacks for attackers by establishing a large number of connections to the blockchain network, and further improve the ability of the blockchain network to prevent cyber attacks. In addition, since the adjustment of the proof difficulty value is carried out dynamically, for example, when the number of costless access behaviors encountered recently decreases, the current proof difficulty value can be appropriately reduced, thereby reducing the normal access level without encountering network attacks. The cost required for entry behavior should be paid attention to, and the phenomenon of "accidental killing" should be avoided as much as possible.
可选的,所述区块链网络部署的网络管理合约维护有所述证明难度值;所述根据距当前时刻之前的第一预设时长内工作量证明验证失败的次数调整所述证明难度值,包括:向所述区块链网络部署的网络管理合约发起包含所述次数的证明难度值调整交易,以使所述网络管理合约基于所述次数调整维护于所述网络管理合约中的所述证明难度值。Optionally, the network management contract deployed by the blockchain network maintains the proof difficulty value; the proof difficulty value is adjusted according to the number of workload proof verification failures within the first preset time period before the current time. , including: initiating a proof difficulty value adjustment transaction including the said number of times to the network management contract deployed on the blockchain network, so that the network management contract adjusts the said number maintained in the network management contract based on the said number of times. Prove the difficulty value.
在本说明书实施例中,接入节点维护的证明难度值具体存放在其部署的网络管理合约中。因此,在这种情况下,区块链网络中的每个区块链节点实际上通过维护相同的网络管理合约来共享同一个证明难度值,这使得其中任一区块链节点都可以在检测到网络攻击时,通过向网络管理合约发起证明难度值调整交易的方式来调整维护在网络管理合约中的证明难度值,来向区块链网络中的其他区块链节点告知证明难度值的变化,使得区块链网络具备根据当前网络环境的变化来整体调整所有节点的接入策略的功能,提高区块链网络整体上防范网络攻击的能力。In the embodiment of this specification, the proof difficulty value maintained by the access node is specifically stored in the network management contract deployed by it. Therefore, in this case, each blockchain node in the blockchain network actually shares the same proof difficulty value by maintaining the same network management contract, which allows any one of the blockchain nodes to detect When a network attack occurs, the proof difficulty value maintained in the network management contract is adjusted by initiating a proof difficulty value adjustment transaction to the network management contract to inform other blockchain nodes in the blockchain network of the change in proof difficulty value. , enabling the blockchain network to have the function of overall adjusting the access strategies of all nodes according to changes in the current network environment, and improving the overall ability of the blockchain network to prevent network attacks.
步骤208:在所述签名验签成功且所述工作量证明任务验证通过的情况下,与所述 请求节点建立连接。Step 208: If the signature verification is successful and the proof-of-work task verification passes, establish a connection with the requesting node.
基于本说明书的前述实施例,提出了一种需要额外消耗算力的连接建立机制,请求节点需要向区块链网络中的接入节点提供身份证明以及执行工作量证明任务后得到的执行结果,并在通过接入节点的验证后才能与接入节点建立连接,这增加了攻击方侵入区块链网络时所需的计算成本和时间成本,从而能够限制攻击方无法在短时间内通过与区块链网络建立大量连接来发起大规模攻击,提高了区块链网络防范网络攻击的能力。Based on the foregoing embodiments of this specification, a connection establishment mechanism is proposed that requires additional computing power. The requesting node needs to provide the access node in the blockchain network with identity proof and the execution results obtained after executing the workload proof task. And the connection can only be established with the access node after passing the verification of the access node. This increases the computational cost and time cost required for the attacker to invade the blockchain network, thereby limiting the attacker from being able to pass through the area in a short time. The blockchain network establishes a large number of connections to launch large-scale attacks, which improves the blockchain network's ability to prevent cyber attacks.
在请求节点属于所述区块链网络的情况下,则接入节点在确认所述签名验签成功且所述工作量证明任务验证通过的情况下仅会与其建立连接。而在所述请求节点不属于所述区块链网络的情况下,所述方法还包括:在所述签名验签成功且所述工作量证明任务验证通过的情况下,将所述请求节点加入所述区块链网络。在本说明书实施例中,如果请求节点本身不属于区块链网络,那么接入节点在确认所述签名验签成功且所述工作量证明任务验证通过的情况下,默认会将请求节点加入到区块链网络中。由于本说明书实施例使得新节点加入区块链网络的过程需要付出额外的算力成本,从而增加了女巫攻击(攻击方在如区块链网络这样的P2P网络中部署多个具有合法身份的节点)的攻击成本,间接限制攻击方进行女巫攻击的强度,提高了区块链网络防范网络攻击的能力。If the requesting node belongs to the blockchain network, the access node will only establish a connection with it after confirming that the signature verification is successful and the proof-of-work task verification is passed. When the requesting node does not belong to the blockchain network, the method further includes: when the signature verification is successful and the proof-of-work task verification passes, adding the requesting node to the network. The blockchain network. In the embodiment of this specification, if the requesting node itself does not belong to the blockchain network, then the access node will add the requesting node to the blockchain network by default after confirming that the signature verification is successful and the workload proof task verification is passed. in the blockchain network. Since the embodiments of this specification require additional computing power costs for new nodes to join the blockchain network, there is an increase in Sybil attacks (the attacker deploys multiple nodes with legal identities in a P2P network such as the blockchain network). ) attack cost, indirectly limits the intensity of the attacker's Sybil attack, and improves the blockchain network's ability to prevent network attacks.
具体而言,所述将所述请求节点加入所述区块链网络,包括:将所述请求节点的节点信息存储于所述接入节点维护的节点列表中,并将所述接入节点的节点信息发送至所述请求节点。如前所述,区块链网络中的每个节点都会维护一个节点列表用于存放与该节点建立有连接的其他节点的节点信息。在本说明书实施例中,接入节点会首先将请求节点的节点信息存储于所述接入节点维护的节点列表中,同时,接入节点会向请求节点发送接入节点的节点信息同时告知请求节点已经成功加入了区块链网络,那么请求节点就会建立一个自身维护的节点列表,并将接入节点的节点信息存放在请求节点维护的节点列表中。在请求节点通过接入节点加入区块链网络后,其最初只知晓区块链网络中的该接入节点,如果需要进一步发现区块链网络中的其他节点并与它们建立连接,则需要向接入节点发送节点发现请求,以使接入节点响应于节点发现请求向请求节点返回接入节点维护的节点列表,接入节点通过接收到的节点列表从而知晓到区块链网络中的其他节点,并通过接收到的节点列表中的节点信息与其他节点建立连接并向它们发送新的节点发现请求,迭代上述过程理论上就能够使得新加入区块链网络的请求节点知晓区块链网络中的所有节点并与所有节点建立连接。以图1中nodeF通过nodeE加入区块链网络为例,nodeF首先向nodeE发送节点发现请求,以获取nodeE维护的节点列表,并从该节点列表中得到与nodeE具有连接关系的nodeB和nodeD的节点信息,nodeF据此再分 别与nodeB和nodeD建立连接并分别发送节点发现请求,从而进一步获得nodeB维护的节点列表和nodeD维护的节点列表,重复上述过程,nodeF最终就能够获知区块链网络中所有节点的节点信息,并且理论上也能够与所有节点建立连接。Specifically, adding the requesting node to the blockchain network includes: storing the node information of the requesting node in a node list maintained by the access node, and adding the node information of the access node to the blockchain network. Node information is sent to the requesting node. As mentioned before, each node in the blockchain network maintains a node list to store node information of other nodes that are connected to the node. In the embodiment of this specification, the access node will first store the node information of the requesting node in the node list maintained by the access node. At the same time, the access node will send the node information of the access node to the requesting node and notify the request The node has successfully joined the blockchain network, then the requesting node will establish a node list maintained by itself, and store the node information of the access node in the node list maintained by the requesting node. After the requesting node joins the blockchain network through the access node, it initially only knows the access node in the blockchain network. If it needs to further discover other nodes in the blockchain network and establish connections with them, it needs to The access node sends a node discovery request, so that the access node returns the node list maintained by the access node to the requesting node in response to the node discovery request. The access node knows other nodes in the blockchain network through the received node list. , and establish connections with other nodes through the received node information in the node list and send them new node discovery requests. Iterating the above process can theoretically make the requesting nodes newly added to the blockchain network aware of the information in the blockchain network. of all nodes and establish connections with all nodes. Take nodeF joining the blockchain network through nodeE in Figure 1 as an example. nodeF first sends a node discovery request to nodeE to obtain the node list maintained by nodeE, and obtain the nodes of nodeB and nodeD that have a connection relationship with nodeE from the node list. Information, nodeF then establishes connections with nodeB and nodeD respectively and sends node discovery requests respectively, thereby further obtaining the node list maintained by nodeB and the node list maintained by nodeD. By repeating the above process, nodeF will finally be able to learn all the nodes in the blockchain network. The node information of the node, and theoretically can also establish connections with all nodes.
可选的,所述将所述请求节点加入所述区块链网络,包括:向所述区块链网络中的网络管理合约发起包含所述请求节点的节点信息的节点加入交易,以使所述网络管理合约维护所述请求节点的节点信息。在本说明书实施例中,区块链网络部署的网络管理合约中维护有作为区块链网络中所有成员的各区块链节点的节点信息,因此,在有新节点(请求节点)加入后,接入节点还可以通过向网络管理合约发起节点加入交易以使请求节点的节点信息被更新维护在网络管理合约中。Optionally, adding the requesting node to the blockchain network includes: initiating a node joining transaction containing the node information of the requesting node to the network management contract in the blockchain network, so that the requesting node can be added to the blockchain network. The network management contract maintains node information of the requesting node. In the embodiment of this specification, the network management contract deployed by the blockchain network maintains the node information of each blockchain node as all members of the blockchain network. Therefore, after a new node (requesting node) joins, The entry node can also initiate a node joining transaction to the network management contract so that the node information of the requesting node is updated and maintained in the network management contract.
可选的,所述请求节点的节点标识由所述接入节点生成,或者,所述请求节点的节点标识由所述请求节点生成。具体而言,在所述请求节点的节点标识由所述接入节点生成的情况下,所述接入节点在所述签名验签成功且所述工作量证明任务验证通过的情况下生成,从而避免每次接收到连接请求都生成一次节点标识,减轻接入节点的计算负担,还能够防止攻击方通过发送超量的连接请求来迫使接入节点在短时间内执行大量消耗计算资源的节点标识生成任务从而导致接入节点宕机的现象,一定程度上起到了防网络攻击的效果。可选的,所述请求节点的节点标识是通过所述请求节点的节点公钥进行哈希运算生成的,因此可以通过节点公钥的全局唯一性来确保在不发生哈希碰撞的情况下的各节点的节点标识的全局唯一性。Optionally, the node identifier of the requesting node is generated by the access node, or the node identifier of the requesting node is generated by the requesting node. Specifically, when the node identification of the requesting node is generated by the access node, the access node generates it when the signature verification is successful and the proof-of-work task verification is passed, so that It avoids generating a node identifier every time a connection request is received, reducing the computing burden on the access node. It also prevents the attacker from forcing the access node to execute a large number of node identifiers that consume computing resources in a short period of time by sending an excessive number of connection requests. Generating tasks causes the access node to go down, which to a certain extent prevents network attacks. Optionally, the node identification of the requesting node is generated by hashing the node public key of the requesting node, so the global uniqueness of the node public key can be used to ensure that no hash collision occurs. Global uniqueness of the node ID of each node.
可选的,还包括:在检测出所述请求节点的节点标识于所述区块链网络中全局不唯一的情况下,向所述请求节点发送节点标识提供请求或生成所述区块链网络中全局唯一的第一节点标识以重新确定为所述请求节点的节点标识,所述节点标识提供请求用于使所述请求节点重新向所述接入节点提供第二节点标识以重新确定为所述请求节点的节点标识。在本说明书实施例中,如果接入节点发现请求节点的节点标识与区块链网络中某个现有节点的节点标识重复,则会重新生成新的节点标识以重新作为请求节点的节点标识,或者要求请求节点重新提供新的节点标识以重新作为请求节点的节点标识,从而确保区块链网络中各节点的节点标识均具有全局唯一性。Optionally, it also includes: when it is detected that the node identification of the requesting node is not globally unique in the blockchain network, sending a node identification provision request to the requesting node or generating the blockchain network The globally unique first node identifier in the requesting node is re-determined to be the node identifier of the requesting node. The node identifier providing request is used to cause the requesting node to re-provide the second node identifier to the access node to be re-determined to be the requesting node. The node ID of the requesting node. In the embodiment of this specification, if the access node finds that the node identification of the requesting node is the same as the node identification of an existing node in the blockchain network, it will regenerate a new node identification to serve as the node identification of the requesting node. Or require the requesting node to re-provide a new node identification as the node identification of the requesting node, thereby ensuring that the node identification of each node in the blockchain network is globally unique.
可选的,还包括:在距当前时刻之前的第二预设时长内接收到同一发起方发起的基于任一协议的历史消息的数量超出预设阈值的情况下,拒绝响应所述同一发起方发起的基于所述任一协议的消息,所述任一协议的消息至少包括连接协议中的连接请求、节点发现协议中的节点发现请求等,本说明书实施例并不对协议的类型进行限制,但该协议一定被预先建立并维护在区块链网络中,以使得区块链网络中的节点能够识别并处理该 协议对应的消息。通过本说明书实施例,可以通过统计接收到的各类协议的消息(包括各类请求或应答),并在其中来源于同一发起方的某一类协议的历史消息在短时间内过量的情况下,拒绝再次响应该同一发起方的该类协议的消息,从而有效地识别出攻击方并将其移入黑名单,有效防范例如泛洪攻击或DOS(Denial of Service,拒绝服务)攻击等相同攻击方通过超量发送消息的网络攻击方式。Optionally, it also includes: refusing to respond to the same initiator when the number of historical messages based on any protocol initiated by the same initiator exceeds a preset threshold within a second preset time period before the current moment. Messages initiated based on any of the protocols, which include at least a connection request in a connection protocol, a node discovery request in a node discovery protocol, etc. The embodiments of this specification do not limit the type of the protocol, but The protocol must be pre-established and maintained in the blockchain network so that nodes in the blockchain network can identify and process messages corresponding to the protocol. Through the embodiments of this specification, it is possible to count the received messages of various protocols (including various requests or responses), and when the historical messages of a certain type of protocol originating from the same initiator are excessive in a short period of time, , refusing to respond to messages of this type of protocol from the same initiator again, thereby effectively identifying the attacker and moving it into the blacklist, effectively preventing the same attacker such as flooding attacks or DOS (Denial of Service, Denial of Service) attacks. A network attack method through excessive sending of messages.
图3是一示例性实施例提供的一种设备的示意结构图。请参考图3,在硬件层面,该设备包括处理器302、内部总线303、网络接口306、内存308以及非易失性存储器310,当然还可能包括其他业务所需要的硬件。本说明书一个或多个实施例可以基于软件方式来实现,比如由处理器302从非易失性存储器310中读取对应的计算机程序到内存308中然后运行。当然,除了软件实现方式之外,本说明书一个或多个实施例并不排除其他实现方式,比如逻辑器件抑或软硬件结合的方式等等,也就是说以下处理流程的执行方并不限定于各个逻辑单元,也可以是硬件或逻辑器件。Figure 3 is a schematic structural diagram of a device provided by an exemplary embodiment. Please refer to Figure 3. At the hardware level, the device includes a processor 302, an internal bus 303, a network interface 306, a memory 308 and a non-volatile memory 310. Of course, it may also include other hardware required for services. One or more embodiments of this specification may be implemented based on software. For example, the processor 302 reads the corresponding computer program from the non-volatile memory 310 into the memory 308 and then runs it. Of course, in addition to software implementation, one or more embodiments of this specification do not exclude other implementations, such as logic devices or a combination of software and hardware, etc. That is to say, the execution party of the following processing flow is not limited to each A logic unit can also be a hardware or logic device.
如图4所示,图4是本说明书根据一示例性实施例提供的一种防范网络攻击的装置的框图,该装置可以应用于如图3所示的设备中,以实现本说明书的技术方案。该装置应用于区块链网络中的接入节点,包括:请求接收单元401,用于接收请求节点发送的连接请求,将工作量证明请求发送至所述请求节点,所述工作量证明请求包括用于生成工作量证明任务的随机数;As shown in Figure 4, Figure 4 is a block diagram of a device for preventing network attacks provided in this specification according to an exemplary embodiment. This device can be applied to the equipment shown in Figure 3 to implement the technical solution of this specification. . The device is applied to access nodes in a blockchain network and includes: a request receiving unit 401, used to receive a connection request sent by a requesting node, and send a workload proof request to the requesting node, where the workload proof request includes Random numbers used to generate proof-of-work tasks;
结果接收单元402,用于接收所述请求节点响应于所述工作量证明请求执行所述工作量证明任务得到的执行结果以及针对所述执行结果生成的签名;结果验证单元403,用于基于所述请求节点的节点公钥对所述签名进行验签,并基于所述执行结果对所述工作量证明任务进行验证;连接建立单元404,用于在所述签名验签成功且所述工作量证明任务验证通过的情况下,与所述请求节点建立连接。The result receiving unit 402 is used to receive the execution result obtained by the requesting node from executing the workload proof task in response to the workload proof request and the signature generated for the execution result; the result verification unit 403 is used to based on the workload proof task. The node public key of the requesting node verifies the signature, and verifies the workload proof task based on the execution result; the connection establishment unit 404 is used to verify the signature when the signature verification is successful and the workload If the verification task passes, a connection is established with the requesting node.
可选的,所述工作量证明请求还包括用于生成所述工作量证明任务的证明难度值;所述结果验证单元403具体用于:基于所述执行结果与所述随机数生成待检验字符串,将所述待检验字符串通过哈希运算以得到对应的哈希结果;在所述哈希结果满足所述证明难度值对应的工作量证明要求的情况下,确定所述工作量证明任务验证通过,否则确定所述工作量证明任务验证不通过。Optionally, the workload proof request also includes a proof difficulty value used to generate the workload proof task; the result verification unit 403 is specifically configured to: generate a character to be verified based on the execution result and the random number. String, perform a hash operation on the string to be tested to obtain the corresponding hash result; when the hash result meets the workload proof requirements corresponding to the proof difficulty value, determine the workload proof task The verification passes, otherwise it is determined that the verification of the workload proof task fails.
可选的,所述结果验证单元403进一步用于:将所述执行结果、所述随机数与所述请求节点的节点公钥按照预设顺序进行组合以生成所述待检验字符串。Optionally, the result verification unit 403 is further configured to: combine the execution result, the random number and the node public key of the requesting node in a preset order to generate the string to be verified.
可选的,还包括:难度值调整单元405,用于根据距当前时刻之前的第一预设时长内工作量证明验证失败的次数调整所述证明难度值,所述证明难度值正相关于所述次数, 所述次数为距所述当前时刻之前的第一预设时长内任一签名验签失败的次数与任一工作量证明任务验证不通过的次数之和。Optionally, it also includes: a difficulty value adjustment unit 405, configured to adjust the proof difficulty value according to the number of workload proof verification failures within the first preset time period before the current time, and the proof difficulty value is positively related to the proof difficulty value. The number of times described above is the sum of the number of times any signature verification fails and the number of times any proof-of-work task fails verification within the first preset time period before the current moment.
可选的,所述区块链网络部署的网络管理合约维护有所述证明难度值;所述难度值调整单元405具体用于:向所述区块链网络部署的网络管理合约发起包含所述次数的证明难度值调整交易,以使所述网络管理合约基于所述次数调整维护于所述网络管理合约中的所述证明难度值。Optionally, the network management contract deployed on the blockchain network maintains the certification difficulty value; the difficulty value adjustment unit 405 is specifically configured to: initiate a certificate containing the certification to the network management contract deployed on the blockchain network. The number of proof difficulty value adjustment transactions is such that the network management contract adjusts the proof difficulty value maintained in the network management contract based on the number of times.
可选的,所述结果验证单元403具体用于:在所述签名验签成功的情况下基于所述执行结果对所述工作量证明任务进行验证。Optionally, the result verification unit 403 is specifically configured to verify the workload proof task based on the execution result if the signature verification is successful.
可选的,在所述请求节点不属于所述区块链网络的情况下,所述装置还包括:Optionally, when the requesting node does not belong to the blockchain network, the device further includes:
节点加入单元406,用于在所述签名验签成功且所述工作量证明任务验证通过的情况下,将所述请求节点加入所述区块链网络。The node adding unit 406 is configured to add the requesting node to the blockchain network when the signature verification is successful and the proof-of-work task verification passes.
可选的,所述节点加入单元406具体用于:将所述请求节点的节点信息存储于所述接入节点维护的节点列表中,并将所述接入节点的节点信息发送至所述请求节点。Optionally, the node joining unit 406 is specifically configured to: store the node information of the requesting node in the node list maintained by the access node, and send the node information of the access node to the requesting node. node.
可选的,所述节点加入单元406具体用于:向所述区块链网络中的网络管理合约发起包含所述请求节点的节点信息的节点加入交易,以使所述网络管理合约维护所述请求节点的节点信息。Optionally, the node joining unit 406 is specifically configured to: initiate a node joining transaction containing the node information of the requesting node to the network management contract in the blockchain network, so that the network management contract maintains the Node information for the requested node.
可选的,所述节点信息包括节点标识、节点公钥和/或网络地址。Optionally, the node information includes node identification, node public key and/or network address.
可选的,所述请求节点的节点标识由所述接入节点在所述签名验签成功且所述工作量证明任务验证通过的情况下生成,或者,所述请求节点的节点标识由所述请求节点生成。Optionally, the node identification of the requesting node is generated by the access node when the signature verification is successful and the proof-of-work task verification passes, or the node identification of the requesting node is generated by the access node. Request node generation.
可选的,还包括:节点标识重确定单元407,用于在检测出所述请求节点的节点标识于所述区块链网络中全局不唯一的情况下,向所述请求节点发送节点标识提供请求或生成所述区块链网络中全局唯一的第一节点标识以重新确定为所述请求节点的节点标识,所述节点标识提供请求用于使所述请求节点重新向所述接入节点提供第二节点标识以重新确定为所述请求节点的节点标识。Optionally, it also includes: a node identification re-determination unit 407, configured to send a node identification provision to the requesting node when it is detected that the node identification of the requesting node is not globally unique in the blockchain network. Request or generate a globally unique first node identification in the blockchain network to re-determine as the node identification of the requesting node, and the node identification providing request is used to cause the requesting node to re-provide it to the access node. The second node identification is redetermined as the node identification of the requesting node.
可选的,还包括:响应拒绝单元408,用于在距当前时刻之前的第二预设时长内接收到同一发起方发起的基于任一协议的历史消息的数量超出预设阈值的情况下,不响应所述同一发起方发起的基于所述任一协议的消息,所述任一协议的消息至少包括连接协议中的连接请求。Optionally, it also includes: a response rejection unit 408, configured to receive a number of historical messages based on any protocol initiated by the same initiator within the second preset time period before the current moment exceeding the preset threshold, Do not respond to messages based on any protocol initiated by the same initiator, and the messages of any protocol at least include a connection request in the connection protocol.
在20世纪90年代,对于一个技术的改进可以很明显地区分是硬件上的改进(例如,对二极管、晶体管、开关等电路结构的改进)还是软件上的改进(对于方法流程的改进)。 然而,随着技术的发展,当今的很多方法流程的改进已经可以视为硬件电路结构的直接改进。设计人员几乎都通过将改进的方法流程编程到硬件电路中来得到相应的硬件电路结构。因此,不能说一个方法流程的改进就不能用硬件实体模块来实现。例如,可编程逻辑器件(Programmable Logic Device,PLD)(例如现场可编程门阵列(Field Programmable Gate Array,FPGA))就是这样一种集成电路,其逻辑功能由用户对器件编程来确定。由设计人员自行编程来把一个数字系统“集成”在一片PLD上,而不需要请芯片制造厂商来设计和制作专用的集成电路芯片。而且,如今,取代手工地制作集成电路芯片,这种编程也多半改用“逻辑编译器(logic compiler)”软件来实现,它与程序开发撰写时所用的软件编译器相类似,而要编译之前的原始代码也得用特定的编程语言来撰写,此称之为硬件描述语言(Hardware Description Language,HDL),而HDL也并非仅有一种,而是有许多种,如ABEL(Advanced Boolean Expression Language)、AHDL(Altera Hardware Description Language)、Confluence、CUPL(Cornell University Programming Language)、HDCal、JHDL(Java Hardware Description Language)、Lava、Lola、MyHDL、PALASM、RHDL(Ruby Hardware Description Language)等,目前最普遍使用的是VHDL(Very-High-Speed Integrated Circuit Hardware Description Language)与Verilog。本领域技术人员也应该清楚,只需要将方法流程用上述几种硬件描述语言稍作逻辑编程并编程到集成电路中,就可以很容易得到实现该逻辑方法流程的硬件电路。In the 1990s, improvements in a technology could be clearly distinguished as hardware improvements (for example, improvements in circuit structures such as diodes, transistors, switches, etc.) or software improvements (improvements in method processes). However, with the development of technology, many improvements in today's method processes can be regarded as direct improvements in hardware circuit structures. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement of a method flow cannot be implemented using hardware entity modules. For example, a Programmable Logic Device (PLD) (such as a Field Programmable Gate Array (FPGA)) is such an integrated circuit whose logic functions are determined by the user programming the device. Designers can program themselves to "integrate" a digital system on a PLD, instead of asking chip manufacturers to design and produce dedicated integrated circuit chips. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented using "logic compiler" software, which is similar to the software compiler used in program development and writing, and before compilation The original code must also be written in a specific programming language, which is called Hardware Description Language (HDL), and HDL is not just one kind, but there are many, such as ABEL (Advanced Boolean Expression Language) , AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc., are currently the most commonly used The two are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that by simply logically programming the method flow using the above-mentioned hardware description languages and programming it into the integrated circuit, the hardware circuit that implements the logical method flow can be easily obtained.
控制器可以按任何适当的方式实现,例如,控制器可以采取例如微处理器或处理器以及存储可由该(微)处理器执行的计算机可读程序代码(例如软件或固件)的计算机可读介质、逻辑门、开关、专用集成电路(Application Specific Integrated Circuit,ASIC)、可编程逻辑控制器和嵌入微控制器的形式,控制器的例子包括但不限于以下微控制器:ARC 625D、Atmel AT91SAM、Microchip PIC18F26K20以及Silicone Labs C8051F320,存储器控制器还可以被实现为存储器的控制逻辑的一部分。本领域技术人员也知道,除了以纯计算机可读程序代码方式实现控制器以外,完全可以通过将方法步骤进行逻辑编程来使得控制器以逻辑门、开关、专用集成电路、可编程逻辑控制器和嵌入微控制器等的形式来实现相同功能。因此这种控制器可以被认为是一种硬件部件,而对其内包括的用于实现各种功能的装置也可以视为硬件部件内的结构。或者甚至,可以将用于实现各种功能的装置视为既可以是实现方法的软件模块又可以是硬件部件内的结构。The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer readable medium storing computer readable program code (eg, software or firmware) executable by the (micro)processor. , logic gates, switches, Application Specific Integrated Circuit (ASIC), programmable logic controllers and embedded microcontrollers. Examples of controllers include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, For Microchip PIC18F26K20 and Silicone Labs C8051F320, the memory controller can also be implemented as part of the memory's control logic. Those skilled in the art also know that in addition to implementing the controller in the form of pure computer-readable program code, the controller can be completely programmed with logic gates, switches, application-specific integrated circuits, programmable logic controllers and embedded logic by logically programming the method steps. Microcontroller, etc. to achieve the same function. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be considered as structures within the hardware component. Or even, the means for implementing various functions can be considered as structures within hardware components as well as software modules implementing the methods.
上述实施例阐明的系统、装置、模块或单元,具体可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。一种典型的实现设备为服务器系统。当然,本发明不排除随着未来计算机技术的发展,实现上述实施例功能的计算机例如可以为个人计算 机、膝上型计算机、车载人机交互设备、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件设备、游戏控制台、平板计算机、可穿戴设备或者这些设备中的任何设备的组合。The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a server system. Of course, the present invention does not exclude that with the development of computer technology in the future, the computer that implements the functions of the above embodiments may be, for example, a personal computer, a laptop computer, a vehicle-mounted human-computer interaction device, a cellular phone, a camera phone, a smart phone, or a personal digital assistant. , media player, navigation device, email device, game console, tablet, wearable device, or a combination of any of these devices.
虽然本说明书一个或多个实施例提供了如实施例或流程图所述的方法操作步骤,但基于常规或者无创造性的手段可以包括更多或者更少的操作步骤。实施例中列举的步骤顺序仅仅为众多步骤执行顺序中的一种方式,不代表唯一的执行顺序。在实际中的装置或终端产品执行时,可以按照实施例或者附图所示的方法顺序执行或者并行执行(例如并行处理器或者多线程处理的环境,甚至为分布式数据处理环境)。术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、产品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、产品或者设备所固有的要素。在没有更多限制的情况下,并不排除在包括所述要素的过程、方法、产品或者设备中还存在另外的相同或等同要素。例如若使用到第一,第二等词语用来表示名称,而并不表示任何特定的顺序。Although one or more embodiments of this specification provide method operation steps as described in the embodiments or flow charts, more or fewer operation steps may be included based on conventional or non-inventive means. The sequence of steps listed in the embodiment is only one way of executing the sequence of many steps, and does not represent the only execution sequence. When the actual device or terminal product is executed, it may be executed sequentially or in parallel according to the methods shown in the embodiments or figures (for example, a parallel processor or a multi-thread processing environment, or even a distributed data processing environment). The terms "comprises," "comprises" or any other variation thereof are intended to cover a non-exclusive inclusion such that a process, method, product or apparatus including a list of elements includes not only those elements but also others not expressly listed elements, or elements inherent to the process, method, product or equipment. Without further limitation, it does not exclude the presence of additional identical or equivalent elements in a process, method, product or apparatus including the stated elements. For example, if the words "first" and "second" are used to express names, they do not indicate any specific order.
为了描述的方便,描述以上装置时以功能分为各种模块分别描述。当然,在实施本说明书一个或多个时可以把各模块的功能在同一个或多个软件和/或硬件中实现,也可以将实现同一功能的模块由多个子模块或子单元的组合实现等。以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。For the convenience of description, when describing the above device, the functions are divided into various modules and described separately. Of course, when implementing one or more of this specification, the functions of each module can be implemented in the same or multiple software and/or hardware, or the modules that implement the same function can be implemented by a combination of multiple sub-modules or sub-units, etc. . The device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated. to another system, or some features can be ignored, or not implemented. On the other hand, the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the devices or units may be in electrical, mechanical or other forms.
本发明是参照根据本发明实施例的方法、装置(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each process and/or block in the flowchart illustrations and/or block diagrams, and combinations of processes and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing device to produce a machine, such that the instructions executed by the processor of the computer or other programmable data processing device produce a use A device for realizing the functions specified in one process or multiple processes of the flowchart and/or one block or multiple blocks of the block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或 多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory that causes a computer or other programmable data processing apparatus to operate in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction means, the instructions The device implements the functions specified in a process or processes of the flowchart and/or a block or blocks of the block diagram.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions may also be loaded onto a computer or other programmable data processing device, causing a series of operating steps to be performed on the computer or other programmable device to produce computer-implemented processing, thereby executing on the computer or other programmable device. Instructions provide steps for implementing the functions specified in a process or processes of a flowchart diagram and/or a block or blocks of a block diagram.
在一个典型的配置中,计算设备包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。Memory may include non-permanent storage in computer-readable media, random access memory (RAM) and/or non-volatile memory in the form of read-only memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁盘存储、石墨烯存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。Computer-readable media includes both persistent and non-volatile, removable and non-removable media that can be implemented by any method or technology for storage of information. Information may be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), and read-only memory. (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, Magnetic tape cartridges, magnetic tape disk storage, graphene storage or other magnetic storage devices or any other non-transmission medium can be used to store information that can be accessed by a computing device. As defined in this article, computer-readable media does not include transitory media, such as modulated data signals and carrier waves.
本领域技术人员应明白,本说明书一个或多个实施例可提供为方法、系统或计算机程序产品。因此,本说明书一个或多个实施例可采用完全硬件实施例、完全软件实施例或结合软件和硬件方面的实施例的形式。而且,本说明书一个或多个实施例可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。It should be understood by those skilled in the art that one or more embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, one or more embodiments of the present description may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment that combines software and hardware aspects. Furthermore, one or more embodiments of the present description may employ a computer program implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein. Product form.
本说明书一个或多个实施例可以在由计算机执行的计算机可执行指令的一般上下文中描述,例如程序模块。一般地,程序模块包括执行特定任务或实现特定抽象数据类型的例程、程序、对象、组件、数据结构等等。也可以在分布式计算环境中实践本本说明书一个或多个实施例,在这些分布式计算环境中,由通过通信网络而被连接的远程处理设备来执行任务。在分布式计算环境中,程序模块可以位于包括存储设备在内的本地和远程计算机存储介质中。One or more embodiments of this specification may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. One or more embodiments of the present description may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including storage devices.
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分 互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于系统实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。在本说明书的描述中,参考术语“一个实施例”、“一些实施例”、“示例”、“具体示例”、或“一些示例”等的描述意指结合该实施例或示例描述的具体特征、结构、材料或者特点包含于本说明书的至少一个实施例或示例中。在本说明书中,对上述术语的示意性表述不必须针对的是相同的实施例或示例。而且,描述的具体特征、结构、材料或者特点可以在任一个或多个实施例或示例中以合适的方式结合。此外,在不相互矛盾的情况下,本领域的技术人员可以将本说明书中描述的不同实施例或示例以及不同实施例或示例的特征进行结合和组合。Each embodiment in this specification is described in a progressive manner. The same and similar parts between the various embodiments can be referred to each other. Each embodiment focuses on its differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple. For relevant details, please refer to the partial description of the method embodiment. In the description of this specification, reference to the terms "one embodiment," "some embodiments," "an example," "specific examples," or "some examples" or the like means that specific features are described in connection with the embodiment or example. , structures, materials or features are included in at least one embodiment or example of this specification. In this specification, the schematic expressions of the above terms are not necessarily directed to the same embodiment or example. Furthermore, the specific features, structures, materials or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, those skilled in the art may combine and combine different embodiments or examples and features of different embodiments or examples described in this specification unless they are inconsistent with each other.
以上所述仅为本说明书一个或多个实施例的实施例而已,并不用于限制本本说明书一个或多个实施例。对于本领域技术人员来说,本说明书一个或多个实施例可以有各种更改和变化。凡在本说明书的精神和原理之内所作的任何修改、等同替换、改进等,均应包含在权利要求范围之内。The above descriptions are only examples of one or more embodiments of this specification, and are not intended to limit one or more embodiments of this specification. To those skilled in the art, various modifications and changes may be made to one or more embodiments of this specification. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of this specification shall be included in the scope of the claims.

Claims (16)

  1. 一种防范网络攻击的方法,应用于区块链网络中的接入节点,包括:A method to prevent network attacks, applied to access nodes in the blockchain network, including:
    接收请求节点发送的连接请求,将工作量证明请求发送至所述请求节点,所述工作量证明请求包括用于生成工作量证明任务的随机数;Receive a connection request sent by a requesting node, and send a proof-of-work request to the requesting node, where the proof-of-work request includes a random number used to generate a proof-of-work task;
    接收所述请求节点响应于所述工作量证明请求执行所述工作量证明任务得到的执行结果以及针对所述执行结果生成的签名;Receive the execution result obtained by the requesting node from executing the workload proof task in response to the workload proof request and the signature generated for the execution result;
    基于所述请求节点的节点公钥对所述签名进行验签,并基于所述执行结果对所述工作量证明任务进行验证;Verify the signature based on the node public key of the requesting node, and verify the workload proof task based on the execution result;
    在所述签名验签成功且所述工作量证明任务验证通过的情况下,与所述请求节点建立连接。When the signature verification is successful and the proof-of-work task verification passes, a connection is established with the requesting node.
  2. 根据权利要求1所述的方法,所述工作量证明请求还包括用于生成所述工作量证明任务的证明难度值;所述基于所述执行结果对所述工作量证明任务进行验证,包括:The method according to claim 1, wherein the proof-of-work request further includes a proof difficulty value used to generate the proof-of-work task; and verifying the proof-of-work task based on the execution results includes:
    基于所述执行结果与所述随机数生成待检验字符串,将所述待检验字符串通过哈希运算以得到对应的哈希结果;Generate a string to be tested based on the execution result and the random number, and perform a hash operation on the string to be tested to obtain the corresponding hash result;
    在所述哈希结果满足所述证明难度值对应的工作量证明要求的情况下,确定所述工作量证明任务验证通过,否则确定所述工作量证明任务验证不通过。In the case where the hash result meets the proof-of-work requirements corresponding to the proof difficulty value, it is determined that the proof-of-work task has passed the verification, otherwise it is determined that the proof-of-work task has failed the verification.
  3. 根据权利要求2所述的方法,所述基于所述执行结果与所述随机数生成待检验字符串,包括:The method according to claim 2, generating a string to be tested based on the execution result and the random number includes:
    将所述执行结果、所述随机数与所述请求节点的节点公钥按照预设顺序进行组合以生成所述待检验字符串。The execution result, the random number and the node public key of the requesting node are combined in a preset order to generate the string to be verified.
  4. 根据权利要求2所述的方法,还包括:The method of claim 2, further comprising:
    根据距当前时刻之前的第一预设时长内工作量证明验证失败的次数调整所述证明难度值,所述证明难度值正相关于所述次数,所述次数为距所述当前时刻之前的第一预设时长内任一签名验签失败的次数与任一工作量证明任务验证不通过的次数之和。The proof difficulty value is adjusted according to the number of failed proof-of-work verifications within the first preset time period before the current moment. The proof difficulty value is directly related to the number of times, and the number of times is the number of failed proof-of-work verifications within the first preset time period before the current moment. The sum of the number of times any signature verification fails and the number of times any proof-of-work task fails verification within a preset period of time.
  5. 根据权利要求4所述的方法,所述区块链网络部署的网络管理合约维护有所述证明难度值;所述根据距当前时刻之前的第一预设时长内工作量证明验证失败的次数调整所述证明难度值,包括:According to the method of claim 4, the network management contract deployed by the blockchain network maintains the proof difficulty value; the adjustment is based on the number of workload proof verification failures within the first preset time period before the current time. The proof difficulty value includes:
    向所述区块链网络部署的网络管理合约发起包含所述次数的证明难度值调整交易,以使所述网络管理合约基于所述次数调整维护于所述网络管理合约中的所述证明难度值。Initiate a proof difficulty value adjustment transaction including the number of times to the network management contract deployed on the blockchain network, so that the network management contract adjusts the proof difficulty value maintained in the network management contract based on the number of times. .
  6. 根据权利要求1所述的方法,所述基于所述执行结果对所述工作量证明任务进 行验证,包括:The method according to claim 1, the verification of the workload proof task based on the execution results includes:
    在所述签名验签成功的情况下基于所述执行结果对所述工作量证明任务进行验证。If the signature verification is successful, the workload proof task is verified based on the execution result.
  7. 根据权利要求1所述的方法,在所述请求节点不属于所述区块链网络的情况下,所述方法还包括:The method according to claim 1, when the requesting node does not belong to the blockchain network, the method further includes:
    在所述签名验签成功且所述工作量证明任务验证通过的情况下,将所述请求节点加入所述区块链网络。When the signature verification is successful and the proof-of-work task verification passes, the requesting node is added to the blockchain network.
  8. 根据权利要求7所述的方法,所述将所述请求节点加入所述区块链网络,包括:The method according to claim 7, adding the requesting node to the blockchain network includes:
    将所述请求节点的节点信息存储于所述接入节点维护的节点列表中,并将所述接入节点的节点信息发送至所述请求节点。The node information of the requesting node is stored in the node list maintained by the access node, and the node information of the access node is sent to the requesting node.
  9. 根据权利要求7所述的方法,所述将所述请求节点加入所述区块链网络,包括:The method according to claim 7, adding the requesting node to the blockchain network includes:
    向所述区块链网络中的网络管理合约发起包含所述请求节点的节点信息的节点加入交易,以使所述网络管理合约维护所述请求节点的节点信息。Initiate a node joining transaction containing the node information of the requesting node to the network management contract in the blockchain network, so that the network management contract maintains the node information of the requesting node.
  10. 根据权利要求8或9所述的方法,所述节点信息包括节点标识、节点公钥和/或网络地址。According to the method of claim 8 or 9, the node information includes node identification, node public key and/or network address.
  11. 根据权利要求10所述的方法,所述请求节点的节点标识由所述接入节点在所述签名验签成功且所述工作量证明任务验证通过的情况下生成,或者,所述请求节点的节点标识由所述请求节点生成。According to the method of claim 10, the node identification of the requesting node is generated by the access node when the signature verification is successful and the workload proof task verification passes, or the requesting node The node identification is generated by the requesting node.
  12. 根据权利要求10所述的方法,还包括:The method of claim 10, further comprising:
    在检测出所述请求节点的节点标识于所述区块链网络中全局不唯一的情况下,向所述请求节点发送节点标识提供请求或生成所述区块链网络中全局唯一的第一节点标识以重新确定为所述请求节点的节点标识,所述节点标识提供请求用于使所述请求节点重新向所述接入节点提供第二节点标识以重新确定为所述请求节点的节点标识。When it is detected that the node identification of the requesting node is not globally unique in the blockchain network, send a node identification provision request to the requesting node or generate a globally unique first node in the blockchain network The identification is to be redetermined as the node identification of the requesting node, and the node identification provision request is used to cause the requesting node to re-provide the second node identification to the access node to be redetermined as the node identification of the requesting node.
  13. 根据权利要求1所述的方法,还包括:The method of claim 1, further comprising:
    在距当前时刻之前的第二预设时长内接收到同一发起方发起的基于任一协议的历史消息的数量超出预设阈值的情况下,拒绝响应所述同一发起方发起的基于所述任一协议的消息,所述任一协议的消息至少包括连接协议中的连接请求。When the number of historical messages initiated by the same initiator based on any protocol received within the second preset time period before the current moment exceeds the preset threshold, refuse to respond to the historical messages initiated by the same initiator based on any protocol. Messages of any protocol include at least a connection request in the connection protocol.
  14. 一种防范网络攻击的装置,应用于区块链网络中的接入节点,包括:A device to prevent network attacks, applied to access nodes in the blockchain network, including:
    请求接收单元,用于接收请求节点发送的连接请求,将工作量证明请求发送至所述请求节点,所述工作量证明请求包括用于生成工作量证明任务的随机数;A request receiving unit, configured to receive a connection request sent by a requesting node, and send a proof-of-work request to the requesting node, where the proof-of-work request includes a random number used to generate a proof-of-work task;
    结果接收单元,用于接收所述请求节点响应于所述工作量证明请求执行所述工作量证明任务得到的执行结果以及针对所述执行结果生成的签名;A result receiving unit configured to receive the execution result obtained by the requesting node from executing the workload proof task in response to the workload proof request and the signature generated for the execution result;
    结果验证单元,用于基于所述请求节点的节点公钥对所述签名进行验签,并基于所述执行结果对所述工作量证明任务进行验证;A result verification unit, configured to verify the signature based on the node public key of the requesting node, and verify the workload proof task based on the execution result;
    连接建立单元,用于在所述签名验签成功且所述工作量证明任务验证通过的情况下,与所述请求节点建立连接。A connection establishment unit, configured to establish a connection with the requesting node when the signature verification is successful and the proof-of-work task verification passes.
  15. 一种电子设备,包括:An electronic device including:
    处理器;processor;
    用于存储处理器可执行指令的存储器;Memory used to store instructions executable by the processor;
    其中,所述处理器通过运行所述可执行指令以实现如权利要求1-13中任一项所述的方法。Wherein, the processor implements the method according to any one of claims 1-13 by running the executable instructions.
  16. 一种计算机可读存储介质,其上存储有计算机指令,该指令被处理器执行时实现如权利要求1-13中任一项所述方法的步骤。A computer-readable storage medium having computer instructions stored thereon, which when executed by a processor, implements the steps of the method according to any one of claims 1-13.
PCT/CN2022/135118 2022-07-29 2022-11-29 Network attack prevention method and device WO2024021406A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210910784.6 2022-07-29
CN202210910784.6A CN115277022A (en) 2022-07-29 2022-07-29 Method and device for preventing network attack

Publications (1)

Publication Number Publication Date
WO2024021406A1 true WO2024021406A1 (en) 2024-02-01

Family

ID=83746792

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/135118 WO2024021406A1 (en) 2022-07-29 2022-11-29 Network attack prevention method and device

Country Status (2)

Country Link
CN (1) CN115277022A (en)
WO (1) WO2024021406A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115277022A (en) * 2022-07-29 2022-11-01 蚂蚁区块链科技(上海)有限公司 Method and device for preventing network attack

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108667618A (en) * 2018-05-10 2018-10-16 阿里巴巴集团控股有限公司 Data processing method, device, server and the system of block chain member management
CN109087111A (en) * 2018-08-31 2018-12-25 深圳付贝科技有限公司 Common recognition verification method, digging mine machine and block catenary system based on block chain
US20190245697A1 (en) * 2018-02-05 2019-08-08 Nokia Technologies Oy Securing blockchain access through a gateway
CN112866242A (en) * 2021-01-15 2021-05-28 迅鳐成都科技有限公司 Block chain-based digital identity authentication method, equipment and storage medium
CN114692185A (en) * 2022-03-31 2022-07-01 蚂蚁区块链科技(上海)有限公司 Data processing method and device
CN115277022A (en) * 2022-07-29 2022-11-01 蚂蚁区块链科技(上海)有限公司 Method and device for preventing network attack

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190245697A1 (en) * 2018-02-05 2019-08-08 Nokia Technologies Oy Securing blockchain access through a gateway
CN108667618A (en) * 2018-05-10 2018-10-16 阿里巴巴集团控股有限公司 Data processing method, device, server and the system of block chain member management
CN109087111A (en) * 2018-08-31 2018-12-25 深圳付贝科技有限公司 Common recognition verification method, digging mine machine and block catenary system based on block chain
CN112866242A (en) * 2021-01-15 2021-05-28 迅鳐成都科技有限公司 Block chain-based digital identity authentication method, equipment and storage medium
CN114692185A (en) * 2022-03-31 2022-07-01 蚂蚁区块链科技(上海)有限公司 Data processing method and device
CN115277022A (en) * 2022-07-29 2022-11-01 蚂蚁区块链科技(上海)有限公司 Method and device for preventing network attack

Also Published As

Publication number Publication date
CN115277022A (en) 2022-11-01

Similar Documents

Publication Publication Date Title
WO2020258912A1 (en) Blockchain consensus method, device and system
EP2815551B1 (en) Peer to peer networking and sharing systems and methods
US11444783B2 (en) Methods and apparatuses for processing transactions based on blockchain integrated station
US11424942B2 (en) Blockchain integrated stations and automatic node adding methods and apparatuses
US10341118B2 (en) SSL gateway with integrated hardware security module
US11451404B2 (en) Blockchain integrated stations and automatic node adding methods and apparatuses
CN107483383B (en) Data processing method, terminal, background server and storage medium
US11336660B2 (en) Methods and apparatuses for identifying replay transaction based on blockchain integrated station
US10608996B2 (en) Trust status of a communication session
US11783339B2 (en) Methods and apparatuses for transferring transaction based on blockchain integrated station
US11665234B2 (en) Methods and apparatuses for synchronizing data based on blockchain integrated station
EP3940575A1 (en) Methods and apparatuses for identifying to-be-filtered transaction based on dedicated blockchain node device
US11323529B2 (en) TCP fast open hardware support in proxy devices
EP3092749A1 (en) Method and apparatus of identifying proxy ip address
WO2024021406A1 (en) Network attack prevention method and device
WO2024021414A1 (en) Data transmission
WO2024001022A1 (en) Cross-subnet calling
WO2024021410A1 (en) Method and apparatus for preventing network attacks
US11212083B2 (en) Slave secure sockets layer proxy system
CN106936608B (en) Method, related equipment and system for establishing SSH connection
CN116633562A (en) Network zero trust security interaction method and system based on WireGuard
US20180063255A1 (en) Method and Apparatus for Terminal Application Accessing NAS
US20120051261A1 (en) Determination of bypass zones from network configuration settings
WO2016201973A1 (en) Disaster tolerance method and apparatus, and communication system
Lawrence ROS2 prevalance and security

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22952840

Country of ref document: EP

Kind code of ref document: A1