A blockchain security verification protection method, blockchain node, medium and product
By calculating the reputation score of the request source address and using smart contracts to verify the legitimacy of the requested content, the problem that blockchain technology is difficult to identify and prevent threats based on address reputation is solved, and efficient security protection for the blockchain network is achieved, and overall security and stability are improved.
Patent Information
- Application Number
- CN202411889453.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2044-12-20
AI Technical Summary
Existing blockchain technologies are difficult to effectively identify and prevent potential threats based on address credibility, resulting in underreacting in the face of complex or changing security threats.
By obtaining network request data, calculate the reputation score of the request source address, and verify the legitimacy of the requested content through a smart contract and record the verification results to the blockchain network. If the requested content is legal, process the requested data; if it is illegal, reduce the reputation score and generate warning information, and enable the protection mode to avoid malicious attacks.
It improves the ability of blockchain network to identify and prevent security threats, improves the security and stability of blockchain networks, and can quickly turn on the protection mode when an attack begins to emerge, effectively preventing malicious infiltration.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of network security, and in particular to a blockchain security verification and protection method, blockchain node, medium and product. Background Art
[0002] With the rapid development of network technology, data exchange and information sharing have become increasingly frequent. Blockchain, as a distributed ledger technology, is widely used in a variety of scenarios due to its tamper-proof and decentralized characteristics. Blockchain technology ensures the security and transparency of transaction data through the cooperation of network nodes, thus providing users with a reliable digital transaction platform.
[0003] Currently, blockchain technology usually adopts some security measures to prevent malicious attacks and data tampering. For example, most blockchain systems use complex encryption technology to protect data from unauthorized access, and use consensus algorithms to ensure that all nodes in the network reach a consensus on transaction records. In addition, some blockchain systems also perform basic verification on requests from network nodes, such as checking the format and integrity of the request, to prevent invalid or malicious requests from causing interference.
[0004] However, in actual operations, criminals may initiate requests by forging or controlling multiple network nodes. Although these requests formally meet the verification requirements, they may actually be intended to carry out attacks or fraud. Since related technologies lack in-depth analysis of the request source, it is difficult to effectively identify and prevent potential threats based on address reputation, resulting in insufficient response when facing complex or changing security threats. Summary of the invention
[0005] The present application provides a blockchain security verification and protection method, blockchain node, medium and product for improving the ability to identify and prevent security threats.
[0006] In a first aspect, the present application provides a blockchain security verification and protection method, which is applied to a blockchain node, and the method includes: obtaining received network request data, the network request data including a request source address, a request target address, a request timestamp and a request content; determining a reputation score of the request source address based on the historical request behavior of the request source address; when the reputation score is higher than a preset score threshold, verifying the legality of the request content through a smart contract, obtaining a verification result, and recording the verification result to the blockchain network; if the verification result shows that the request content is legal, processing the network request data; if the verification result shows that the request content is illegal, reducing the reputation score of the request source address by a preset score; when the reputation score is lower than the preset score threshold, generating an early warning message and broadcasting it to the blockchain network; and starting a protection mode based on the early warning message, the protection mode is used to protect against malicious attacks.
[0007] By adopting the above technical solution, the blockchain node calculates the reputation score of the request source address based on the historical request behavior, achieving efficient risk prediction. Those with good reputation can enter the smart contract verification link, greatly improving the normal request processing rate, and malicious sources can be quickly identified and warned. The protection mode is turned on when the attack first appears, effectively preventing malicious infiltration, thereby improving the ability of the blockchain network to resist malicious attacks and enhancing the security of the blockchain network.
[0008] In combination with some embodiments of the first aspect, in some embodiments, the reputation score of the request source address is determined based on the historical request behavior of the request source address, specifically including: obtaining historical request records of the request source address within a preset time period; based on the historical request records, extracting behavioral characteristics of the request source address, the behavioral characteristics including request timestamp distribution, request content similarity, and interaction frequency with other IP addresses; inputting the behavioral characteristics into a reputation scoring model to obtain an initial reputation score; and according to the verification pass rate of the request source address, weightedly adjusting the initial reputation score to obtain the reputation score, the verification pass rate being used to indicate the proportion of network requests initiated by the request source address that pass the verification of the smart contract.
[0009] By adopting the above technical solution, the blockchain node first comprehensively analyzes the multi-dimensional behavioral characteristics of the request source address to calculate its initial reputation score, reducing the subjectivity and error of human judgment, and then makes a weighted adjustment to the initial reputation score based on the verification pass rate, further optimizing the accuracy of the reputation score. A high verification pass rate indicates that most of the requests from the request source address are legal and compliant, and its reputation score should be improved accordingly, otherwise it should be reduced. This dynamic adjustment mechanism enables the reputation score to reflect the true credibility of the request source address in real time, thereby more accurately screening out reliable request sources, effectively reducing the risk of malicious attacks on the blockchain network, and improving the overall security and stability of the blockchain network.
[0010] In combination with some embodiments of the first aspect, in some embodiments, when the reputation score is higher than a preset score threshold, the legality of the request content is verified through a smart contract to obtain a verification result, and the verification result is recorded in the blockchain network, specifically including: extracting the request type and execution parameters from the request content; calling the corresponding verification rules according to the request type; detecting through the verification rules whether the execution parameters meet the preset requirements, the preset requirements including that the format of the execution parameters conforms to the preset data structure, the value of the execution parameters is within the preset range, and the logical relationship between the execution parameters is reasonable; verifying whether the digital signature of the request content is valid; when the execution parameters meet the preset requirements and the digital signature is valid, determining that the request content is legal; when the execution parameters do not meet the preset requirements or the digital signature is invalid, determining that the request content is illegal.
[0011] By adopting the above technical solution, the blockchain node calls the corresponding verification rules to detect the execution parameters, which greatly improves the accuracy and professionalism of the verification. For example, checking whether the format of the execution parameters conforms to the preset data structure can effectively avoid system failures or security vulnerabilities caused by data format errors; checking whether the value of the execution parameters is within the preset range can prevent illegal operations caused by abnormal data input and ensure that the blockchain network operates within a safe and controllable parameter range; checking whether the logical relationship between the execution parameters is reasonable further ensures the rationality and consistency of the network request. At the same time, the blockchain node verifies the validity of the digital signature of the request content, which effectively guarantees the authenticity and non-repudiation of the request source and prevents data from being maliciously tampered with or forged identity to initiate a request. When the execution parameters meet the preset requirements and the digital signature is valid, the request content is determined to be legal, otherwise it is determined that the request content is illegal. It can not only quickly and accurately distinguish between legal and illegal requests, but also provide a reliable basis for subsequent credit score adjustments, thereby improving the security and reliability of the entire blockchain network.
[0012] In combination with some embodiments of the first aspect, in some embodiments, if the verification result shows that the request content is legal, the network request data is processed, specifically including: obtaining the current processing queue length and the current resource occupancy rate; determining a load assessment value based on the current processing queue length and the current resource occupancy rate; when the load assessment value exceeds a preset value, processing the network request data.
[0013] By adopting the above technical solution, the blockchain node monitors the current processing queue length and the current resource occupancy rate in real time, calculates the load assessment value based on these two key indicators, and processes network request data only when the load is reasonable, thereby effectively preventing resource exhaustion and avoiding performance degradation or service interruption caused by request processing overload, ensuring that the blockchain network maintains stable operation when facing a large number of legitimate requests.
[0014] In combination with some embodiments of the first aspect, in some embodiments, if the verification result shows that the request content is illegal, then after the step of reducing the reputation score of the request source address by a preset value, the method also includes: obtaining the processing result, processing time, and exception information during the processing, the exception information being used to indicate the error type, error code, error description, and exception stack information occurring during the processing; storing the processing result, the processing time, and the exception information in a processing log, and synchronizing the processing log to other blockchain nodes in the blockchain network.
[0015] By adopting the above technical solutions, blockchain nodes have established a complete processing log synchronization mechanism, which significantly improved traceability and fault diagnosis capabilities. It not only facilitates administrators to conduct fault analysis and performance optimization, but also provides reliable evidence support for tracing security incidents, thereby enhancing the security management capabilities of the blockchain network.
[0016] In combination with some embodiments of the first aspect, in some embodiments, after a protection mode is enabled based on the early warning information and the protection mode is used to protect against malicious attacks, the method further includes: counting the request frequency of the request source address within a preset first time period; when the request frequency exceeds a preset frequency threshold, adding the request source address to a blacklist, and performing a blocking operation on the network request of the request source address; after a preset second time period, deleting the request source address from the blacklist.
[0017] By adopting the above technical solution, the blockchain node counts the request frequency of each request source address within the preset first period. When the request frequency exceeds the preset frequency threshold, the request source address is added to the blacklist and its network request is blocked. The blacklist penalty is temporary and will be automatically lifted after the preset second period. This flexible control strategy can effectively curb malicious behavior without causing permanent impact on normal users.
[0018] In combination with some embodiments of the first aspect, in some embodiments, after a preset second time period, after the step of deleting the request source address from the blacklist, the method also includes: obtaining the cumulative duration of the request source address in the blacklist; if the cumulative duration exceeds a preset duration threshold, permanently rejecting all network requests from the request source address.
[0019] By adopting the above technical solution, the blockchain node records the cumulative time that each request source address has been in the blacklist. When the cumulative time exceeds the preset time threshold, all network requests from the request source address will be permanently rejected. This progressive punishment mechanism has a strong deterrent effect on addresses that frequently conduct malicious activities, and can fundamentally eliminate persistent threat sources. At the same time, it can also effectively reduce the management cost of the blockchain network, avoid repeatedly processing requests from the same malicious address, and improve operational efficiency.
[0020] In a second aspect, an embodiment of the present application provides a blockchain node, comprising: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to cause the blockchain node to execute the method described in the first aspect and any possible implementation manner of the first aspect.
[0021] In a third aspect, an embodiment of the present application provides a computer program product comprising instructions. When the above-mentioned computer program product is run on a blockchain node, the above-mentioned blockchain node executes the method described in the first aspect and any possible implementation method of the first aspect.
[0022] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, comprising instructions. When the instructions are executed on a blockchain node, the blockchain node executes the method described in the first aspect and any possible implementation method of the first aspect.
[0023] It can be understood that the blockchain node provided in the second aspect, the computer program product provided in the third aspect, and the computer storage medium provided in the fourth aspect are all used to execute the method provided in the embodiment of the present application. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method, which will not be repeated here.
[0024] One or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages:
[0025] 1. By adopting the above technical solution, the blockchain node calculates the reputation score of the request source address based on the historical request behavior of the request source address, realizing efficient risk prediction. Those with good reputation can enter the smart contract verification link, greatly improving the normal request processing rate, and malicious sources can be quickly identified and warned. When the attack first appears, the protection mode is turned on to effectively prevent malicious infiltration, thereby improving the ability of the blockchain network to resist malicious attacks and improving the security of the blockchain network.
[0026] 2. By adopting the above technical solution, the blockchain node first comprehensively analyzes the multi-dimensional behavioral characteristics of the request source address to calculate its initial reputation score, reducing the subjectivity and error of human judgment, and then makes a weighted adjustment to the initial reputation score based on the verification pass rate, further optimizing the accuracy of the reputation score. A high verification pass rate indicates that most of the requests from the request source address are legal and compliant, and its reputation score should be improved accordingly, otherwise it should be reduced. This dynamic adjustment mechanism enables the reputation score to reflect the true credibility of the request source address in real time, thereby more accurately screening out reliable request sources, effectively reducing the risk of malicious attacks on the blockchain network, and improving the overall security and stability of the blockchain network.
[0027] 3. By adopting the above technical solution, the blockchain node calls the corresponding verification rules to detect the execution parameters, which greatly improves the accuracy and professionalism of the verification. For example, checking whether the format of the execution parameters conforms to the preset data structure can effectively avoid system failures or security vulnerabilities caused by data format errors; checking whether the value of the execution parameters is within the preset range can prevent illegal operations caused by abnormal data input and ensure that the blockchain network operates within a safe and controllable parameter range; checking whether the logical relationship between the execution parameters is reasonable further ensures the rationality and consistency of the network request. At the same time, the blockchain node verifies the validity of the digital signature of the request content, which effectively guarantees the authenticity and non-repudiation of the request source and prevents data from being maliciously tampered with or forged identity to initiate a request. When the execution parameters meet the preset requirements and the digital signature is valid, the request content is determined to be legal, otherwise it is determined that the request content is illegal. It can not only quickly and accurately distinguish between legal and illegal requests, but also provide a reliable basis for subsequent credit score adjustments, thereby improving the security and reliability of the entire blockchain network. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 This is a flowchart of a blockchain security verification and protection method in an embodiment of the present application;
[0029] Figure 2 This is another flowchart of the blockchain security verification and protection method in the embodiment of the present application;
[0030] Figure 3 It is a schematic diagram of the structure of a physical device of a blockchain node in an embodiment of the present application. DETAILED DESCRIPTION
[0031] The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to be used as limitations to the present application. As used in the specification of the present application, the singular expressions "one", "a kind of", "above", "the" and "this" are intended to also include plural expressions, unless there is a clear indication to the contrary in the context. It should also be understood that the term "and / or" used in the present application refers to any or all possible combinations comprising one or more of the listed items.
[0032] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, unless otherwise specified, "plurality" means two or more.
[0033] The following is a description of the process of the method provided by this implementation. Figure 1 , which is a flow chart of the blockchain security verification and protection method in an embodiment of the present application.
[0034] S101, obtaining received network request data, where the network request data includes a request source address, a request target address, a request timestamp, and a request content;
[0035] Among them, network request data refers to the data packets transmitted when blockchain nodes communicate and interact in the blockchain network; the request source address refers to the network address identifier of the node that initiates the network request, which can be an IP address or other form of network identifier; the request target address refers to the network address identifier used to represent the node receiving the network request; the request timestamp refers to the specific time point when the network request is initiated, usually expressed in the form of a UNIX timestamp in milliseconds; the request content refers to the specific business data carried in the network request, which may include transaction information, smart contract call parameters, etc.
[0036] Specifically, when the network interface detects the arrival of a new data packet, the blockchain node will obtain the complete data packet content from the network layer, parse the request header information such as the request source address, request target address, request timestamp, etc., and extract the business data content in the request body information, that is, the request content. All these data will be assembled into a standard format of network request data for subsequent processing.
[0037] S102, determining a reputation score of the request source address based on the historical request behavior of the request source address;
[0038] Among them, historical request behavior refers to the set of behavioral characteristics of all network requests initiated by a specific request source address in the past period of time; the reputation score refers to the quantitative evaluation value of the credibility of the request source address; the behavioral characteristics are used to represent the activity pattern of the request source address, including request frequency, time distribution, content characteristics, etc.
[0039] Specifically, first, the blockchain node retrieves all historical request records of the request source address within a preset time window (such as the last 24 hours) from the local storage or blockchain network. Then, the blockchain node analyzes these historical request records and extracts the behavioral characteristics of the request source address, including the distribution pattern of request time, the similarity of request content, and the interaction mode with other addresses. These behavioral characteristics will be input into the reputation scoring model to obtain an initial reputation score. The reputation scoring model can be a model obtained by machine learning training or a mathematical formula algorithm, which is not limited here. Afterwards, the blockchain node will also make a weighted adjustment based on the verification pass rate of the request source address, and finally obtain a reputation score that reflects the true credibility of the request source address.
[0040] The following is an example of the reputation score calculation process for the address "0xabc123...":
[0041] Historical data collection (taking 24 hours as an example): This address initiated 100 requests in the past 24 hours; the request time distribution is an average of 5 times per hour from 8 am to 10 pm, and there are almost no requests in the early morning; the peak period (2 pm-4 pm) is 8 times per hour; request verification status: 85 times passed the verification, 10 times were rejected due to parameter errors, and 5 times failed due to timeout, characteristic analysis results.
[0042] (a) Time characteristic analysis:
[0043] Request frequency: normal (4.17 requests per hour on average); time distribution: in line with normal business hours; volatility: stable, no sudden large number of requests.
[0044] (b) Behavioral characteristics analysis:
[0045] Request type distribution: query operations: 60 times; transfer operations: 30 times; contract calls: 10 times; request content similarity: 85% (mostly standard business requests); abnormal request ratio: 5% (within the normal range).
[0046] (c) Interaction features:
[0047] Number of interaction addresses: 15 different addresses; interaction frequency: relatively uniform; interaction mode: in line with normal business mode.
[0048] Rating calculation process
[0049] Time dimension score (weight 30%):
[0050] Request frequency score: 90 points (stable and moderate); time distribution score: 95 points (in line with normal rules); volatility score: 85 points (fluctuation within an acceptable range)
[0051] Weighted average: 90 points
[0052] Behavioral dimension score (weight 40%):
[0053] Request type diversity: 85 points; content standardization: 90 points; abnormality ratio: 95 points
[0054] Weighted average: 90 points
[0055] Verification dimension score (weight 30%):
[0056] Verification pass rate: 85%
[0057] Error type analysis: -5 points (many parameter errors)
[0058] Final verification score: 80 points
[0059] Final score calculation:
[0060] Final credit score = 90 × 30% + 90 × 40% + 80 × 30% = 87 points
[0061] Optionally, in general, determining the reputation score of the request source address based on the historical request behavior of the request source address can be achieved in the following manner, which is not limited here: obtaining the historical request records of the request source address within a preset time period; based on the historical request records, extracting the behavioral characteristics of the request source address, the behavioral characteristics include request timestamp distribution, request content similarity, and interaction frequency with other IP addresses; inputting the behavioral characteristics into the reputation scoring model to obtain an initial reputation score; and according to the verification pass rate of the request source address, weighted adjustment is made to the initial reputation score to obtain the reputation score, and the verification pass rate is used to indicate the proportion of network requests initiated by the request source address that pass the verification of the smart contract.
[0062] S103: When the reputation score is higher than a preset score threshold, the legitimacy of the request content is verified through a smart contract to obtain a verification result, and the verification result is recorded in the blockchain network;
[0063] Among them, the preset scoring threshold is the pre-set minimum requirement for the reputation score; the smart contract refers to the program code deployed on the blockchain network for automated execution; the legality verification refers to the compliance check of the format, parameters, signature and other aspects of the request content; the verification result refers to the output of the legality verification, which usually includes the identification of verification pass or verification fail and the relevant reasons.
[0064] Specifically, first, the blockchain node compares the calculated reputation score with the preset score threshold. Only when the reputation score exceeds the preset score threshold will the smart contract be started for verification. During the verification process, the smart contract first parses the request content, extracts the request type and related parameters, and then calls the corresponding verification rule set according to the request type, and checks in turn whether the format of the relevant parameters is standardized, whether the value is within a reasonable range, and whether the logical relationship between the parameters is reasonable. At the same time, the smart contract will also verify the digital signature of the request content. After the verification is completed, the smart contract will generate a verification report containing information such as the verification result, verification time, and verification rule version, and record it in the blockchain network to ensure that the verification result cannot be tampered with and can be queried and verified by other blockchain nodes.
[0065] Optionally, under normal circumstances, when the reputation score is higher than a preset score threshold, the legality of the request content is verified through a smart contract to obtain a verification result, and the verification result is recorded in the blockchain network. This can be achieved in the following ways, which are not limited here: extracting the request type and execution parameters from the request content; calling the corresponding verification rules according to the request type; detecting through the verification rules whether the execution parameters meet preset requirements, and the preset requirements include that the format of the execution parameters conforms to the preset data structure, the value of the execution parameters is within the preset range, and the logical relationship between the execution parameters is reasonable; verifying whether the digital signature of the request content is valid; when the execution parameters meet the preset requirements and the digital signature is valid, determining that the request content is legal; when the execution parameters do not meet the preset requirements or the digital signature is invalid, determining that the request content is illegal.
[0066] S104. If the verification result shows that the request content is legal, process the network request data;
[0067] Among them, the verification result refers to the output of the smart contract after verifying the legality of the request content; legal means that the request content has passed the verification of the smart contract; processing the network request data refers to performing actual business operations on the request content.
[0068] Specifically, first, the blockchain node will check the current load status, including obtaining the number of pending requests in the processing queue and the resource (CPU, memory, bandwidth, etc.) usage, and calculate the current load assessment value based on this. If the load assessment value is within the acceptable range, the blockchain node will add the network request to the processing queue and call the corresponding processing module according to the request type for business processing, such as executing transactions, updating status, etc.
[0069] Optionally, under normal circumstances, if the verification result shows that the request content is legal, the processing of the network request data can be achieved in the following ways, which are not limited here: obtaining the current processing queue length and the current resource occupancy rate; determining the load assessment value based on the current processing queue length and the current resource occupancy rate; when the load assessment value exceeds a preset value, processing the network request data.
[0070] The current processing queue length refers to the number of requests currently waiting to be processed; the current resource occupancy rate refers to the current usage of resources such as CPU and memory; the load assessment value is used to indicate the current processing capacity status.
[0071] S105. If the verification result shows that the request content is illegal, the reputation score of the request source address is reduced by a preset score;
[0072] Among them, illegal means that the request content has not passed the verification of the smart contract; the preset score refers to the pre-set credit score deduction value.
[0073] Specifically, first, the blockchain node records the specific reasons for the verification failure, including which verification rules were violated, the specific circumstances of parameter abnormalities, etc. Then, the blockchain node obtains the pre-set credit score deduction value, and different levels of deduction standards may be applied according to the severity of the verification failure. Then, the blockchain node updates the credit score of the request source address, reduces it by the corresponding value, and synchronizes the credit score change record to the blockchain network.
[0074] S106. When the reputation score is lower than the preset score threshold, generate warning information and broadcast it to the blockchain network;
[0075] Among them, warning information refers to the warning data generated when a blockchain node detects a potential security threat; broadcasting refers to sending the warning information to all nodes in the blockchain network.
[0076] Specifically, the blockchain node will generate an early warning message, which includes the address information that triggered the early warning, the current reputation score, the early warning time, the behavior record that caused the reputation to be reduced, and other details. The blockchain node can also determine the early warning level based on the gap between the reputation score and the preset score threshold, and give corresponding risk assessment and disposal suggestions. Disposal suggestions refer to the recommended response measures for such threats. This early warning information will be broadcast to all other nodes through the P2P communication mechanism of the blockchain network to ensure that the entire network can perceive potential security threats in a timely manner.
[0077] S107. Enable a protection mode according to the warning information, where the protection mode is used to prevent malicious attacks.
[0078] Among them, protection mode refers to the combination of a series of security defense measures taken by blockchain nodes; malicious attack refers to illegal behavior attempting to destroy or invade.
[0079] Specifically, the blockchain node analyzes the threat level in the warning information and initiates corresponding protection strategies according to different threat levels: for low-level threats, it mainly adopts request frequency restrictions and content depth inspection; for medium-level threats, it adds request source address verification and resource usage quota control; for high-level threats, it directly rejects all requests from suspicious addresses. In protection mode, the blockchain node will monitor network traffic characteristics in real time, including request frequency, request mode, resource consumption and other indicators, and take corresponding protection measures immediately once an abnormality is found.
[0080] By adopting the above technical solution, the blockchain node calculates the reputation score of the request source address based on the historical request behavior, achieving efficient risk prediction. Those with good reputation can enter the smart contract verification link, greatly improving the normal request processing rate, and malicious sources can be quickly identified and warned. The protection mode is turned on when the attack first appears, effectively preventing malicious infiltration, thereby improving the ability of the blockchain network to resist malicious attacks and enhancing the security of the blockchain network.
[0081] The following is a more detailed description of the process of the method provided by this implementation. Figure 2 , which is another flow chart of the blockchain security verification and protection method in the embodiment of the present application.
[0082] S201, obtaining received network request data, where the network request data includes a request source address, a request target address, a request timestamp, and a request content;
[0083] For details, please refer to step S101, which will not be described in detail here.
[0084] S202, determining a reputation score of the request source address based on the historical request behavior of the request source address;
[0085] For details, please refer to step S102, which will not be described in detail here.
[0086] S203: When the reputation score is higher than a preset score threshold, the legitimacy of the request content is verified through a smart contract to obtain a verification result, and the verification result is recorded in the blockchain network;
[0087] For details, please refer to step S103, which will not be described in detail here.
[0088] S204: If the verification result shows that the request content is legal, process the network request data;
[0089] For details, please refer to step S104, which will not be described in detail here.
[0090] S205. If the verification result shows that the request content is illegal, the reputation score of the request source address is reduced by a preset score;
[0091] For details, please refer to step S105, which will not be described in detail here.
[0092] S206, obtaining the processing result, processing time and exception information during the processing, where the exception information is used to indicate the error type, error code, error description and exception stack information that occurred during the processing;
[0093] Among them, the processing result refers to the output content obtained after processing the network request data, including the status identification of successful or failed processing and the relevant return data; the processing time refers to the time consumed from the start of request processing to the completion of processing, usually in milliseconds; the exception information refers to the detailed record of abnormal situations that occur during the processing process, which is used to indicate the problems encountered in the program operation; the error type refers to the classification of exceptions, such as network timeout, parameter error, insufficient permissions, etc.; the error code refers to a specific error number identified by a number or string; the error description refers to the text description of the error situation; the exception stack information refers to the call path and context information when the program exception occurs.
[0094] Specifically, first, the blockchain node collects the status code and return data of the processing result, and records the timestamps of the start and end of the processing to calculate the processing time. If an exception occurs during the processing, the blockchain node will capture the exception and extract the complete information of the exception, including the specific type of the exception (such as IllegalArgumentException, NullPointerException, etc.), error code, user-oriented error prompt information, and record the complete call chain information when the exception occurs.
[0095] S207, storing the processing result, the processing time and the exception information in a processing log, and synchronizing the processing log to other blockchain nodes in the blockchain network;
[0096] Among them, the processing log refers to a data set that records all relevant information in the processing process, including processing results, processing time, and exception information; synchronization refers to the process of copying and transmitting data to other blockchain nodes; other blockchain nodes refer to all participants in the blockchain network except the current blockchain node.
[0097] Specifically, the blockchain node will organize the processing results, processing time and exception information in a predefined processing log format and write them into the local processing log. In order to ensure the data consistency of the entire blockchain network, the blockchain node will broadcast the processing log to other blockchain nodes through the P2P network. After receiving the processing log, other blockchain nodes will store it locally and verify it. After the verification is passed, the processing log synchronization is completed.
[0098] S208. When the reputation score is lower than the preset score threshold, generate warning information and broadcast it to the blockchain network;
[0099] For details, please refer to step S106, which will not be described in detail here.
[0100] S209, starting a protection mode according to the warning information, where the protection mode is used to prevent malicious attacks;
[0101] For details, please refer to step S107, which will not be described in detail here.
[0102] S210, counting the request frequency of the request source address within a preset first time period;
[0103] Among them, the preset first time period refers to a predefined fixed statistical time window, which can be a time period of different granularity such as 1 minute, 5 minutes, 1 hour or 1 day, which is used to define the time range of request frequency statistics; request frequency refers to the number of times the request source address initiates a network request within a unit time, reflecting the activity level and behavioral characteristics of the request source address.
[0104] Specifically, the blockchain node will maintain an independent sliding time window for each request source address, and the size of the sliding time window is equal to the preset first time period. Within the sliding time window, the blockchain node records the arrival timestamp of each new network request in real time and stores it in the request queue. At the same time, the blockchain node will regularly clean up the expired historical records in the queue to ensure the real-time and accuracy of the statistical data. By dividing the total number of requests in the sliding time window by the length of the time window, the blockchain node can obtain the request frequency of the request source address in the preset first time period.
[0105] S211, when the request frequency exceeds a preset frequency threshold, adding the request source address to a blacklist, and performing a blocking operation on the network request of the request source address;
[0106] Among them, the preset frequency threshold refers to the pre-set upper limit of the maximum allowed request frequency, which is used to distinguish normal requests from potential attack behaviors, and can be dynamically adjusted according to processing capabilities and security requirements; the blacklist refers to a data structure that stores the source addresses of requests identified as suspicious or malicious, including fields such as address information, joining time, and trigger reason; the blocking operation refers to a protective measure that rejects or discards network requests from specific addresses through technical means, which can be implemented at the network layer or application layer; the network request refers to the data exchange and communication operations between blockchain nodes.
[0107] Specifically, the blockchain node continuously compares the request frequency of the request source address with the preset frequency threshold. When the request frequency exceeds the preset frequency threshold, the protection response mechanism is immediately activated. First, the blockchain node adds the request source address to the blacklist, and records detailed information including address identification, timestamp of entering the blacklist, current request frequency, trigger threshold, etc. At the same time, the blockchain node broadcasts the blacklist update information to other blockchain nodes through the P2P network to ensure that the entire network reaches a consistent protection status. Secondly, the blockchain node deploys blocking mechanisms at multiple levels: at the network layer, directly filter data packets from the request source address by configuring firewall rules or access control lists (ACLs); at the application layer, perform secondary checks on requests that bypass network layer protection, and immediately terminate the request processing process once it is confirmed that the request comes from a blacklist address.
[0108] S212, after a preset second period of time, deleting the request source address from the blacklist;
[0109] Among them, the preset second time period refers to the pre-defined blacklist penalty duration, which is used to limit the access rights of suspicious addresses. Different penalty durations can be set according to the triggering reasons; deletion from the blacklist refers to the operation of removing the request source address from the blacklist database, including clearing related records and lifting access restrictions.
[0110] Specifically, the blockchain node will start an independent timer for each blacklisted address to record its stay in the blacklist. When the timer reaches the preset second period, the release process is automatically triggered.
[0111] S213, obtaining the cumulative length of time that the request source address is in the blacklist;
[0112] The cumulative duration refers to the total duration of the request source address being blacklisted multiple times in history, reflecting the long-term credit status of the request source address.
[0113] Specifically, the blockchain node records all blacklist records for each address. When the request source address is deleted from the blacklist, the blockchain node calculates the actual length of time the request source address has been in the blacklist, and then queries the historical blacklist records of the request source address. For each historical blacklist record, the blockchain node extracts the timestamps of its entry and exit from the blacklist, calculates the single penalty duration, and accumulates all single penalty durations to obtain the cumulative length of time the request source address has been in the blacklist.
[0114] S214: If the accumulated duration exceeds a preset duration threshold, all network requests from the request source address are permanently rejected.
[0115] Among them, the preset time threshold refers to the maximum allowed cumulative blacklist time. Exceeding this preset time threshold will trigger a permanent penalty. The setting of the preset time threshold needs to consider security requirements and the behavioral characteristics of normal users; permanent rejection refers to an irrevocable access restriction measure that will completely cut off the connection between the malicious address and the blockchain network.
[0116] Specifically, if the cumulative duration exceeds the preset duration threshold, it means that the request source address has a long-term and continuous malicious behavior pattern. At this time, the blockchain node will start the permanent protection process: first, add the request source address to the permanent blacklist database, which is managed separately from the blacklist, and set a special mark to prevent accidental deletion. Secondly, configure permanent access control rules at the network layer to ensure that any network request from the request source address will be directly rejected. At the same time, the blockchain node will broadcast the permanent ban decision to other blockchain nodes through the blockchain network, requiring all blockchain nodes to synchronously execute protection measures.
[0117] The following describes the blockchain nodes in the embodiment of the present invention from the perspective of hardware processing. Figure 3 , which is a schematic diagram of a physical device structure of a blockchain node in an embodiment of the present application.
[0118] It should be noted that Figure 3 The structure of the blockchain node shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0119] like Figure 3As shown, the blockchain node includes a central processing unit (CPU) 301, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 302 or the program loaded from the storage part 308 to the random access memory (RAM) 303, such as executing the method described in the above embodiment. In RAM 303, various programs and data required for system operation are also stored. CPU 301, ROM 302 and RAM 303 are connected to each other through bus 304. Input / output (I / O) interface 305 is also connected to bus 304.
[0120] The following components are connected to the I / O interface 305: an input section 306 including an audio input device, a button switch, etc.; an output section 307 including a liquid crystal display (LCD) and an audio output device, an indicator light, etc.; a storage section 308 including a hard disk, etc.; and a communication section 309 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 309 performs communication processing via a network such as the Internet. A drive 310 is also connected to the I / O interface 305 as needed. A removable medium 311, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 310 as needed so that a computer program read therefrom is installed into the storage section 308 as needed.
[0121] In particular, according to an embodiment of the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present invention includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication part 309, and / or installed from a removable medium 311. When the computer program is executed by the central processing unit (CPU) 301, various functions defined in the present invention are performed.
[0122] It should be noted that specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, apparatus, or device.
[0123] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present invention. Each box in the flowchart or block diagram may represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions marked in the box may also occur in an order different from that marked in the accompanying drawings.
[0124] Specifically, the blockchain node of this embodiment includes a processor and a memory. A computer program is stored in the memory. When the computer program is executed by the processor, the blockchain security verification and protection method provided in the above embodiment is implemented.
[0125] As another aspect, the present invention further provides a computer-readable storage medium, which may be included in the blockchain node described in the above embodiment; or may exist independently without being assembled into the blockchain node. The above storage medium carries one or more computer programs, and when the above one or more computer programs are executed by a processor of the blockchain node, the blockchain node implements the blockchain security verification protection method provided in the above embodiment.
[0126] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
[0127] As used in the above embodiments, the term "when..." may be interpreted to mean "if..." or "after..." or "in response to determining..." or "in response to detecting...", depending on the context. Similarly, the phrases "upon determining..." or "if (the stated condition or event) is detected" may be interpreted to mean "if determining..." or "in response to determining..." or "upon detecting (the stated condition or event)" or "in response to detecting (the stated condition or event)", depending on the context.
[0128] Those skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media. When the programs are executed, they can include the processes of the above-mentioned method embodiments. The aforementioned storage media include: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.
Claims
1. A blockchain security verification and protection method, characterized in that: Applied to a blockchain node, the method comprises: Obtaining received network request data, wherein the network request data includes a request source address, a request target address, a request timestamp, and a request content; Obtain historical request records of the request source address within a preset time period; Based on the historical request records, extracting behavioral characteristics of the request source address, the behavioral characteristics including request timestamp distribution, request content similarity, and interaction frequency with other IP addresses; Inputting the behavior characteristics into a reputation scoring model to obtain an initial reputation score; The initial reputation score is weightedly adjusted according to the verification pass rate of the request source address to obtain the reputation score, wherein the verification pass rate is used to indicate the proportion of network requests initiated by the request source address that pass smart contract verification; When the reputation score is higher than a preset score threshold, the legality of the request content is verified through a smart contract to obtain a verification result, and the verification result is recorded in the blockchain network; If the verification result shows that the request content is legal, processing the network request data; If the verification result shows that the request content is illegal, the reputation score of the request source address is reduced by a preset score; When the reputation score is lower than the preset score threshold, generating warning information and broadcasting it to the blockchain network; A protection mode is enabled according to the warning information, wherein the protection mode is used to prevent malicious attacks.
2. The method according to claim 1, characterized in that When the reputation score is higher than the preset score threshold, the legitimacy of the request content is verified through a smart contract to obtain a verification result, and the verification result is recorded in the blockchain network, specifically including: Extracting request type and execution parameters from the request content; According to the request type, calling the corresponding validation rule; Detecting whether the execution parameters meet preset requirements through the verification rules, wherein the preset requirements include that the format of the execution parameters conforms to a preset data structure, the values of the execution parameters are within a preset range, and the logical relationship between the execution parameters is reasonable; Verify whether the digital signature of the request content is valid; When the execution parameters meet the preset requirements and the digital signature is valid, determining that the request content is legal; When the execution parameter does not meet the preset requirement or the digital signature is invalid, it is determined that the request content is illegal.
3. The method according to claim 1, characterized in that If the verification result shows that the request content is legal, processing the network request data specifically includes: Get the current processing queue length and current resource occupancy rate; Determining a load evaluation value according to the current processing queue length and the current resource occupancy rate; When the load evaluation value exceeds a preset value, the network request data is processed.
4. The method according to claim 1, characterized in that After the step of reducing the reputation score of the request source address by a preset value if the verification result shows that the request content is illegal, the method further includes: Obtaining the processing result, processing time and exception information during the processing, wherein the exception information is used to indicate the error type, error code, error description and exception stack information that occurred during the processing; The processing result, the processing time and the exception information are stored in a processing log, and the processing log is synchronized to other blockchain nodes in the blockchain network.
5. The method according to claim 1, characterized in that After the step of starting a protection mode according to the early warning information, wherein the protection mode is used to prevent malicious attacks, the method further includes: Counting the request frequency of the request source address within a preset first time period; When the request frequency exceeds a preset frequency threshold, the request source address is added to a blacklist, and a blocking operation is performed on the network request of the request source address; After a preset second period of time, the request source address is deleted from the blacklist.
6. The method according to claim 5, characterized in that After the step of deleting the request source address from the blacklist after the preset second time period, the method further includes: Obtain the cumulative length of time the request source address has been in the blacklist; If the accumulated duration exceeds the preset duration threshold, all network requests from the request source address are permanently rejected.
7. A blockchain node, characterized in that: The blockchain node includes: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the blockchain node to execute the method as described in any one of claims 1-6.
8. A computer-readable storage medium comprising instructions, characterized in that: When the instruction is executed on a blockchain node, the blockchain node is caused to execute the method as described in any one of claims 1 to 6.
9. A computer program product, characterized in that When the computer program product runs on a blockchain node, the blockchain node is caused to execute the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Message transmission method and device based on distributed system, equipment, storage medium and product
CN118972357A
Blockchain transaction security using smart contracts
CN119048096A