Blockchain-based Transaction Protection Method, Device, Equipment and Storage Medium
By obtaining the hot spot status of each chain in the blockchain system and transferring user information of smart contracts, the problems of degradation in the computing performance and increase in error rates caused by the increase in transaction volume and business peak pressure in the blockchain system are solved, and the transaction stability protection is achieved.
Patent Information
- Application Number
- CN202210601393.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-30
- Publication Date
- 2025-05-27
- Estimated Expiration
- 2042-05-30
AI Technical Summary
Increased transaction volume and peak business pressure in blockchain systems lead to problems such as declining computing performance and increasing error rates.
By obtaining the hot spot status of each chain on the blockchain to be monitored, determine the chain and target chain to be transferred, lock the smart contracts that need to be transferred, and finally transfer its user information from the chain to be transferred to the target chain.
It reduces the total transaction volume and smart contract number that need to be transferred, reduces the pressure on transaction volume and data processing pressure, reduces the possibility of calculation errors and crashes, thereby protecting the transaction stability of the blockchain.
Smart Images

Figure CN115099963B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of blockchain technology, and in particular to a blockchain-based transaction protection method, device, equipment and storage medium. Background Art
[0002] At present, blockchain is widely used to maintain transaction stability and fairness, and the MPT structure of blockchain system is also widely used. However, in blockchain transactions, as the transaction volume of blockchain system increases and the usage time increases, the storage capacity of each node on each chain under the MPT data structure is gradually increasing, which leads to a larger amount of data storage and transmission in the execution process of each transaction. Over time, the computing performance of the blockchain system decreases. Furthermore, when the blockchain chain is at the peak of business, the error rate of transactions will also increase.
[0003] The above contents are only used to assist in understanding the technical solution of the present invention and do not constitute an admission that the above contents are prior art. Summary of the invention
[0004] The main purpose of the present invention is to provide a blockchain-based transaction protection, aiming to solve the technical problems of the existing blockchain technology, such as the excessive total transaction volume of the blockchain chain and the excessive pressure during business peak periods, which leads to the decrease in computing performance and increase in error rate of the blockchain system.
[0005] To achieve the above object, the present invention provides a transaction protection method based on blockchain, the method comprising the following steps:
[0006] Get the hotspot status of each chain on the blockchain to be monitored;
[0007] Determine the chain to be transferred and the target chain according to the hotspot status;
[0008] Determine the smart contract that needs to be transferred on the chain to be transferred;
[0009] The user information corresponding to the smart contract that needs to be transferred is transferred to the target chain to protect the transaction stability of the blockchain to be monitored.
[0010] Optionally, before obtaining the hotspot status of each chain on the blockchain to be monitored, the process further includes:
[0011] Collecting chain information of each chain on the blockchain to be monitored;
[0012] Determine the contract hotspot information of the smart contracts on each chain according to the chain information;
[0013] The hotspot status of each chain is determined according to the contract hotspot information.
[0014] Optionally, determining the hotspot status of each chain according to the contract hotspot information includes:
[0015] Determine the number of hot contracts on each chain based on the contract hot information;
[0016] Compare the number of hot contracts on each chain with the preset hot threshold to obtain a comparison result;
[0017] The hot spot state of each chain is determined according to the comparison result.
[0018] Optionally, determining the chain to be transferred and the target chain according to the hotspot state includes:
[0019] Determine the hotspot upper limit threshold and the hotspot lower limit threshold according to the preset hotspot threshold;
[0020] According to the hotspot status, the chain whose number of hotspot contracts is greater than the hotspot upper limit threshold is regarded as the chain to be transferred;
[0021] According to the hotspot status, the chain whose number of hotspot contracts is less than the hotspot lower limit threshold is taken as the target chain.
[0022] Optionally, the determining the smart contract that needs to be transferred on the chain to be transferred includes:
[0023] Obtain the smart contract information of the chain to be transferred;
[0024] Determine the transaction status of each of the smart contracts according to the smart contract information;
[0025] The smart contract whose transaction status is not in the hotspot state is regarded as a smart contract that needs to be transferred.
[0026] Optionally, the smart contract whose transaction status is not in a hotspot state is taken as a smart contract that needs to be transferred, including:
[0027] Determine the online usage of nodes of each smart contract according to the transaction status of the smart contract;
[0028] The node online usage of each smart contract is compared with the usage hotspot threshold, and the smart contract whose node online usage is less than the usage hotspot threshold is regarded as a smart contract that needs to be transferred.
[0029] Optionally, transferring the user information corresponding to the smart contract to be transferred to the target chain includes:
[0030] Obtaining user information of the smart contract that needs to be transferred;
[0031] Close the transaction status of the smart contract that needs to be transferred on the chain that needs to be transferred;
[0032] Transmit and transfer the user information of the smart contract that needs to be transferred to the target chain;
[0033] The transaction status of the smart contract that needs to be transferred is opened on the target chain to complete the transfer of the smart contract that needs to be transferred.
[0034] In addition, to achieve the above-mentioned purpose, the present invention also proposes a transaction protection device based on blockchain, and the transaction protection device based on blockchain includes:
[0035] The status acquisition module is used to obtain the hotspot status of each chain on the blockchain to be monitored;
[0036] A chain determination module, used to determine the chain to be transferred and the target chain according to the hotspot state;
[0037] A contract locking module, used to determine the smart contract that needs to be transferred on the chain to be transferred;
[0038] The contract transfer module is used to transfer the user information corresponding to the smart contract that needs to be transferred to the target chain to protect the transaction stability of the blockchain to be monitored.
[0039] In addition, to achieve the above-mentioned purpose, the present invention also proposes a blockchain-based transaction protection device, which includes: a memory, a processor, and a blockchain-based transaction protection program stored on the memory and executable on the processor, wherein the blockchain-based transaction protection program is configured to implement the steps of the blockchain-based transaction protection method as described above.
[0040] In addition, to achieve the above-mentioned purpose, the present invention also proposes a storage medium, on which a blockchain-based transaction protection program is stored. When the blockchain-based transaction protection program is executed by a processor, the steps of the blockchain-based transaction protection method described above are implemented.
[0041] The present invention obtains the hotspot status of each chain on the blockchain to be monitored; determines the chain to be transferred and the target chain according to the hotspot status; determines the smart contract to be transferred on the chain to be transferred; and transfers the user information corresponding to the smart contract to be transferred to the target chain to protect the transaction stability of the blockchain to be monitored. In this way, it is realized that the chain to be transferred and the target chain are determined according to the hotspot status of each chain on the blockchain to be monitored, and then the smart contract to be transferred is locked, and finally the user information of the smart contract to be transferred is transferred from the chain to be transferred to the target chain, so as to reduce the total transaction volume of the chain to be transferred and the number of smart contracts processed at the same time, thereby reducing the transaction volume pressure and data processing pressure of the chain to be transferred, reducing the possibility of crashes and calculation errors, and protecting the transaction stability of the entire blockchain to be monitored. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 It is a structural diagram of a blockchain-based transaction protection device in a hardware operating environment involved in an embodiment of the present invention;
[0043] Figure 2 This is a flowchart of the first embodiment of the transaction protection method based on blockchain of the present invention;
[0044] Figure 3 This is a flowchart of a second embodiment of a transaction protection method based on blockchain of the present invention;
[0045] Figure 4 This is a structural block diagram of the first embodiment of the blockchain-based transaction protection device of the present invention.
[0046] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0047] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0048] Reference Figure 1 , Figure 1 This is a schematic diagram of the structure of a blockchain-based transaction protection device in the hardware operating environment involved in the embodiment of the present invention.
[0049] like Figure 1As shown, the blockchain-based transaction protection device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (Wireless-Fidelity, Wi-Fi) interface). The memory 1005 may be a high-speed random access memory (Random Access Memory, RAM) memory, or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0050] Those skilled in the art will understand that Figure 1 The structure shown in does not constitute a limitation on the blockchain-based transaction protection device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0051] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and a transaction protection program based on blockchain.
[0052] exist Figure 1 In the blockchain-based transaction protection device shown, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the blockchain-based transaction protection device of the present invention can be set in the blockchain-based transaction protection device, and the blockchain-based transaction protection device calls the blockchain-based transaction protection program stored in the memory 1005 through the processor 1001, and executes the blockchain-based transaction protection method provided by the embodiment of the present invention.
[0053] The embodiment of the present invention provides a transaction protection method based on blockchain, referring to Figure 2 , Figure 2 This is a flow chart of a first embodiment of a transaction protection method based on blockchain of the present invention.
[0054] In this embodiment, the transaction protection method based on blockchain includes the following steps:
[0055] Step S10: Obtain the hotspot status of each chain on the blockchain to be monitored.
[0056] It should be noted that the executor of this embodiment is a controller or a processor, specifically a controller or a processor that controls the blockchain system, or other devices that can implement this function, and this embodiment is not limited to this.
[0057] It should be understood that the current transactions on the blockchain system are based on smart contracts, and then processed through the blockchain chain. In the MPT data structure, the data access of a storage node requires multiple disk read and write operations, and each change of each storage node will cause a storage node of the MPT data structure to split into multiple storage nodes. Therefore, as the blockchain system increases in use time, the amount of stored data in each storage node also slowly increases, further leading to increasing transaction pressure on each chain, especially during business peaks, the total transaction volume and transaction pressure of each chain are very large, which easily leads to a decrease in the computing performance of the blockchain system, and may also cause calculation errors. The solution of this embodiment determines the chain to be transferred and the target chain according to the hotspot status of each chain on the blockchain to be monitored, and then locks the smart contract to be transferred, and finally transfers the user information of the smart contract to be transferred from the chain to be transferred to the target chain, so as to reduce the total transaction volume of the chain to be transferred and the number of smart contracts processed simultaneously, thereby reducing the transaction volume pressure and data processing pressure of the chain to be transferred, reducing the possibility of crashes and calculation errors, and protecting the transaction stability of the entire blockchain to be monitored.
[0058] In a specific implementation, the blockchain to be monitored can be any blockchain system that uses the MPT data structure, and this embodiment does not limit this.
[0059] It should be noted that the chain refers to the chain composed of various storage nodes on the blockchain to be monitored. Each chain is used for transactions and calculations of smart contracts, as well as data storage. There can be any number of storage nodes on each chain, and each blockchain to be monitored can have any number of chains.
[0060] It should be understood that the hotspot status is judged based on the hotspot status of the smart contracts on each chain. When the number of hotspot contracts on the chain is greater than the preset hotspot threshold, the chain is in a hotspot state.
[0061] Step S20: Determine the chain to be transferred and the target chain according to the hotspot status.
[0062] In the specific implementation, the chain to be transferred refers to the chain on which the smart contract on the chain needs to be transferred, and the target chain refers to the chain that receives the transferred smart contract.
[0063] It should be noted that determining the chain to be transferred and the target chain based on the hotspot status means: comparing the number of hotspot contracts of each chain in the hotspot status with the preset hotspot threshold to determine the chain to be transferred and the target chain.
[0064] Step S30: Determine the smart contract that needs to be transferred on the chain to be transferred.
[0065] It should be understood that determining the smart contract that needs to be transferred on the chain to be transferred means: selecting a smart contract whose node online usage is less than the usage hotspot threshold from the contracts in the chain to be transferred as the smart contract that needs to be transferred.
[0066] Furthermore, in order to determine the smart contract that needs to be transferred, step S30 includes: obtaining the smart contract information of the chain to be transferred; determining the transaction status of each smart contract based on the smart contract information; and treating the smart contract whose transaction status is not in a hotspot state as the smart contract that needs to be transferred.
[0067] It should be noted that smart contract information refers to information such as the transaction status of each smart contract on the chain to be transferred.
[0068] It should be understood that determining the transaction status of each smart contract based on the smart contract information means: determining the node online usage of each storage node on each smart contract based on the smart contract information.
[0069] In a specific implementation, treating the smart contract whose transaction status is not in a hotspot status as a smart contract that needs to be transferred means: after determining the hotspot status of each smart contract, marking the smart contracts that are not in a hotspot status, and the marked smart contracts are treated as smart contracts that need to be transferred.
[0070] In this way, the smart contracts that need to be transferred on the transfer chain are determined based on the transaction status of the smart contracts, so that the transfer of smart contracts only transfers the smart contracts that are not in a hot state and have fewer online users, reducing the impact on user transactions.
[0071] Furthermore, in order to accurately determine the smart contract that needs to be transferred, the step of treating the smart contract whose transaction status is not in the hotspot state as the smart contract that needs to be transferred includes: determining the node online usage of each smart contract according to the transaction status of the smart contract; comparing the node online usage of each smart contract with the usage hotspot threshold, and treating the smart contract whose node online usage is less than the usage hotspot threshold as the smart contract that needs to be transferred.
[0072] It should be noted that the online node usage refers to the number of all accumulated users online using the storage nodes occupied by each smart contract.
[0073] It should be understood that treating the smart contract whose node online usage is less than the usage hotspot threshold as a smart contract that needs to be transferred means: comparing the node online usage of each smart contract with the usage hotspot threshold, marking the smart contract whose node online usage is less than the usage hotspot threshold as a smart contract that needs to be transferred. Specifically, the usage hotspot threshold can be any positive integer set by the user or administrator, and this embodiment does not limit this.
[0074] In this way, it is possible to accurately determine the smart contracts that need to be transferred, and only transfer the smart contracts whose node online usage is lower than the usage hotspot threshold, so that the number of users affected by the transferred smart contracts is minimized, while reducing the total transaction volume pressure of a single chain in the blockchain system.
[0075] Step S40: Transfer the user information corresponding to the smart contract that needs to be transferred to the target chain to protect the transaction stability of the blockchain to be monitored.
[0076] It should be noted that user information includes but is not limited to the transaction, identity, time and other related information of the user currently using the smart contract.
[0077] It should be understood that transferring the user information corresponding to the smart contract that needs to be transferred to the target chain means: first closing the transaction status of the smart contract that needs to be transferred, then transferring all the corresponding user information to the target chain, and then opening the transaction status, so that the user can continue to use the smart contract that needs to be transferred.
[0078] Furthermore, in order to be able to transfer the smart contract, step S40 includes: obtaining the user information of the smart contract that needs to be transferred; closing the transaction status of the smart contract that needs to be transferred on the chain that needs to be transferred; transmitting and transferring the user information of the smart contract that needs to be transferred to the target chain; and opening the transaction status of the smart contract that needs to be transferred on the target chain to complete the transfer of the smart contract that needs to be transferred.
[0079] In a specific implementation, user information includes but is not limited to the transaction, identity, time and other related information of the user currently using the smart contract.
[0080] It should be noted that closing the transaction status of the smart contract that needs to be transferred on the chain that needs to be transferred means: closing all user operations of the smart contract that needs to be transferred on the chain that needs to be transferred, and temporarily prohibiting users from trading.
[0081] It should be understood that transmitting and transferring the user information of the smart contract that needs to be transferred to the target chain means: transmitting the user information of the smart contract that needs to be transferred to the target chain for storage.
[0082] In a specific implementation, opening the transaction status of the smart contract that needs to be transferred on the target chain means that after the smart contract that needs to be transferred is transferred to the target chain, the transaction status of the smart contract that needs to be further transferred is reopened for user use.
[0083] In this way, the smart contracts that need to be transferred can be transferred safely and quickly, minimizing the impact on user usage and improving the user experience.
[0084] This embodiment obtains the hotspot status of each chain on the blockchain to be monitored; determines the chain to be transferred and the target chain according to the hotspot status; determines the smart contract to be transferred on the chain to be transferred; and transfers the user information corresponding to the smart contract to be transferred to the target chain to protect the transaction stability of the blockchain to be monitored. In this way, it is realized that the chain to be transferred and the target chain are determined according to the hotspot status of each chain on the blockchain to be monitored, and then the smart contract to be transferred is locked, and finally the user information of the smart contract to be transferred is transferred from the chain to be transferred to the target chain, so as to reduce the total transaction volume of the chain to be transferred and the number of smart contracts processed at the same time, thereby reducing the transaction volume pressure and data processing pressure of the chain to be transferred, reducing the possibility of crashes and calculation errors, and protecting the transaction stability of the entire blockchain to be monitored.
[0085] refer to Figure 3, Figure 3 This is a flow chart of a second embodiment of a transaction protection method based on blockchain of the present invention.
[0086] Based on the first embodiment described above, the blockchain-based transaction protection method of this embodiment further includes, before step S10:
[0087] Step S101: Collect the chain information of each chain on the blockchain to be monitored.
[0088] In the specific implementation, chain information refers to the storage node information, chain number, corresponding smart contract and other related information corresponding to each chain on the blockchain to be monitored.
[0089] Step S102: Determine the contract hotspot information of the smart contracts on each chain according to the chain information.
[0090] It should be noted that contract hotspot information refers to relevant information on whether the smart contracts on each chain are in a hotspot state.
[0091] Step S103: Determine the hotspot status of each chain according to the contract hotspot information.
[0092] It should be understood that determining the hotspot status of each chain based on the contract hotspot information means: determining the number of hotspot contracts in a hotspot state on each chain based on the hotspot contract information, and then comparing the number of hotspot contracts on each chain with the preset hotspot threshold to determine the hotspot status of each chain.
[0093] Furthermore, in order to determine the hotspot status of each chain, step S103 includes: determining the number of hotspot contracts on each chain based on the contract hotspot information; comparing the number of hotspot contracts on each chain with a preset hotspot threshold to obtain a comparison result; and determining the hotspot status of each chain based on the comparison result.
[0094] It should be noted that the number of hot contracts refers to the number of smart contracts in each chain that are in a hot state. Specifically, when the number of nodes being used on a smart contract is greater than the preset number of nodes, the smart contract is determined to be in a hot state, where the preset number of nodes is an arbitrary number set in advance, and this embodiment does not limit this.
[0095] It should be understood that the preset hotspot threshold refers to a threshold combination including a hotspot upper threshold and a hotspot lower threshold, wherein the hotspot upper threshold is greater than the hotspot lower threshold, and both the hotspot upper threshold and the hotspot lower threshold are positive integers.
[0096] In a specific implementation, determining the hotspot status of each chain according to the comparison result means: determining the hotspot status of each chain according to the relationship between the final number of each hotspot contract and the hotspot upper limit threshold and the hotspot lower limit threshold in the preset hotspot threshold. Specifically, if the number of hotspot contracts is greater than the hotspot upper limit threshold, the corresponding chain is in a hotspot state, and if the number of hotspot contracts is less than the hotspot lower limit threshold, the corresponding chain is not in a hotspot state.
[0097] In this way, the hotspot status of each chain can be judged based on the number of hotspot contracts, making the judgment of the hotspot status of each chain more accurate.
[0098] Furthermore, in order to accurately judge the chain to be transferred and the target chain, the steps of determining the chain to be transferred and the target chain according to the hotspot status include: determining the hotspot upper limit threshold and the hotspot lower limit threshold according to the preset hotspot threshold; according to the hotspot status, the chain in which the number of hotspot contracts is greater than the hotspot upper limit threshold is taken as the chain to be transferred; according to the hotspot status, the chain in which the number of hotspot contracts is less than the hotspot lower limit threshold is taken as the target chain.
[0099] It should be noted that the preset hotspot threshold includes two thresholds, namely, the hotspot upper threshold and the hotspot lower threshold. The hotspot upper threshold and the hotspot lower threshold are all any positive integer values preset by the user or administrator, and this embodiment does not limit this.
[0100] It should be understood that treating the chain in which the number of hotspot contracts is greater than the hotspot upper limit threshold as a chain that needs to be transferred according to the hotspot status means: when the number of hotspot contracts on the chain is greater than the hotspot upper limit threshold, the chain is treated as a chain that needs to be transferred, so there can be any number of chains that need to be transferred.
[0101] In a specific implementation, taking the chain whose number of hotspot contracts is less than the hotspot lower limit threshold as the target chain according to the hotspot status means: when the number of hotspot contracts on the chain is less than the hotspot lower limit threshold, the chain is taken as the target chain, so there can be any number of target chains.
[0102] In this way, the chain to be transferred and the target chain can be accurately and quickly determined, so that the smart contract can be transferred quickly, thereby reducing the computing pressure on the chain to be transferred.
[0103] This embodiment collects the chain information of each chain on the blockchain to be monitored; determines the contract hotspot information of the smart contract on each chain according to the chain information; and determines the hotspot status of each chain according to the contract hotspot information. In this way, the hotspot status of each chain is determined by determining the contract hotspot information of the smart contract on each chain, making the determination of the hotspot status of each chain more specific, and more intuitive and convenient.
[0104] In addition, an embodiment of the present invention further proposes a storage medium, on which a blockchain-based transaction protection program is stored. When the blockchain-based transaction protection program is executed by a processor, the steps of the blockchain-based transaction protection method described above are implemented.
[0105] Since the storage medium adopts all the technical solutions of all the above embodiments, it has at least all the beneficial effects brought by the technical solutions of the above embodiments, which will not be described one by one here.
[0106] Reference Figure 4 , Figure 4 This is a structural block diagram of the first embodiment of the blockchain-based transaction protection device of the present invention.
[0107] like Figure 4 As shown, the blockchain-based transaction protection device proposed in the embodiment of the present invention includes:
[0108] The status acquisition module 10 is used to obtain the hotspot status of each chain on the blockchain to be monitored.
[0109] The chain determination module 20 is used to determine the chain to be transferred and the target chain according to the hotspot state.
[0110] The contract locking module 30 is used to determine the smart contract that needs to be transferred on the transfer chain.
[0111] The contract transfer module 40 is used to transfer the user information corresponding to the smart contract that needs to be transferred to the target chain to protect the transaction stability of the blockchain to be monitored.
[0112] This embodiment obtains the hotspot status of each chain on the blockchain to be monitored; determines the chain to be transferred and the target chain according to the hotspot status; determines the smart contract to be transferred on the chain to be transferred; and transfers the user information corresponding to the smart contract to be transferred to the target chain to protect the transaction stability of the blockchain to be monitored. In this way, it is realized that the chain to be transferred and the target chain are determined according to the hotspot status of each chain on the blockchain to be monitored, and then the smart contract to be transferred is locked, and finally the user information of the smart contract to be transferred is transferred from the chain to be transferred to the target chain, so as to reduce the total transaction volume of the chain to be transferred and the number of smart contracts processed at the same time, thereby reducing the transaction volume pressure and data processing pressure of the chain to be transferred, reducing the possibility of crashes and calculation errors, and protecting the transaction stability of the entire blockchain to be monitored.
[0113] In one embodiment, the status acquisition module 10 is also used to collect chain information of each chain on the blockchain to be monitored; determine the contract hotspot information of the smart contract on each chain based on the chain information; and determine the hotspot status of each chain based on the contract hotspot information.
[0114] In one embodiment, the status acquisition module 10 is also used to determine the number of hot contracts on each chain based on the contract hotspot information; compare the number of hot contracts on each chain with a preset hotspot threshold to obtain a comparison result; and determine the hotspot status of each chain based on the comparison result.
[0115] In one embodiment, the chain determination module 20 is also used to determine the hotspot upper threshold and the hotspot lower threshold according to a preset hotspot threshold; according to the hotspot status, the chain whose number of hotspot contracts is greater than the hotspot upper threshold is used as the chain to be transferred; according to the hotspot status, the chain whose number of hotspot contracts is less than the hotspot lower threshold is used as the target chain.
[0116] In one embodiment, the contract locking module 30 is also used to obtain the smart contract information of the chain to be transferred; determine the transaction status of each smart contract based on the smart contract information; and treat the smart contract whose transaction status is not in a hot state as a smart contract that needs to be transferred.
[0117] In one embodiment, the contract locking module 30 is also used to determine the node online usage of each smart contract based on the transaction status of the smart contract; compare the node online usage of each smart contract with the usage hotspot threshold, and treat the smart contract whose node online usage is less than the usage hotspot threshold as a smart contract that needs to be transferred.
[0118] In one embodiment, the contract transfer module 40 is also used to obtain the user information of the smart contract that needs to be transferred; close the transaction status of the smart contract that needs to be transferred on the chain that needs to be transferred; transmit and transfer the user information of the smart contract that needs to be transferred to the target chain; and open the transaction status of the smart contract that needs to be transferred on the target chain to complete the transfer of the smart contract that needs to be transferred.
[0119] It should be understood that the above is only an example and does not constitute any limitation on the technical solution of the present invention. In specific applications, technicians in this field can make settings as needed, and the present invention does not limit this.
[0120] It should be noted that the workflow described above is merely illustrative and does not limit the scope of protection of the present invention. In practical applications, technicians in this field can select part or all of them according to actual needs to achieve the purpose of the present embodiment, and no limitation is made here.
[0121] In addition, for technical details not described in detail in this embodiment, please refer to the blockchain-based transaction protection method provided in any embodiment of the present invention, which will not be repeated here.
[0122] In addition, it should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0123] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0124] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as a read-only memory (ROM) / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0125] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A transaction protection method based on blockchain, characterized in that, the transaction protection method based on blockchain includes: Collecting chain information of each chain on the blockchain to be monitored; Determining contract hotspot information of smart contracts on each chain according to the chain information; Determining the hotspot status of each chain according to the contract hotspot information; Obtaining the hotspot status of each chain on the blockchain to be monitored; Determining the chain to be transferred and the target chain according to the hotspot status; Determining the smart contracts that need to be transferred on the chain to be transferred; Transferring the user information corresponding to the smart contracts that need to be transferred to the target chain to protect the transaction stability of the blockchain to be monitored, wherein the user information at least includes the transactions, identities, and times of the users currently using the corresponding smart contracts; wherein, the determining the hotspot status of each chain according to the contract hotspot information includes: Determining the number of hotspot contracts on each chain according to the contract hotspot information; Comparing the number of hotspot contracts on each chain with a preset hotspot threshold to obtain a comparison result; Determining the hotspot status of each chain according to the comparison result; wherein, the determining the smart contracts that need to be transferred on the chain to be transferred includes: Obtaining the smart contract information of the chain to be transferred; Determining the transaction status of each smart contract according to the smart contract information; Regarding the smart contracts whose transaction status is not in the hotspot state as the smart contracts that need to be transferred.
2. The method according to claim 1, characterized in that, the determining the chain to be transferred and the target chain according to the hotspot status includes: Determining a hotspot upper limit threshold and a hotspot lower limit threshold according to a preset hotspot threshold; Regarding the chain with the number of hotspot contracts greater than the hotspot upper limit threshold as the chain to be transferred according to the hotspot status; Regarding the chain with the number of hotspot contracts less than the hotspot lower limit threshold as the target chain according to the hotspot status.
3. The method according to claim 1, characterized in that, the regarding the smart contracts whose transaction status is not in the hotspot state as the smart contracts that need to be transferred includes: Determining the node online usage amount of each smart contract according to the transaction status of the smart contract; Comparing the node online usage amount of each smart contract with a usage amount hotspot threshold, and regarding the smart contracts with the node online usage amount less than the usage amount hotspot threshold as the smart contracts that need to be transferred.
4. The method according to claim 1, characterized in that, the transferring the user information corresponding to the smart contracts that need to be transferred to the target chain includes: Obtaining the user information of the smart contracts that need to be transferred; Closing the transaction status of the smart contracts that need to be transferred on the chain to be transferred; Transmitting and transferring the user information of the smart contracts that need to be transferred to the target chain; Opening the transaction status of the smart contracts that need to be transferred on the target chain to complete the transfer of the smart contracts that need to be transferred.
5. A transaction protection device based on blockchain, characterized in that, The blockchain-based transaction protection device includes: A status acquisition module, configured to acquire the hot status of each chain on the blockchain to be monitored; A chain determination module, configured to determine the chain to be transferred and the target chain according to the hot status; A contract locking module, configured to determine the smart contracts that need to be transferred on the chain to be transferred; A contract transfer module, configured to transfer the user information corresponding to the smart contracts that need to be transferred to the target chain to protect the transaction stability of the blockchain to be monitored, where the user information at least includes the transactions, identities, and times of the users currently using the corresponding smart contracts; Wherein, the blockchain-based transaction protection device is further configured to: Collect the chain information of each chain on the blockchain to be monitored; Determine the contract hot information of the smart contracts on each chain according to the chain information; Determine the hot status of each chain according to the contract hot information; Wherein, the blockchain-based transaction protection device is further configured to: Determine the number of hot contracts on each chain according to the contract hot information; Compare the number of hot contracts on each chain with a preset hot threshold to obtain a comparison result; Determine the hot status of each chain according to the comparison result; Wherein, the contract locking module is specifically configured to: Obtain the smart contract information of the chain to be transferred; Determine the transaction status of each smart contract according to the smart contract information; Use the smart contracts whose transaction status is not in the hot status as the smart contracts that need to be transferred.
6. A blockchain-based transaction protection device, Characterized in that The device includes: a memory, a processor, and a blockchain-based transaction protection program stored on the memory and executable on the processor, and the blockchain-based transaction protection program is configured to implement the blockchain-based transaction protection method according to any one of claims 1 to 4.
7. A storage medium, Characterized in that The storage medium stores a blockchain-based transaction protection program, and when the blockchain-based transaction protection program is executed by a processor, it implements the blockchain-based transaction protection method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Transaction information migration method and device based on smart contract, equipment and medium
CN113342776A