A tamper-proofing method and device for a smart contract, equipment, and storage medium

By establishing a mirror fingerprint blockchain in the blockchain system, monitoring the mirror fingerprint of smart contracts and comparing it with the mirror fingerprint blockchain, the problem of smart contracts being dynamically tampered with on the blockchain is solved, and dynamic security detection and prevention of smart contracts are realized.

CN116418523BActive Publication Date: 2026-05-29CHINA MOBILE COMM LTD RES INST +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHINA MOBILE COMM LTD RES INST
Filing Date
2021-12-30
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Existing technologies cannot effectively detect and prevent smart contracts from being dynamically tampered with on the blockchain, and static security detection methods cannot prevent the tampering of smart contracts after deployment.

Method used

By establishing a mirror fingerprint blockchain in the blockchain system, the fingerprints of all business blockchains and smart contract mirrors are maintained. The system processes of nodes are used to monitor the fingerprints of smart contract mirrors and compare them with the mirror fingerprint blockchain. If a mismatch is found, tampering is confirmed.

Benefits of technology

It enables the monitoring and prevention of dynamic tampering of smart contracts, allowing for timely intervention and ensuring the security of smart contracts on the blockchain.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116418523B_ABST
    Figure CN116418523B_ABST
Patent Text Reader

Abstract

The application discloses a tamper-proofing method of a smart contract, applied to a first node, wherein the first node is a node in a first blockchain, and the method comprises the following steps: determining a first fingerprint of a smart contract; acquiring a second fingerprint, wherein the second fingerprint corresponds to a mirror image of the smart contract; comparing the first fingerprint with the second fingerprint to obtain a comparison result; and determining whether the smart contract is tampered with according to the comparison result. In addition, the application also discloses a tamper-proofing device of a smart contract, equipment and a storage medium. The tamper-proofing method of the smart contract, the device, the equipment and the storage medium provided by the application can monitor the dynamic tampering of the smart contract, so that the smart contract is prevented from being dynamically tampered with.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of blockchain technology, and in particular to a method, apparatus, device, and storage medium for preventing tampering with smart contracts. Background Technology

[0002] In related technologies, the security of smart contracts can only be guaranteed at a static level. However, there are no corresponding detection methods for situations where smart contracts are tampered with after being sent to the blockchain. This tampering after a smart contract is sent to the blockchain can be termed dynamic tampering. Summary of the Invention

[0003] This application provides a method, apparatus, device, and storage medium for preventing tampering of smart contracts in order to solve at least one problem existing in the related technology. It can monitor the dynamic tampering of smart contracts and thus prevent smart contracts from being dynamically tampered with.

[0004] The technical solution of this application is implemented as follows:

[0005] In a first aspect, embodiments of this application provide a method for preventing tampering with smart contracts, applied to a first node, wherein the first node is a node in a first blockchain, and the method includes:

[0006] Determine the first fingerprint of the smart contract;

[0007] Obtain a second fingerprint, which corresponds to a mirror image of the smart contract;

[0008] The first fingerprint and the second fingerprint are compared to obtain the comparison result;

[0009] Based on the comparison results, it is determined whether the smart contract has been tampered with.

[0010] Secondly, embodiments of this application provide a smart contract anti-tampering method, applied to a second node, the second node being a node in a second blockchain, the method comprising:

[0011] Send a second fingerprint to the first node; the second fingerprint corresponds to a mirror image of the smart contract; the first node is a node in the first blockchain, and the second fingerprint is used to assist the first node in verifying whether the smart contract has been tampered with.

[0012] Thirdly, embodiments of this application provide a smart contract anti-tampering device, the device being applied to a first node, the first node being a node in a first blockchain, the device comprising:

[0013] The first determining unit is used to determine the first fingerprint of the smart contract;

[0014] An acquisition unit is used to acquire a second fingerprint, the second fingerprint corresponding to a mirror image of the smart contract;

[0015] The comparison unit is used to compare the first fingerprint and the second fingerprint to obtain a comparison result;

[0016] The second determining unit is used to determine whether the smart contract has been tampered with based on the comparison result.

[0017] Fourthly, this application provides a smart contract anti-tampering device, which is applied to a second node, the second node being a node in a second blockchain, and the device includes:

[0018] The sending unit is used to send a second fingerprint to the first node; the second fingerprint corresponds to a mirror image of the smart contract; the first node is a node in the first blockchain, and the second fingerprint is used to assist the first node in verifying whether the smart contract has been tampered with.

[0019] Fifthly, embodiments of this application provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the above-mentioned smart contract anti-tampering method.

[0020] Sixthly, embodiments of this application provide a storage medium storing a computer program thereon, which, when executed by a processor, implements the above-described smart contract anti-tampering method.

[0021] This application provides a method, apparatus, device, and storage medium for preventing tampering of smart contracts, applied to a first node, which is a node in a first blockchain. The method includes: determining a first fingerprint of the smart contract; obtaining a second fingerprint, the second fingerprint corresponding to a mirror image of the smart contract; comparing the first fingerprint and the second fingerprint to obtain a comparison result; and determining whether the smart contract has been tampered with based on the comparison result. The first fingerprint is the fingerprint of the smart contract sent to the first node, and the second fingerprint is the fingerprint of the mirror image of the smart contract obtained by the first node. The determination of whether the smart contract has been tampered with is based on the comparison result obtained after comparing the first and second fingerprints, thereby enabling monitoring of tampering of the smart contract after it has been sent to the first node, and thus preventing tampering of the smart contract after it has been sent to the first node. Attached Figure Description

[0022] Figure 1A This is a schematic diagram of an optional structure of a blockchain system provided in an embodiment of this application;

[0023] Figure 1BA schematic diagram of the structure of a blockchain system provided in this application embodiment;

[0024] Figure 2 A schematic diagram of an optional process for a smart contract anti-tampering method provided in an embodiment of this application;

[0025] Figure 3A A schematic diagram of an optional structure of a first node provided in an embodiment of this application;

[0026] Figure 3B A schematic diagram of an optional structure of a first node provided in an embodiment of this application;

[0027] Figure 3C A schematic diagram of an optional structure of a first node provided in an embodiment of this application;

[0028] Figure 4 A schematic diagram of an optional process for a smart contract anti-tampering method provided in an embodiment of this application;

[0029] Figure 5 A schematic diagram of an optional process for a smart contract anti-tampering method provided in an embodiment of this application;

[0030] Figure 6 A schematic diagram of an optional process for a smart contract anti-tampering method provided in an embodiment of this application;

[0031] Figure 7 A schematic diagram of an optional process for a smart contract anti-tampering method provided in an embodiment of this application;

[0032] Figure 8 A schematic diagram of the structure of a blockchain system provided in this application embodiment;

[0033] Figure 9 A schematic diagram of an optional process for a smart contract anti-tampering method provided in an embodiment of this application;

[0034] Figure 10 A schematic diagram of an optional process for a smart contract anti-tampering method provided in an embodiment of this application;

[0035] Figure 11 A schematic diagram of an optional process for a smart contract anti-tampering method provided in an embodiment of this application;

[0036] Figure 12 A schematic diagram of an optional process for a smart contract anti-tampering method provided in an embodiment of this application;

[0037] Figure 13 A schematic diagram of an optional process for a smart contract anti-tampering method provided in an embodiment of this application;

[0038] Figure 14 A schematic diagram of an optional structure of a first node provided in an embodiment of this application;

[0039] Figure 15 This is a schematic diagram of an optional structure of the smart contract anti-tampering device provided in the embodiments of this application;

[0040] Figure 16 This is a schematic diagram of an optional structure of the smart contract anti-tampering device provided in the embodiments of this application;

[0041] Figure 17 This is a schematic diagram of an optional structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0042] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the specific technical solutions of the application will be further described in detail below with reference to the accompanying drawings of the embodiments of this application. The following embodiments are used to illustrate this application, but are not intended to limit the scope of this application.

[0043] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0044] In the following description, the terms "first," "second," and "third" are used only to distinguish different objects and do not represent a specific order of objects, nor are they constituting a chronological order. It is understood that "first," "second," and "third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.

[0045] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.

[0046] Before providing a further detailed description of this application, the nouns and terms used in the embodiments of this application will be explained, and the nouns and terms used in the embodiments of this application shall be interpreted as follows.

[0047] 1) Blockchain is a chain-like data structure composed of sequentially linked blocks. Each block references the hash value of the previous block or a subset thereof, thereby cryptographically ensuring the immutability and unforgeability of the recorded transactions. A block is a data structure.

[0048] 2) Smart contracts are contracts deployed on a blockchain network.

[0049] The smart contract anti-tampering method provided in this application embodiment can be applied to a blockchain system, which includes a first node and a second node. The first node is a node in a first blockchain, and the second node is a node in a second blockchain.

[0050] Here, the first node and the second node can be deployed on an electronic device; or, the first node can be deployed on a separate electronic device and the second node can be deployed on another electronic device. This application embodiment does not impose any limitations on this.

[0051] Regarding the first blockchain, the number of the first blockchains can be one or multiple, and this application embodiment does not limit this.

[0052] As an example, the structure of blockchain system 100 can be as follows: Figure 1A As shown, it includes a first node 1011 deployed in the first blockchain 101 and a second node 1021 deployed in the second blockchain 102. The first node 1011 and the second node 1021 can communicate with each other via a network.

[0053] The first node 1011 determines the first fingerprint of the smart contract; obtains the second fingerprint; compares the first fingerprint and the second fingerprint to obtain the comparison result, and determines whether the smart contract has been tampered with based on the comparison result. The second fingerprint corresponds to a mirror image of the smart contract.

[0054] The second node 1021 sends the second fingerprint to the first node. The second fingerprint corresponds to a mirror image of the smart contract; the first node is a node in the first blockchain.

[0055] In this embodiment of the application, the blockchain system may further include: a third node, which is a smart contract publishing node, and the third node can send smart contracts to the first node.

[0056] As an example, the structure of blockchain system 100 can be as follows: Figure 1B As shown, it includes: a first node 101, a second node 102, and a third node 103. The first node 101 and the second node 102 can communicate via a network, as can the second node 102 and the third node 103, and the first node 101 and the third node 103 can also communicate via a network.

[0057] Below, we will combine Figure 1A or Figure 1BThe schematic diagram of the blockchain system shown illustrates various embodiments of the smart contract anti-tampering method, apparatus, device, and storage medium provided in this application.

[0058] This application provides a method for preventing tampering with smart contracts, such as... Figure 2 As shown, the method applied to the first node, which is a node in the first blockchain, includes the following steps:

[0059] S201, The first node determines the first fingerprint of the smart contract.

[0060] Here, the first fingerprint is the fingerprint of the smart contract sent to the first node, and the first node can determine the smart contract based on the first fingerprint.

[0061] The first node may include a running module that can run smart contracts sent to the first node.

[0062] In one example, such as Figure 3A As shown, the first node 101 includes a running module 301, which can run smart contract 3011.

[0063] In this embodiment of the application, the number of smart contracts can be one smart contract or other numbers of smart contracts, and this embodiment of the application does not limit this.

[0064] Here, when there are multiple smart contracts, the smart contract can be identified based on the identity document (ID) of each smart contract among the multiple smart contracts.

[0065] In one example, multiple smart contracts include: smart contract 1, smart contract 2 and smart contract 3, wherein smart contract 1 has an ID of 1, smart contract 2 has an ID of 2 and smart contract 3 has an ID of 3. If the ID is 1, then smart contract 1 can be identified as the smart contract among the multiple smart contracts based on the ID 1.

[0066] The first node may also include a determination module, which can determine the first fingerprint of the smart contract after the running module runs the smart contract.

[0067] In one example, such as Figure 3B As shown, the first node 101 includes: a running module 301 and a determining module 302.

[0068] S202, The first node acquires the second fingerprint.

[0069] Here, the second fingerprint corresponds to the mirror image of the smart contract.

[0070] The first node may also include an acquisition module that can acquire a second fingerprint.

[0071] In one example, such as Figure 3C As shown, the first node 101 includes: a running module 301, a determining module 302, and an acquiring module 303.

[0072] S203. The first node compares the first fingerprint and the second fingerprint to obtain a comparison result.

[0073] Here, after determining the first fingerprint and obtaining the second fingerprint, the first node can compare the first fingerprint and the second fingerprint to obtain a comparison result. The comparison result can include: the first fingerprint and the second fingerprint are the same, or the first fingerprint and the second fingerprint are different.

[0074] S204. The first node determines whether the smart contract has been tampered with based on the comparison result.

[0075] Here, after obtaining the comparison result, the first node can determine whether the smart contract has been tampered with based on the comparison result.

[0076] If the target result is that the first fingerprint and the second fingerprint are the same, it means that the smart contract has not been tampered with. If the target result is that the first fingerprint and the second fingerprint are different, it means that the smart contract has been tampered with.

[0077] This application provides a method for preventing tampering of smart contracts, applied to a first node, which is a node in a first blockchain. The method includes: determining a first fingerprint of the smart contract; obtaining a second fingerprint, the second fingerprint corresponding to a mirror image of the smart contract; comparing the first fingerprint and the second fingerprint to obtain a comparison result; and determining whether the smart contract has been tampered with based on the comparison result. The first fingerprint is the fingerprint of the smart contract sent to the first node, and the second fingerprint is the fingerprint of the mirror image of the smart contract obtained by the first node. The determination of whether the smart contract has been tampered with is based on the comparison result obtained after comparing the first and second fingerprints. This allows for monitoring of tampering of the smart contract after it has been sent to the first node, thereby preventing tampering of the smart contract after it has been sent to the first node.

[0078] In some embodiments, S201 includes: a first node compiling the program code of the smart contract to generate an image of the smart contract; and the first node obtaining the first fingerprint based on the image of the smart contract.

[0079] Here, when the third node sends the program code of the smart contract, the first node can compile the program code of the smart contract after receiving it, generate a smart contract image, and then obtain the first fingerprint based on the smart contract image.

[0080] The image is a binary byte stream. Based on the image of the smart contract, the first fingerprint is obtained by taking the binary byte stream as input and transforming it into a fixed-length output through a hash algorithm. This output is the first fingerprint.

[0081] In some embodiments, such as Figure 4 As shown, the method further includes:

[0082] S401, The first node receives the smart contract sent by the third node.

[0083] Here, the third node is the smart contract publishing node.

[0084] After generating a smart contract, the third node can send the generated smart contract to the first node, which will then receive the smart contract sent by the third node.

[0085] The smart contract sent by the third node can be either the program code of the smart contract or a mirror image of the smart contract; this application embodiment does not limit this.

[0086] In some embodiments, S201 above includes: obtaining the first fingerprint based on a mirror image of the smart contract.

[0087] Here, if the third node sends a mirror image of the smart contract, the first node, upon receiving the mirror image, can directly obtain the first fingerprint based on it.

[0088] In some embodiments, the method further includes: a first node receiving a mirror image of the smart contract sent by a third node, wherein the third node is the publishing node of the smart contract.

[0089] Here, the first node can also receive the image of the smart contract sent by the third node. After receiving the image of the smart contract, it can directly obtain the first fingerprint based on the image of the smart contract.

[0090] In some embodiments, such as Figure 5 As shown, the method further includes:

[0091] S501, The first node sends the first request to the second node.

[0092] Here, the first request is used to request the second node to send the second fingerprint, and the second node is a node in the second blockchain.

[0093] The first request includes at least one of the following: the identifier of the smart contract; the identifier of the version of the smart contract; the identifier of the first blockchain; and the identifier of the first node.

[0094] In one example, the first request includes: the identifier of the smart contract.

[0095] In another example, the first request includes: the identifier of the smart contract and the identifier of the version of the smart contract.

[0096] In yet another example, the first request includes: the identifier of the smart contract, the identifier of the version of the smart contract, and the identifier of the first blockchain.

[0097] In yet another example, the first request includes: the identifier of the smart contract, the identifier of the version of the smart contract, the identifier of the first blockchain, and the identifier of the first node.

[0098] Correspondingly, obtaining the second fingerprint includes: the first node receiving the second fingerprint sent by the second node in response to the first request.

[0099] Here, the first node sends a first request to the second node. After receiving the first request, the second node can respond to the first request by sending a second fingerprint to the first node. After the second node sends the second fingerprint to the first node, the first node can obtain the second fingerprint.

[0100] In some embodiments, such as Figure 6 As shown, the method further includes:

[0101] S601. The first node receives the smart contract sent by the third node and compiles the smart contract to obtain a mirror image of the smart contract.

[0102] Here, when the third node sends the smart contract's program code to the first node, the following two scenarios are possible:

[0103] Case 1: Node-independent class, that is, the image obtained by the first node compiling the program code of the smart contract is independent of the environment of the first node.

[0104] In case 1, since the obtained image is independent of the environment of the first node, the third node can directly compile the program code of the smart contract to generate the image of the smart contract, determine the second fingerprint of the image of the smart contract, and then send the second fingerprint to the second node.

[0105] Scenario 2: Node dependency class, that is, the image obtained by the first node compiling the program code of the smart contract is related to the environment of the first node.

[0106] For scenario 2, since the obtained image is related to the environment of the first node, the program code of the smart contract will be compiled by the first node to obtain the image of the smart contract.

[0107] S602. The first node determines the second fingerprint based on the image of the smart contract.

[0108] Here, the first node obtains the mirror image of the smart contract, and the first node can determine the second fingerprint based on the mirror image of the smart contract.

[0109] S603, the first node sends the second fingerprint to the third node, so that the third node sends the second fingerprint to the second node.

[0110] Here, after determining the second fingerprint, the first node can send the second fingerprint to the third node, thereby enabling the third node to send the second fingerprint to the second node.

[0111] This application provides a method for preventing contract tampering, such as... Figure 7 As shown, this method is applied to a second node, which is a node in a second blockchain, and includes the following steps:

[0112] S701, the second node sends the second fingerprint to the first node.

[0113] Here, the second fingerprint corresponds to the mirror image of the smart contract; the first node is a node in the first blockchain, and the second fingerprint is used to assist the first node in verifying whether the smart contract has been tampered with.

[0114] In this embodiment of the application, a method for preventing tampering with smart contracts is provided, comprising the following steps:

[0115] Step 801: The first node determines the first fingerprint of the smart contract.

[0116] Step 802: The second node sends the second fingerprint to the first node.

[0117] Step 803: The first node acquires the second fingerprint.

[0118] Step 804: The first node compares the first fingerprint and the second fingerprint to obtain a comparison result.

[0119] Step 805: The first node determines whether the smart contract has been tampered with based on the comparison result.

[0120] For an explanation of step 801, please refer to the description of S201 in the above embodiments; for an explanation of step 802, please refer to the description of S701 in the above embodiments; for an explanation of step 803, please refer to the description of S202 in the above embodiments; for an explanation of step 804, please refer to the description of S203 in the above embodiments; and for an explanation of step 805, please refer to the description of S204 in the above embodiments.

[0121] In some embodiments, the method further includes: the second node receiving a first request; the first request being used to request the second node to send the second fingerprint; correspondingly, sending the second fingerprint to the first node includes: in response to the first request, sending the second fingerprint to the first node.

[0122] Here, after the first node sends the first request to the second node, the second node will receive the first request and, in response to the first request, send the second fingerprint to the first node.

[0123] In some embodiments, the method further includes: the second node receiving the second fingerprint sent by the third node and saving the second fingerprint; the third node is the publishing node of the smart contract.

[0124] Here, after receiving the second fingerprint from the third node, the second node can save the received second fingerprint.

[0125] In this embodiment of the application, when a smart contract needs to be taken offline due to its outdated version, the second fingerprint of the smart contract can be deleted on the second node, or the second fingerprint of the smart contract can be set to an invalid state.

[0126] Deleting the second fingerprint of the smart contract on the second node includes: the third node sending a third request to the second node, the third request being used to request the second node to delete the second fingerprint; after receiving the third request, the second node deletes the second fingerprint and sends the deletion result to the third node, wherein the deletion result is used to indicate that the second node has deleted the second fingerprint.

[0127] Here, the third request includes at least one of the following information: the smart contract ID, the smart contract version ID.

[0128] In one example, the third request includes: the smart contract's ID.

[0129] In another example, the third request includes: the ID of the smart contract and the ID of the version of the smart contract.

[0130] In this embodiment of the application, when a smart contract needs to be taken offline due to its outdated version, the first fingerprint of the smart contract can be deleted on the first node, or the first fingerprint of the smart contract can be set to an invalid state.

[0131] Deleting the first fingerprint of the smart contract on the first node includes: the third node sending a fourth request to the first node, the fourth request being used to request the first node to delete the first fingerprint; after receiving the fourth request, the first node deletes the first fingerprint and sends the deletion result to the third node, wherein the deletion result is used to indicate that the first node has deleted the first fingerprint.

[0132] Here, the fourth request includes at least one of the following information: the ID of the smart contract, and the ID of the version of the smart contract.

[0133] In this embodiment of the application, when a smart contract needs to be taken offline due to its outdated version, the second fingerprint can be deleted only at the second node, or the first fingerprint can be deleted only at the first node, or the first fingerprint can be deleted at the first node and the second fingerprint can be deleted at the second node. This embodiment of the application does not impose any limitations on this.

[0134] Smart contracts are a key component in customizing, deploying, and running application logic on a blockchain system. As the use of blockchain expands, it relies heavily on smart contracts to implement application-layer logic. Furthermore, smart contracts typically need to be upgraded along with the overall application system. Existing blockchains, such as Fabric and the Enterprise Operation System (EOS) blockchain, allow smart contract upgrades. Fabric 2.x even allows different peer nodes to upgrade smart contracts at their own pace and at their own chosen times.

[0135] Currently, the security and tamper-proofing of smart contracts face new challenges. Even if a smart contract is verified to be secure during deployment, if malicious programs or users tamper with it after deployment—for example, by altering the smart contract under the guise of an upgrade or exploiting vulnerabilities in the upgrade process—it will severely damage business operations.

[0136] Currently, the primary method for ensuring smart contract security is static security, which is insufficient to prevent dynamic tampering. Dynamic tampering includes modifications made after the smart contract is deployed and during its execution.

[0137] In related technologies, the methods for achieving static security include the following three:

[0138] First, conduct security tests on the smart contracts.

[0139] The executable code of the smart contract is subjected to security testing. Once the test is passed, the smart contract is deployed to the blockchain.

[0140] The drawbacks of performing security testing on this smart contract include: while the smart contract is secure when it is static, once deployed to the blockchain, the blockchain nodes will unconditionally trust the smart contract. At this point, it will be impossible to detect and prevent the smart contract from being tampered with.

[0141] Second, formally verify the smart contracts.

[0142] Formal verification of smart contracts is performed, and their security is demonstrated through methods such as symbolic calculus.

[0143] The disadvantages of formally verifying smart contracts include: static security and the inability to prevent smart contracts from being tampered with after being deployed to the blockchain.

[0144] Third, code auditing.

[0145] The disadvantages of code auditing for smart contracts include: static security, which cannot prevent smart contracts from being tampered with after being deployed to the blockchain.

[0146] Current smart contract security solutions mainly address static security, with relatively insufficient consideration given to dynamic tampering.

[0147] This application provides a method for preventing tampering with smart contracts, which can solve the problem of dynamic tampering of smart contracts. If dynamic tampering is detected during runtime, intervention measures can be taken in a timely manner.

[0148] The approach of this application includes the following two:

[0149] First, establish a mirror fingerprint blockchain, which is used to maintain the fingerprints of all business blockchains and all versions of smart contract mirrors.

[0150] Here, the business blockchain refers to the first blockchain described in the above embodiments.

[0151] The mirror fingerprint blockchain is the second blockchain described in the above embodiments.

[0152] Second, each node in the business blockchain has a resident system process that monitors the mirror image of the smart contract, calculates the fingerprint of the mirror image, and compares it with the mirror fingerprint blockchain. If a mismatch is found, the smart contract on the business blockchain is considered to have been tampered with.

[0153] The smart contract anti-tampering method provided in this application embodiment can be applied to, for example, Figure 8 The network architecture shown below will be described in detail below.

[0154] like Figure 8 As shown, the newly added device includes: Mirror Fingerprint Blockchain 801; the upgraded device includes: Business Blockchain 802.

[0155] The smart contract anti-tampering method provided in this application includes the following steps:

[0156] Step 1: Publish the smart contract.

[0157] When developers complete a new version of a smart contract, they upload the fingerprint of that smart contract to the mirror fingerprint blockchain.

[0158] Due to the differences in blockchain technology, the carriers for publishing and deploying smart contracts include the following two scenarios:

[0159] Scenario (a): The smart contract being published and deployed is carried out on program code, which needs to be compiled on blockchain nodes to generate an image. The program code is either source code or some type of code derived from the original code.

[0160] Scenario (b): The smart contract being published and deployed is carried out as an image. That is, the developer first compiles and generates the image, and then publishes and deploys it to the blockchain nodes.

[0161] Regarding scenario (a), due to differences in blockchain technology, the images generated by compiling smart contracts on different computing nodes may be the same or different. Therefore, this application provides two processes.

[0162] Scenario (a1): For a certain type of blockchain technology, such as node-independent technology, the compiled images of the same smart contract program code are completely identical on different computing nodes. In other words, the compilation result of node-independent technology is independent of the node's computing environment. In this case, either process (a1) or process (a2) can be selected for processing. Process (a1) has a higher anti-tampering effect than process (a2).

[0163] Here, for node-independent technologies, the methods in process (a1) or process (a2) below can be used to prevent the problem of dynamic tampering of smart contracts.

[0164] Scenario (a2): For another type of blockchain technology, such as node-dependent technologies, the compiled images of the same smart contract program code may differ on different computing nodes. In other words, the compilation result of node-dependent technologies is related to the node computing environment, meaning the generated image will be affected by the node computing environment. In this case, the following process (a2) can be selected for handling.

[0165] For node-dependent technologies, the method in process b below can be used to prevent the problem of dynamic tampering of smart contracts.

[0166] In this embodiment of the application, the above situation will be summarized in Table 1 below.

[0167] Table 1

[0168]

[0169] like Figure 9 As shown, process (a1) includes the following steps:

[0170] Step a11: Developers develop smart contract program code.

[0171] Here, "developer" can be understood as the electronic device used by the developer, which is the third node described in the above embodiments.

[0172] Step a12: Developers compile and generate an image, and calculate the image fingerprint.

[0173] Step a13: The developer uploads the mirror fingerprint to the mirror fingerprint blockchain.

[0174] Here, the mirrored fingerprint carries information such as the smart contract ID and version number.

[0175] Step a14: Deploy the smart contract (program code).

[0176] Step a15: Generate an image from the business blockchain.

[0177] like Figure 10 As shown, process (a2) includes the following steps:

[0178] Step a21: The developer develops the smart contract program code.

[0179] Step a22: Deploy the smart contract (program code).

[0180] Step a23: Compile and generate an image in the business blockchain and calculate the fingerprint.

[0181] Step a24: The business blockchain provides the developers with the fingerprint of the smart contract image.

[0182] Step a25: The developer uploads the smart contract image fingerprint to the image fingerprint blockchain.

[0183] Here, the fingerprint of the smart contract image carries information such as the smart contract ID, version number, blockchain ID, and node ID.

[0184] like Figure 11As shown, process b includes the following steps:

[0185] Step b1: Developers develop smart contract program code.

[0186] Step b2: Developers compile and generate an image, and calculate the image fingerprint.

[0187] Step b3: The developer uploads the mirror fingerprint to the mirror fingerprint blockchain.

[0188] Here, the mirrored fingerprint carries information such as the smart contract ID and version number.

[0189] Step b4: Deploy the smart contract (image).

[0190] Step 2: Verify the smart contract.

[0191] The system processes on the business blockchain nodes need to periodically or as needed check the mirror images of smart contracts deployed on the mirror fingerprint blockchain, calculate the fingerprints of the locally deployed smart contract images, and obtain the corresponding fingerprints from the mirror fingerprint blockchain for comparison. If they do not match, it indicates that tampering has occurred.

[0192] like Figure 12 As shown, the method for verifying smart contracts includes the following steps:

[0193] S1201, the fingerprint of the smart contract image deployed locally for business blockchain computing.

[0194] S1202, The business blockchain sends a request to the mirror fingerprint blockchain to query the mirror fingerprint.

[0195] Here, the request to query the mirror fingerprint includes information such as the smart contract ID and version ID.

[0196] For business blockchains that rely on nodes, information such as the business blockchain ID and node ID also needs to be included.

[0197] S1203, The mirror fingerprint blockchain feeds back the mirror fingerprint to the business blockchain.

[0198] S1204. The business blockchain compares the fingerprint of the locally deployed smart contract image with the image fingerprint fed back by the image fingerprint blockchain.

[0199] Step 3: Deactivate the smart contract.

[0200] When a smart contract needs to be taken offline due to its outdated version, the corresponding fingerprint needs to be deleted from the mirror fingerprint blockchain. Deleting the corresponding fingerprint can be understood as setting it to an invalid state.

[0201] like Figure 13As shown, the method for taking a smart contract offline includes the following steps:

[0202] S1301. The developer requests the removal of the fingerprint from the mirror fingerprint blockchain, carrying the smart contract ID and version ID.

[0203] S1302, Mirror fingerprint blockchain delete fingerprint.

[0204] S1303, the mirror fingerprint blockchain provides feedback on the deletion results to developers.

[0205] S1304, The developer sends a request to the business blockchain to take the smart contract offline.

[0206] S1305, the smart contract and version corresponding to the offline business blockchain.

[0207] S1306, The business blockchain provides feedback on the offline results to developers.

[0208] The internal structure of the business blockchain node provided in the embodiments of this application will be described in detail below.

[0209] like Figure 14 As shown, the business blockchain node includes: a smart contract runtime environment 141 and a system process runtime environment 142. The smart contract runtime environment 141 includes: smart contract 1411 and smart contract 1412. The system process runtime environment 142 includes anti-tampering detection 1421, local fingerprint calculation 1422, and cloud fingerprint query 1423.

[0210] like Figure 14 As shown, the following system-level software modules have been added to the system process runtime environment:

[0211] Calculate local fingerprint: Responsible for calculating the fingerprint of the smart contract image deployed locally.

[0212] Query Cloud Fingerprint: Responsible for querying the fingerprint of the mirror corresponding to the local smart contract from the mirror fingerprint blockchain.

[0213] Extract the developer signature from the results returned by the mirror fingerprint blockchain and verify the signature.

[0214] Here, the purpose of developer signing and signature verification is to confirm that the smart contract was developed by the pre-agreed developer, and not by someone else impersonating the developer.

[0215] If someone else is impersonating him, he may have developed malicious software.

[0216] Anti-tampering monitoring: Responsible for scheduling the "Calculate local fingerprint" and "Query cloud fingerprint" modules to compare the fingerprint of the smart contract image with the cloud fingerprint of the mirror fingerprint blockchain in order to confirm whether tampering has occurred.

[0217] The mirror fingerprint blockchain provided in the embodiments of this application will be described in detail below.

[0218] The data structure of the ledger of the needle node-independent business blockchain and the mirror fingerprint blockchain is shown in Table 2.

[0219] Table 2

[0220]

[0221] For node-dependent business blockchains, the ledger data structure of the mirror fingerprint blockchain is shown in Table 3 below.

[0222] Table 3

[0223]

[0224]

[0225] In this embodiment of the application, when a developer completes the development of a new version of the smart contract, the fingerprint of the new version of the smart contract image needs to be input into the image fingerprint blockchain.

[0226] The input parameters are structured data.

[0227] For example, for "node-independent" business blockchains, input parameters may include: smart contract ID, version ID, fingerprint, status (availability), and developer signature.

[0228] For "node-dependent" business blockchains, input parameters may include: smart contract ID, version ID, business blockchain ID, node ID, fingerprint, status (availability), and developer signature.

[0229] The structured data is appended to the ledger, and the developer signature is verified.

[0230] Output: Write result (whether successful)

[0231] The nodes of the business blockchain request to query the mirror fingerprint of the smart contract and version.

[0232] Scenario: A node on a business blockchain requests a query for a specific smart contract and its mirror fingerprint.

[0233] Input: The input parameter is structured data.

[0234] For example, for "node-independent" business blockchains, input parameters may include: smart contract ID and version ID.

[0235] For "node-dependent" business blockchains, input parameters may include: smart contract ID, version ID, business blockchain ID, and node ID.

[0236] By querying the structured data in the ledger, the developer's signature can be verified.

[0237] Output: Structured data.

[0238] Scenario: When a developer decides to take a smart contract or version offline, the fingerprint needs to be removed from the blockchain, i.e., recorded as "offline".

[0239] Input: The input parameter is structured data, which may include: smart contract ID, version ID, and developer signature.

[0240] Logic: The ledger records the corresponding smart contract and version fingerprint status as offline, and verifies the developer signature. Verification of the developer signature is optional; this embodiment does not impose any limitations on this.

[0241] Output: The result of writing the chain, i.e., whether it was successful or not.

[0242] For smart contract IDs, the smart contract ID must be globally unique. This application does not limit the encoding method of the smart contract ID, such as: business blockchain ID, smart contract ID, or version ID.

[0243] When calculating fingerprints, input parameters may include at least one of the following: the code of the smart contract image, the smart contract ID, the smart contract version ID, the business blockchain ID, and the node ID. The code of the smart contract image is a required parameter. For node IDs, this parameter is not required for node-independent business blockchains; it is optional for node-dependent business blockchains.

[0244] Algorithm: This invention does not limit the calculation method of smart contract mirror fingerprints, such as SHA-256.

[0245] The key point of this application is to support dynamic verification of whether smart contracts have been tampered with.

[0246] The key points of this application include the following:

[0247] (1) Establish a mirror fingerprint blockchain to maintain the fingerprints of smart contract mirrors for all business blockchains and all versions.

[0248] (2) The device that maintains the mirrored fingerprint is itself a blockchain, which has the characteristics of being tamper-proof and traceable, thus improving the security and reliability of fingerprint verification.

[0249] (3) The system process of the business blockchain node monitors the locally deployed smart contract image, calculates its fingerprint, and queries the corresponding fingerprint from the image fingerprint blockchain for comparison. If a mismatch is found, it is considered that the smart contract of the business blockchain has been tampered with.

[0250] The tamper-proof smart contract method provided in this application has the following advantages: it supports dynamic verification of whether a smart contract has been tampered with. By deploying smart contract fingerprints on the cloud side through a mirrored fingerprint blockchain, the deployment of fingerprints is separated from the deployment of smart contracts, avoiding the inability to verify the authenticity of smart contracts due to attacks on the business blockchain.

[0251] Figure 15 A smart contract anti-tampering device provided for embodiments of this application, such as Figure 15 As shown, the contract anti-tampering device 1500 is applied to a first node, which is a node in the first blockchain. The device 1500 includes:

[0252] The first determining unit 1501 is used to determine the first fingerprint of the smart contract;

[0253] The acquisition unit 1502 is used to acquire a second fingerprint, which corresponds to the image of the smart contract;

[0254] Comparison unit 1503 is used to compare the first fingerprint and the second fingerprint to obtain a comparison result;

[0255] The second determining unit 1504 is used to determine whether the smart contract has been tampered with based on the comparison result.

[0256] In some embodiments, the first determining unit 1501 is further configured to:

[0257] The program code of the smart contract is compiled to generate an image of the smart contract;

[0258] The first fingerprint is obtained based on the mirror image of the smart contract.

[0259] In some embodiments, the apparatus further includes: a first receiving unit, configured to:

[0260] The system receives the smart contract sent by a third node, which is the publishing node of the smart contract.

[0261] In some embodiments, the first determining unit 1501 is further configured to:

[0262] The first fingerprint is obtained based on the mirror image of the smart contract.

[0263] In some embodiments, the first receiving unit is further configured to:

[0264] Receive the image of the smart contract sent by a third node, where the third node is the publishing node of the smart contract.

[0265] In some embodiments, the apparatus further includes a processing unit for:

[0266] A first request is sent to the second node; the first request is used to request the second node to send the second fingerprint; the second node is a node in the second blockchain;

[0267] The acquisition unit 1502 is also used for:

[0268] Receive the second fingerprint sent by the second node in response to the first request.

[0269] In some embodiments, the first receiving unit is further configured to:

[0270] Receive the smart contract sent by the third node, compile the smart contract, and obtain an image of the smart contract;

[0271] Based on the mirror image of the smart contract, the second fingerprint is determined;

[0272] The second fingerprint is sent to the third node, so that the third node sends the second fingerprint to the second node.

[0273] Figure 16 A smart contract anti-tampering device provided for embodiments of this application, such as Figure 16 As shown, the smart contract anti-tampering device 1600 is applied to a second node, which is a node in a second blockchain. The device 1600 includes:

[0274] The sending unit 1601 is used to send a second fingerprint to the first node; the second fingerprint corresponds to a mirror image of the smart contract; the first node is a node in the first blockchain, and the second fingerprint is used to assist the first node in verifying whether the smart contract has been tampered with.

[0275] In some embodiments, the apparatus further includes: a second receiving unit, configured to:

[0276] Receive a first request; the first request is used to request the second node to send the second fingerprint;

[0277] The sending unit 1601 is also configured to send the second fingerprint to the first node in response to the first request.

[0278] In some embodiments, the second receiving unit is further configured to:

[0279] The system receives the second fingerprint sent by the third node and saves the second fingerprint; the third node is the publishing node of the smart contract.

[0280] It should be noted that the information processing device provided in this application embodiment includes various units that can be implemented by a processor in an electronic device; of course, it can also be implemented by specific logic circuits; in the implementation process, the processor can be a central processing unit (CPU), a microprocessor (MPU), a digital signal processor (DSP), or a field-programmable gate array (FPGA), etc.

[0281] The descriptions of the above device embodiments are similar to those of the above method embodiments, and have similar beneficial effects. For technical details not disclosed in the device embodiments of this application, please refer to the descriptions of the method embodiments of this application for understanding.

[0282] It should be noted that, in the embodiments of this application, if the above-described information processing method is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiments of this application, or the part that contributes to the related technology, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), magnetic disks, or optical disks. Thus, the embodiments of this application are not limited to any specific hardware and software combination.

[0283] This application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the smart contract anti-tampering method implemented by the first node or the second node described above.

[0284] This application embodiment also provides a storage medium storing a computer program, which, when executed by a processor, implements the smart contract anti-tampering method implemented by the first node or the second node described above.

[0285] It should be noted that the above description of the storage medium embodiments is similar to the description of the method embodiments described above, and has similar beneficial effects. For technical details not disclosed in the storage medium and device embodiments of this application, please refer to the description of the method embodiments of this application for understanding.

[0286] It should be noted that, Figure 17 This is a schematic diagram of a hardware entity of an electronic device according to an embodiment of this application, such as... Figure 17 As shown, the electronic device 1700 includes: a processor 1701, at least one communication bus 1702, at least one external communication interface 1704, and a memory 1705. The communication bus 1702 is configured to enable communication between these components. In one example, the electronic device 1700 further includes: a user interface 1703, which may include a display screen; and the external communication interface 1704 may include standard wired and wireless interfaces.

[0287] The memory 1705 is configured to store instructions and applications executable by the processor 1701, and can also cache data to be processed or already processed by the processor 1701 and various modules in the electronic device (e.g., image data, audio data, and communication data), which can be implemented by flash memory or random access memory (RAM).

[0288] It should be understood that the phrase "one embodiment" or "an embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in some embodiments" appearing throughout the specification do not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. It should be understood that in the various embodiments of the present application, the sequence numbers of the above-described processes do not imply a sequential order of execution; the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application. The sequence numbers of the above-described embodiments are merely descriptive and do not represent the superiority or inferiority of the embodiments.

[0289] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0290] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple units or components can be combined, or integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed can be through some interfaces, and the indirect coupling or communication connection between devices or units can be electrical, mechanical, or other forms.

[0291] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units. They may be located in one place or distributed across multiple network units. Some or all of the units may be selected to achieve the purpose of this embodiment according to actual needs.

[0292] In addition, each functional unit in the embodiments of this application can be integrated into one processing unit, or each unit can be a separate unit, or two or more units can be integrated into one unit; the integrated unit can be implemented in hardware or in the form of hardware plus software functional units.

[0293] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media that can store program code, such as mobile storage devices, ROMs, magnetic disks, or optical disks.

[0294] Alternatively, if the integrated units described in the embodiments of this application are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, or the parts that contribute to related technologies, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROMs, magnetic disks, or optical disks.

[0295] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A method for preventing tampering with smart contracts, characterized in that, Applied to a first node, which is a node in a first blockchain, the method includes: Determine the first fingerprint of the smart contract; A second fingerprint is obtained, which corresponds to the image of the smart contract; wherein the second fingerprint is obtained through a second node, which is a node in a second blockchain; the second blockchain is a blockchain system specifically used to store the image fingerprint of the smart contract; The first fingerprint and the second fingerprint are compared to obtain the comparison result; Based on the comparison results, determine whether the smart contract has been tampered with; When the smart contract is a node-dependent contract, the second fingerprint contains business blockchain identifier and node identifier information; the node-dependent type indicates that the image obtained by the first node compiling the program code of the smart contract is related to the environment of the first node; Before obtaining the second fingerprint, the method further includes: receiving the smart contract sent by the third node and compiling the smart contract to obtain an image of the smart contract; determining the second fingerprint based on the image of the smart contract; and sending the second fingerprint to the third node, so that the third node sends the second fingerprint to the second node.

2. The method according to claim 1, characterized in that, The determination of the first fingerprint of the smart contract includes: The program code of the smart contract is compiled to generate an image of the smart contract; The first fingerprint is obtained based on the mirror image of the smart contract.

3. The method according to claim 1, characterized in that, The method further includes: The system receives the smart contract sent by a third node, which is the publishing node of the smart contract.

4. The method according to claim 1, characterized in that, The determination of the first fingerprint of the smart contract includes: When the smart contract is a node-independent contract, the first fingerprint is obtained based on the mirror image of the smart contract.

5. The method according to claim 4, characterized in that, The method further includes: Receive the image of the smart contract sent by a third node, where the third node is the publishing node of the smart contract.

6. The method according to claim 1, characterized in that, The method further includes: A first request is sent to the second node; the first request is used to request the second node to send the second fingerprint; the second node is a node in the second blockchain; Correspondingly, obtaining the second fingerprint includes: Receive the second fingerprint sent by the second node in response to the first request.

7. A method for preventing tampering with smart contracts, characterized in that, Applied to a second node, which is a node in a second blockchain, the method includes: A second fingerprint is sent to the first node; the second fingerprint corresponds to a mirror image of the smart contract; the first node is a node in the first blockchain, and the second fingerprint is used to assist the first node in verifying whether the smart contract has been tampered with; the second fingerprint is obtained through a second node, which is a node in the second blockchain; the second blockchain is a blockchain system specifically used to store mirror fingerprints of smart contracts. When the smart contract is a node-dependent contract, the second fingerprint includes business blockchain identifier and node identifier information; the node-dependent type indicates that the image obtained by the first node compiling the program code of the smart contract is related to the environment of the first node; the second fingerprint is determined by the first node based on the image of the smart contract, and the second fingerprint is sent by the first node to the third node and then sent to the second node through the third node.

8. The method according to claim 7, characterized in that, The method further includes: Receive a first request; the first request is used to request the second node to send the second fingerprint; Correspondingly, sending the second fingerprint to the first node includes: In response to the first request, the second fingerprint is sent to the first node.

9. The method according to claim 7, characterized in that, The method further includes: The system receives the second fingerprint sent by the third node and saves the second fingerprint; the third node is the publishing node of the smart contract.

10. A smart contract anti-tampering device, characterized in that, The device is applied to a first node, the first node being a node in a first blockchain, and the device includes: The first determining unit is used to determine the first fingerprint of the smart contract; An acquisition unit is used to acquire a second fingerprint, which corresponds to a mirror image of the smart contract; wherein the second fingerprint is obtained through a second node, which is a node in a second blockchain; the second blockchain is a blockchain system specifically used to store the mirror fingerprint of the smart contract; The comparison unit is used to compare the first fingerprint and the second fingerprint to obtain a comparison result; The second determining unit is used to determine whether the smart contract has been tampered with based on the comparison result; when the smart contract is a node-dependent contract, the second fingerprint includes business blockchain identifier and node identifier information; the node-dependent type indicates that the image obtained by the first node compiling the program code of the smart contract is related to the environment of the first node; before obtaining the second fingerprint, the method further includes: receiving the smart contract sent by the third node, and compiling the smart contract to obtain an image of the smart contract; determining the second fingerprint based on the image of the smart contract; and sending the second fingerprint to the third node, so that the third node sends the second fingerprint to the second node.

11. A smart contract anti-tampering device, characterized in that, The device is applied to a second node, which is a node in a second blockchain, and the device includes: A sending unit is used to send a second fingerprint to a first node; the second fingerprint corresponds to a mirror image of a smart contract; the first node is a node in a first blockchain, and the second fingerprint is used to assist the first node in verifying whether the smart contract has been tampered with; the second fingerprint is obtained through a second node, which is a node in a second blockchain; the second blockchain is a blockchain system specifically used to store smart contract mirror fingerprints; when the smart contract is a node-dependent contract, the second fingerprint contains business blockchain identifier and node identifier information; the node-dependent type indicates that the mirror image obtained by the first node compiling the program code of the smart contract is related to the environment of the first node; the second fingerprint is determined by the first node based on the mirror image of the smart contract, and the second fingerprint is sent by the first node to a third node and then sent to the second node through the third node.

12. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the smart contract anti-tampering method according to any one of claims 1 to 6, or implements the smart contract anti-tampering method according to any one of claims 7 to 9.

13. A storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the smart contract anti-tampering method according to any one of claims 1 to 6, or implements the smart contract anti-tampering method according to any one of claims 7 to 9.