A controllable update method for blockchain smart contracts

Through the controllable chameleon hash algorithm and CP-ABE technology, the problem of address inconsistency and security risks in blockchain smart contract updates is solved, the address consistency and security of contract updates is achieved, management costs are reduced, and the development of the blockchain smart contract engineering system is promoted.

CN119519927BActive Publication Date: 2025-09-02BEIJING WUZI UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411665810.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-20
Publication Date
2025-09-02
Estimated Expiration
2044-11-20

AI Technical Summary

Technical Problem

The update of blockchain smart contracts is difficult to achieve address consistency, and there are problems of security risks and high management costs.

Method used

The controllable chameleon hash algorithm is used to generate a controllable trap set and attribute key to achieve address consistency before and after contract updates, and access control is carried out in combination with CP-ABE technology to ensure the security and credibility of contract updates.

Benefits of technology

It realizes consistency of contract update addresses, reduces management costs and security risks, enhances the stability of contract call relationships, and promotes the improvement of the blockchain smart contract engineering system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119519927B_ABST
    Figure CN119519927B_ABST
Patent Text Reader

Abstract

A controllable update method for blockchain smart contracts includes a system initialization phase, in which the blockchain stores hash values ​​of participant identities for identity authentication, and the participants and authentication nodes generate public and private keys for secure transmission; a contract deployment phase, in which the deployer and the trusted execution environment perform identity authentication, and the trusted execution environment then generates relevant parameters and shares them with all users and deployers based on demand, and the deployer executes the contract deployment operation process and shares relevant data; a property key generation phase, in which the updater and the trusted execution environment perform identity authentication, and the deployer and updater send encrypted relevant attributes to the trusted execution environment, and the trusted execution environment generates an attribute key and encrypts it and sends it to the updater; a contract update phase, in which the updater obtains a controllable chameleon hash ciphertext set, generates and verifies relevant parameters, executes the contract update operation process, and shares relevant data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of blockchain technology, and in particular to a controllable update method for blockchain smart contracts. Background Art

[0002] In today's digital society, blockchain technology is gradually evolving into a significant force driving global economic development, offering distinct advantages. Blockchain's renowned distributed management and immutability have led to its widespread application in fields such as finance and supply chain management. The concept of smart contracts, first proposed by Nick Szabo in the 1990s, has gained widespread application as blockchain technology enters a new phase of development. Smart contracts are essentially code deployed on the blockchain, capable of automatic execution without the need for an intermediary. Similar to traditional software engineering, they adhere to lifecycle management principles, including design, development, deployment, maintenance, and iterative updates. However, due to the immutability of blockchain, smart contracts are difficult to modify once uploaded to the blockchain. This makes updating smart contracts challenging. Once a vulnerability is discovered during the operation of a smart contract, it is difficult to repair or update it based on the original contract.

[0003] To address the issue of updating blockchain smart contracts, this paper utilizes the concepts of "soft updates" and "hard updates." A common method for updating existing smart contracts is to deploy a new version of the contract to replace the old one. This creates a new contract account and requires middleware to manage the calling relationships between contracts. For example, the proxy model is commonly used in practice. This model uses a proxy contract to manage the calling of various logical contracts, which contain the actual business logic and state. Updating a new contract requires changing the address of the logical contract referenced in the proxy contract. The proxy contract then points to the new logical contract, allowing users to complete the update without interacting with the new logical contract. The OpenZeppelin tool uses this approach to implement a proxy coordinator whose static address points to the latest version of the target smart contract. This method, referred to in this paper as a "soft update," can achieve contract updates, but it increases the complexity of contract updates, and the old contract remains on-chain. If the old contract contains design or coding vulnerabilities, such as reentrancy vulnerabilities, it may be called by other contracts, which could then be exploited to launch attacks, causing losses and posing a security risk. At the same time, "soft updates" cause changes in contract addresses, which can weaken the stability of contract call relationships. For example, if multiple contracts call each other, once a contract changes, the call addresses of all related contracts must also change. This not only increases management costs but also may introduce potential errors or security risks. This present invention proposes a "hard update" solution for blockchain smart contracts. A "hard update" ensures that the addresses remain consistent before and after the contract update, enhancing the stability of the contract call relationship. At the same time, the original contract is no longer stored on the chain, preventing attackers from calling old contracts that may have vulnerabilities, thereby reducing security risks. Furthermore, blockchain smart contracts are often used in critical areas, and contract updates require a trusted permission control method. This means that they must be manageable and controllable while ensuring security, and that operational permissions cannot be stolen or manipulated by untrusted individuals. This is a problem that current "hard update" methods for contracts need to address.

[0004] Chameleon hashing is a specific type of hash function that incorporates a trapdoor, which is a type of secret key. When the trapdoor is known, the collision parameter can be calculated. A collision is a condition that allows different input data to map to the same hash result. When the trapdoor is unknown, Chameleon hashing is collision-resistant. Based on Chameleon hashing's collision resistance, many researchers have begun exploring editable blockchains based on Chameleon hashing. For example, using Chameleon hashing to replace the original hash to create an editable blockchain allows the contents of a block in the blockchain to be rewritten, replacing the original block, and deleting unnecessary blocks to shorten the blockchain. Traps are crucial in Chameleon hashing, and security must be ensured. Therefore, Chameleon-based editable blockchains are often combined with access control models to restrict access to the trapdoor. For example, researchers have designed a policy-based Chameleon hashing algorithm, which allows any user who meets the specified attributes in the access policy to perform hash collisions, thereby enabling transaction editing.

[0005] This invention differs from the aforementioned work in that it achieves trusted control of hash collisions by designing a controllable Chameleon hash algorithm. This algorithm is then applied to blockchain smart contract updates, forming a "hard update" method for smart contracts. This method ensures the consistency of contract update addresses while eliminating redundant contracts, reducing management costs and security risks, and ultimately contributing to the improvement of blockchain smart contract engineering systems. Summary of the Invention

[0006] A controllable update method for a blockchain smart contract, characterized by comprising:

[0007] System initialization: Each participant i in the system generates a public-private key pair pk i ,sk i , used for encrypted transmission of data during communication, the blockchain authentication node initializes the public-private key pair pk v ,sk v During the initialization phase, each participant i is jointly reviewed offline by all blockchain participants to obtain a unique identity identifier Uid. i ; Participants save it themselves ki and Uid i ; These identity identifiers Uid will be stored on the blockchain i The authentication node will use its public key pk v Sent to all participants;

[0008] Contract deployment: The trusted execution environment encrypts the deployer's identity and your own encrypted identity The authentication node uploaded to the blockchain verifies and returns the verification result to the deployer and the trusted execution environment. The trusted execution environment executes the CCH.Setup function to generate the system public key pk, master key mk, contract number Cid, and the controllable trapdoor set CCS of the encrypted Chameleon trapdoor tk. The trusted execution environment shares its own public key pk1, controllable public key pk, and contract number Cid with all users, and shares the controllable trapdoor set CCS with the deployer. The contract deployment operation process is executed, and the deployer then shares the generated controllable Chameleon hash ciphertext set CCHS1 and contract number Cid for subsequent updaters to download.

[0009] Attribute key generation: Trusted execution environment uploads encrypted updater identity and an encrypted trusted execution environment identity The authentication node verifies the blockchain and returns the verification result to the updater and the trusted execution environment. The deployer sends the environment attributes encrypted with the public key pk1 to the trusted execution environment. The updater sends the subject attributes and identity attributes encrypted with the public key pk1 and its own public key pk3 to the trusted execution environment. The trusted execution environment decrypts the specific value of the attribute using its own private key sk1, generates the attribute key ak, and encrypts the attribute key ak using the updater's public key pk3 and sends it to the updater.

[0010] Contract update: The updater retrieves the controllable chameleon hash ciphertext set CCHS1 of the contract to be updated from the shared directory according to the contract number Cid, executes the CCH.HashCol function operation, and generates a collision parameter r b ; The updater passes the collision parameter r b , the new contract data msg2 and the controllable chameleon hash ciphertext set CCHS1 are sent to the trusted execution environment to execute the CCH.Ver function on r b Verify; the updater executes the contract update operation process to update the contract and shares the controllable chameleon hash ciphertext set CCHS2 and contract number Cid after the updated strategy.

[0011] Preferably, the trusted execution environment will use the encrypted identity of the deployer and your own encrypted identity The authentication node uploaded to the blockchain performs verification and returns the verification results to the deployer and the trusted execution environment, including:

[0012] The deployer first sends a contract deployment request to the trusted execution environment and sends the identity Uid i Pass the public key pk of the authentication node vEncrypted transmission to the trusted execution environment, which uploads the encrypted deployer identity and an encrypted trusted execution environment identity Go to the authentication node of the blockchain, the authentication node decrypts the deployer's identity Uid2 and the trusted execution environment's identity Uid1, calls the authentication contract on the chain to match the hash value of the identity, and the authentication node returns the verification result to the deployer and the trusted execution environment. If the verification passes, subsequent operations can be performed.

[0013] Preferably, the execution contract deployment operation process, whereby the deployer shares the generated controllable chameleon hash ciphertext set CCHS1 and contract number Cid for subsequent updaters to download, includes:

[0014] The specific process of contract deployment is as follows: the deployer first defines an access policy A and calculates the chameleon hash value based on the relevant data of the contract. The relevant data refers to the deployer's account address and account transaction number, and then generates a variable parameter r a , execute the CCH.HaskP function operation to generate the controllable chameleon hash ciphertext set CCHS1, convert the chameleon hash value in CCHS1 into a contract address, and send a contract deployment transaction to the blockchain. After the blockchain consensus, a new contract account is created. At this time, the contract is deployed on the chain. Subsequently, the deployer shares the generated controllable chameleon hash ciphertext set CCHS1 and the contract number Cid for subsequent updaters to download.

[0015] Preferably, the trusted execution environment uploads the encrypted updater identity and an encrypted trusted execution environment identity To the authentication node of the blockchain, the authentication node verifies and returns the verification result to the updater and the trusted execution environment; the deployer sends the environment attributes encrypted by the public key pk1 to the trusted execution environment, and the updater sends the subject attributes, identity attributes and its own public key pk3 encrypted by the public key pk1 to the trusted execution environment; the trusted execution environment decrypts the specific value of the attribute using its own private key sk1, generates the attribute key ak, and encrypts the attribute key ak using the updater's public key pk3 and sends it to the updater. The method includes three steps: identity authentication, uploading attributes and generating attribute keys,

[0016] During the authentication process, an updater sends a contract update request to the trusted execution environment, attaching a contract number Cid and the public key pk of the authentication node. v Encrypted identity Trusted execution environment uploads encrypted updater identity and an encrypted trusted execution environment identity Go to the authentication node of the blockchain. The authentication node decrypts the updater's identity Uid3 and the trusted execution environment's identity Uid1, calls the authentication contract on the chain to perform a hash match of the identities, and returns the verification result to the updater and the trusted execution environment. If the verification passes, subsequent operations can be performed.

[0017] During the attribute upload process, the trusted execution environment sends a contract update request to the deployer, along with a contract number Cid. After receiving the request, the deployer sends the environment attributes encrypted with the public key pk1 to the trusted execution environment. The updater sends the subject attributes, identity attributes, and its own public key pk3 encrypted with the public key pk1 to the trusted execution environment.

[0018] During the attribute key calculation process, the trusted execution environment decrypts the specific value of the attribute using its own private key sk1, executes the CCH.KeyGen function to generate the attribute key ak, and encrypts the attribute key ak using the updater's public key pk3 and sends it to the updater.

[0019] Preferably, the updater retrieves the controllable chameleon hash ciphertext set CCHS1 of the contract to be updated from the shared directory according to the contract number Cid, and executes the CCH.HashCol function operation to generate a collision parameter r b ; The updater passes the collision parameter r b , the new contract data msg2 and the controllable chameleon hash ciphertext set CCHS1 are sent to the trusted execution environment to execute the CCH.Ver function on r b The validity of the contract is verified; the updater executes the contract update operation process to update the contract, and shares the controllable chameleon hash ciphertext set CCHS2 and the contract number Cid after the updated strategy. The method includes three steps: decrypting the ciphertext, verifying the parameters and updating the contract.

[0020] In the process of decrypting the ciphertext, the updater retrieves the controllable chameleon hash ciphertext set CCHS1 of the contract to be updated from the shared directory according to the contract number Cid, inputs the system public key pk, the relevant data msg2 of the new contract and the attribute key ak decrypted by its own private key sk3, and executes the CCH.HashCol function operation to generate a collision parameter r b ;

[0021] In the process of verifying parameters, in order to verify the correctness of the calculation result of the CCH.HashCol function, the contract updater will pass the collision parameter r b , the new contract data msg2 and the controllable chameleon hash ciphertext set CCHS1 are sent to the trusted execution environment to execute the CCH.Ver function on r bVerify, if the output result is 1, it means the calculated collision parameter r b Correct; otherwise output 0;

[0022] During the contract update process, the updater executes the contract update operation process to update the contract. The contract update operation process requires two steps of calculation: first, it executes the CCH.HashP function to calculate the new contract address and update the policy. The contract address is based on the collision parameter r b and the new contract data msg2, and generates a new controllable chameleon hash ciphertext set CCHS2, which contains the new contract update strategy. The updater sends a contract update transaction to the blockchain, and the transaction records the collision parameter r required for calculation in the blockchain operating environment. b After consensus, the new contract is deployed on the chain, and the updater shares the controllable chameleon hash set CCHS2 and the contract number Cid after the updated strategy.

[0023] Preferably, the CCH.Setup function is specifically: CCH.Setup(λ)→(pk,mk,CCS,Cid): input security parameter λ, output system public key pk, master key mk, controllable trapdoor set CCS and contract number Cid, including:

[0024] First, a security parameter λ is received, which is used to determine the security level of the algorithm; then, a random vector array val is initialized to calculate the elliptic curve array including partInt, partG1, partG2, and partGT, and then the chameleon public parameter pp, the chameleon public key hk, and the trapdoor tk are obtained. PartG2, partGT, and pp and hk form the system public key pk, and a symmetric key key is generated by the trapdoor key initialization vector. The trapdoor tk is encrypted to myEnc to protect the security of the trapdoor. Then, partInt and partG1 are combined to form the master key mk, and the elliptic group element information and the trapdoor key initialization vector are combined to form the decryption check factor, and the access control policy matrix A is obtained. in , the trapdoor ciphertext myEnc, and the decryption check factor together form the controllable trapdoor set CCS.

[0025] Preferably, the CCH.HashP function is specifically: CCH.HashP(A, pk, CCS (or CCHS), msg1 (or msg2), r a (or r b ))→(CCHS), including:

[0026] When the contract deployer deploys the contract, the function is expressed as: CCH.HashP(A,pk,CCS,msg1,ra )→(CCHS), first determine the access control policy matrix A in the controllable trapdoor set CCS in Is it empty? If it is empty, the access control policy A is converted to A in , update the controllable trapdoor set CCS. Similarly, if the access control policy matrix A in the controllable trapdoor set CCS in If it is not empty, then A in Convert and compare with A to see if they are equal. If they are equal, the controllable trapdoor set CCS does not change. If they are not equal, update A in CCS. in Then, using the variable parameter r a , pk and message msg1 calculate the chameleon hash value chamHash, output the controllable chameleon hash ciphertext set CCHS{CCS,chamHash}, when the contract updater updates the contract, the function is expressed as CCH.HashP(A,pk,CCHS1,msg2,r b )→(CCHS2), first extract A from the controllable trapdoor set CCS in CCHS1 in , and compare it with A. Other operations are the same as the above process.

[0027] Preferably, the CCH.HashCol function is specifically: CCH.HashCol(CCHS,pk,a,msg2)→(r b ), input the controllable chameleon hash ciphertext set CCHS, the algorithm public key pk, the attribute key ak and a new message msg2, and output a collision parameter r b ,include:

[0028] First, the access control policy matrix is ​​filtered according to the user's attribute S to obtain the effective matrix matForKey. The effective matrix matForKey and the decryption check factor in the controllable trapdoor set CCS in the controllable chameleon hash ciphertext set CCHS are used to recover the symmetric key key through a series of calculations. The decryption key key is used to decrypt the ciphertext to obtain the trapdoor tk. Finally, the collision parameter r is obtained through hash collision. b . BRIEF DESCRIPTION OF THE DRAWINGS

[0029] The following is an introduction to the drawings used in the embodiments of this application.

[0030] Figure 1 This is an architectural diagram of the controllable update method for smart contracts;

[0031] Figure 2 This is the CCH.Setup algorithm flow chart;

[0032] Figure 3 This is the flow chart of the CCH.HashP algorithm;

[0033] Figure 4 This is the flow chart of the CCH.HashCol algorithm;

[0034] Figure 5 Deploy and update operational workflow diagrams for smart contracts;

[0035] Figure 6 Create an operational workflow diagram for the smart contract account;

[0036] Figure 7 This is an example diagram of the process of system initialization phase;

[0037] Figure 8 This is an example diagram of the smart contract deployment process;

[0038] Figure 9 An example diagram of the attribute key generation phase process;

[0039] Figure 10 This is an example diagram of the smart contract update process;

[0040] Figure 11 Flowchart of the controllable update method for smart contracts. DETAILED DESCRIPTION

[0041] The following describes the embodiments of the present application in conjunction with the accompanying drawings. The terms used in the implementation methods of the embodiments of the present application are only used to explain the specific embodiments of the present application and are not intended to limit the present application.

[0042] In order to overcome the defects of existing update methods, the present invention proposes a controllable update method for blockchain smart contracts, which implements the "hard update" of smart contracts through a controllable chameleon hash function, ensuring the consistency of addresses before and after the contract update, reducing the cost of smart contract call management, and enhancing the stability of contract calls.

[0043] The controllable update method of the blockchain smart contract proposed by the present invention is as follows Figure 1 As shown, it includes the following four steps: system initialization, contract deployment, attribute key generation, and contract update.

[0044] 1) System initialization. First, each participant i (user and trusted execution environment) in the system generates a public-private key pair pk i ,sk i , used for encrypted transmission of data during communication, the authentication node on the blockchain initializes the public-private key pair pk v ,sk v At the same time, each participant i will be reviewed offline by all blockchain participants during the initialization phase to obtain a unique identity identifier Uid. i(①), each user saves it by himself, and the blockchain will also store the hash value of these identity identifiers for users to verify their identity. Only users who have passed the review, that is, users with identity identifiers, can participate in the deployment and update operations of smart contracts. The system will designate a consensus node of the blockchain to participate in the verification and generate the corresponding public and private keys, which is called the authentication node. This node will rotate periodically among the blockchain nodes to deal with single point attacks or failures, reducing untrustworthy and security risks. The authentication node will use its own public key pk v Sent to all participants (②). Here, the characteristic of a trusted execution environment is that the computing process is not interfered with by the outside world and it provides an independent processing environment with security and integrity protection, usually implemented by hardware.

[0045] 2) Contract deployment. When the deployer needs to deploy a contract, he must first send a contract deployment request to the trusted execution environment and send the public key pk of the authentication node. v Encrypted identity (③). Then, the trusted execution environment will use the encrypted identity of the deployer and your own encrypted identity Upload to the authentication node (④) of the blockchain. The authentication node uses the private key sk vDecrypt the deployer's identity Uid2 and the trusted execution environment's identity Uid1 (⑤). The authentication node calls the authentication contract on the chain, hashes the identity, and then matches the result with the hash value stored on the blockchain (⑥). The authentication contract returns the verification result to the authentication node, which then sends the verification result to the deployer and the trusted execution environment (⑦). In the trusted execution environment, the system public key pk, master key mk, contract number Cid, and chameleon trapdoor key tk are initialized and generated. The trapdoor key tk is encrypted to generate a controllable trapdoor set CCS. The contract number Cid and the controllable trapdoor set CCS are one-to-one corresponding (⑧). Then, the trusted execution environment shares its own public key pk1, the public key pk of the controllable chameleon hash algorithm, and the contract number Cid with all users, and shares the controllable trapdoor set CCS with the deployer (⑨). The deployer is responsible for deploying the contract to the blockchain. Here, the smart contract of the blockchain is deployed and updated based on the controllable chameleon hash function. At the same time, the deployer will define the contract update policy. Only users who meet the policy can perform the contract update operation. The policy here involves three attributes, namely the main attributes of the new contract (contract type, whether to modify the data module identifier, whether to modify the business logic module identifier), the identity attributes of the updater (role type, account address), and the environment attributes of the old contract (whether the deployer allows the update identifier, and whether the current contract is within the updateable time range). At the same time, the three attributes are required to satisfy the logical and relationship, that is, the three attributes must be established at the same time. The deployer will integrate the strategy and the chameleon hash value calculated based on the relevant data msg1 (deployer's account address and account transaction number) of the deployed contract into the controllable trapdoor set CCS mentioned above to form a new controllable chameleon hash ciphertext set CCHS1 (⑩). The deployer will then share the controllable chameleon hash ciphertext set CCHS1 and the contract number Cid for access by the contract updater.

[0046] 3) Attribute key generation. The updater initiates a contract update request to the trusted execution environment and passes in the contract number Cid of the contract to be updated and the public key pk of the authentication node of the blockchain. v Encrypted identity After receiving the contract update request, the trusted execution environment will encrypt the updater's identity and your own encrypted identity Upload to the authentication node of the blockchain The authentication node passes the private key sk v Decrypt the updater's identity Uid3 and the trusted execution environment's identity Uid1 The authentication node calls the authentication contract on the chain, hashes the identity, and then matches the result with the hash value stored on the blockchain. The authentication contract returns the verification result to the authentication node, which then sends the verification result to the updater and the trusted execution environment. If the authentication is successful, the trusted execution environment sends the contract number Cid to the deployer Next, the updater uploads his public key pk3, the updater's identity attributes (role type, account address), and the main attributes of the new contract (contract type, whether to modify the data module identifier, whether to modify the business logic module identifier) ​​to the trusted execution environment. At the same time, in order to make the old contract meet the updateable state, the deployer needs to upload the environment attributes (whether the deployer allows the update identifier, whether the current contract is within the updateable time range identifier) ​​to the trusted execution environment. These attribute values ​​are asymmetrically encrypted using the public key pk1 of the trusted execution environment during the transmission process. The trusted execution environment uses the private key sk1 to decrypt the attribute value And generate an attribute key ak based on these attributes The trusted execution environment encrypts the attribute key ak and transmits it to the updater through the updater's public key pk3.

[0047] 4) Contract update. The updater searches the shared directory for the corresponding controllable chameleon hash set CCHS1 based on the contract number Cid and downloads it. The updater decrypts the attribute key ak using the private key sk3 Since the corresponding policy is defined in the ciphertext, the updater can try to decrypt the controllable chameleon hash ciphertext set CCHS1 through the attribute key ak. If the identity attribute of the updater, the subject attribute of the new contract, and the environment attribute of the old contract meet the requirements of the policy, it means that the updater has the authority to update the contract and can decrypt it. The collision parameter r is calculated based on the hash collision of the new contract data msg2 (the updater's account address and account transaction sequence number). b , otherwise, the updater does not have the authority to update the contract To enhance the credibility of the trapdoor, the updater can choose to set the collision parameter r b Encrypt the new contract-related data msg2 and attach the controllable chameleon hash ciphertext set CCHS1 to transmit it to the trusted execution environment The trusted execution environment decrypts the collision parameter r b Verify with related data msg2 And return the verification result to the updater If the verification is successful, the updater is based on the collision parameter r bNew contracts can be deployed on the chain to implement "hard updates" of contracts and update the contract update strategy Of course, the updater can also use the collision parameter r b Directly perform the contract update operation. Finally, the updater shares the new controllable chameleon hash set CCHS2 and the contract number Cid

[0048] Chameleon hashing is a special type of cryptographic hash function with two important characteristics: ① Under normal circumstances, it maps arbitrary-length inputs to fixed-length outputs, just like traditional hash functions. ② In the presence of a trapdoor, it allows the output hash result to remain unchanged by changing the input data. CP-ABE is an attribute-based encryption technique that allows attribute-based access control to data. Encrypted data is attached to a decryption policy that defines which attribute combinations can decrypt the ciphertext. A user can decrypt and access the data only if their attribute set satisfies this policy.

[0049] This paper proposes a controllable chameleon hash function (CCH) for contract updates. This function integrates the chameleon hash function and CP-ABE. The chameleon hash function's trapdoor is encrypted using a key generated by the CP-ABE algorithm. Only users who meet the policy definition can decrypt it, thereby obtaining the trapdoor for contract updates and completing the contract update. The following is a detailed description of the CCH calculation.

[0050] CCH.Setup(λ)→(pk,mk,CCS,Cid): Input security parameter λ, output system public key pk, master key mk, controllable trapdoor set CCS and contract number Cid. Through this operation, CP-ABE and Chameleon hash calculation share the same public key pk, which can encrypt the trapdoor tk and combine the results to form a controllable trapdoor set CCS, thus enhancing the security of the trapdoor. CCS consists of three parts: access control policy matrix A in (generated by access control policy conversion), trapdoor ciphertext myEnc and decryption check factor. Access control policy represents the contract update strategy, which consists of the old contract environment attribute, the updater identity attribute and the new contract subject attribute. in It is empty and does not carry any policy. At the same time, a self-incrementing number can be generated to identify the contract, namely Cid. Cid is unique and matches the controllable trapdoor set CCS. The specific implementation steps of this operation are as follows Figure 2As shown, first a security parameter λ is received, which is used to determine the security level of the algorithm (the security level is determined according to the size of the key parameter). Next, a random vector array val is initialized to calculate the elliptic curve array including partInt, partG1, partG2, and partGT. Subsequently, the chameleon public parameter pp, the chameleon public key hk, and the trapdoor tk are obtained by calculation. These parameters are the basis for the operation of the chameleon hash function. partG2, partGT, pp, and hk form the system public key pk of the algorithm. Then a symmetric key key is generated through the trapdoor key initialization vector, and the trapdoor tk is encrypted to myEnc to protect the security of the trapdoor. Furthermore, partInt and partG1 are combined to form the master key mk, and the elliptic group element information (used for decryption verification attributes) and the trapdoor key initialization vector are combined to form the decryption check factor. Access control policy matrix A in , the trapdoor ciphertext myEnc, and the decryption check factor together form the controllable trapdoor set CCS.

[0051] CCH.HashP(A,pk,CCS(or CCHS),msg1(or msg2),r a (or r b ))→(CCHS): This operation can be applied in two scenarios. The first is when the contract deployer deploys the contract. The operation is CCH.HashP(A,pk,CCS,msg1,r a )→(CCHS). Among them, the access strategy is A, the account address and account transaction sequence number of the message msg1 deployer, and the variable parameter r a , plus the system public key pk, the controllable trapdoor set CCS, can generate the controllable chameleon hash ciphertext set CCHS, which can be processed and the contract address can be derived in CCHS. The CCHS here not only includes the chameleon hash value, but also incorporates policy control factors. Therefore, this scenario can be summarized as follows: when the input is the controllable trapdoor set CCS, the operation can be regarded as a policy definition. The controllable chameleon hash ciphertext set CCHS adds the policy definition part on the basis of the controllable trapdoor set CCS and appends the chameleon hash value. The second is used when the contract updater updates the contract. The operation is CCH.HashP(A,pk,CCHS1,msg2,r b )→(CCHS2), at this time, access policy A is the policy for updating the old contract, message msg2 is the account address and account transaction number of the updater, r bIt is obtained by the CCH.HashCol operation (see below), and combined with the system public key pk, the original controllable chameleon hash ciphertext set CCHS1 can generate a new controllable chameleon hash ciphertext set CCHS2. Compared with CCHS1, CCHS2 incorporates the new policy. This type of scenario can be summarized as follows: when the input is the controllable chameleon hash ciphertext set CCHS1, the operation can be regarded as a policy update, generating a controllable chameleon hash ciphertext set CCHS2 containing the new policy. This operation incorporates policy information on the basis of the traditional chameleon hash value, reflecting the controllable characteristics of the chameleon hash calculation. The specific implementation steps are as follows: Figure 3 As shown, for the first type of scenario, Figure 3 As shown, first determine the access control policy matrix A in the controllable trapdoor set CCS in Is it empty? If it is empty (which is a common case), then the access control policy A is converted to A in , update the controllable trapdoor set CCS. Similarly, if the access control policy matrix A in the controllable trapdoor set CCS in If it is not empty, then A in Convert and compare with A to see if they are equal. If they are equal, the controllable trapdoor set CCS does not change. If they are not equal, then update A in CCS in the same way. in Then, using the variable parameter r a , pk and message msg1 to calculate the chameleon hash value chamHash. Finally, the controllable chameleon hash ciphertext set CCHS{CCS,chamHash} is output. For the second scenario, first extract A in the controllable trapdoor set CCS in CCHS1. in , and compare it with A, and other operations are the same as before.

[0052] CCH.KeyGen(mk, S)→(ak): Inputs the master key mk and a set of attributes S (in this case, the subject attributes, environment attributes, and identity attributes are concatenated together to form a set of attributes S), and outputs an attribute key ak. This operation is similar to CP-ABE.KeyGen, generating the corresponding attribute key ak from the attributes S for subsequent decryption operations.

[0053] CCH.HashCol(CCHS,pk,ak,msg2)→(r b ): Input the controllable chameleon hash ciphertext set CCHS, the system public key pk, the attribute key ak and a new message msg2, and output a collision parameter r b This operation realizes the fusion of trapdoor decryption and chameleon hash collision. The trapdoor tk is only used within the program and directly performs subsequent hash collision calculations. The trapdoor will not be directly exposed to the updater. After the updater successfully decrypts, it can generate the collision parameter r through the trapdoor tk.b The specific steps for this operation are as follows: Figure 4 As shown in Figure 1, the algorithm first filters the access control policy matrix based on the user's attributes S to obtain the effective matrix matForKey (composed of rectangular rows related to the user's attributes). Using the effective matrix matForKey and the decryption check factors in the controllable trapdoor set CCS in the controllable Chameleon hash ciphertext set CCHS, the symmetric key key is recovered through a series of calculations. The decryption key key is used to decrypt the ciphertext to obtain the trapdoor tk. Finally, the collision parameter r is obtained through hash collision. b .

[0054] CCH.Ver(pk,CCHS,msg2,r b )→{0 / 1}: Input the system public key pk, the controllable chameleon hash ciphertext set CCHS, the new message msg2 and the collision parameter r b , verify the collision parameter r b If it is valid, it outputs 1, otherwise it outputs 0. This operation first parses the chameleon hash value from the controllable chameleon hash ciphertext set CCHS. The rest is similar to CH.Ver and is used to verify the collision parameter r generated by CCH.HashCol. b correctness.

[0055] In order to use the controllable Chameleon hash algorithm on the blockchain and thus realize the “hard update” of the smart contract, the present invention modifies the structure of the blockchain, which is described in detail as follows.

[0056] Transaction is the basic unit used by blockchain network to interact with smart contracts. Each transaction is recorded in a block and propagated throughout the network. When a user initiates a contract update request, it needs to be updated according to the collision parameter r. b Calculate the chameleon hash value and obtain the contract address. In order to pass this parameter to the computing engine responsible for executing the smart contract in the blockchain (located in the blockchain operating environment), the present invention proposes a new blockchain transaction structure, that is, by adding a field to record the collision parameter r b The value of .

[0057] In order to enhance the convenience of users or developers interacting with smart contracts, the present invention designs a blockchain contract deployment operation process to adapt it to the smart contract update method proposed in the present invention. In addition, the present invention also designs a contract update operation process to enable users to submit contract update requests and perform contract update operations. The implementation of the contract deployment operation process and the contract update operation process is as follows: Figure 5 As shown in the figure, the original contract deployment operation process has been modified as follows:

[0058] 1. Parameter adjustment: Add the system public key pk and related data msg1 (deployer's account address and account transaction number) to the input parameters to calculate the Chameleon hash value, and add the access policy A to the parameters. The contract deployment operation process can implement the definition of the decryption policy, and the contract update operation process can implement the update of the decryption policy. In addition, the contract update operation process adds a collision parameter r b To calculate the chameleon hash value generated by the collision, and then obtain the address of the smart contract through the chameleon hash value.

[0059] 2. Chameleon hash calculation: The blockchain hash calculation is performed using the Chameleon hash function instead of the traditional hash operation. The contract address will be calculated based on the Chameleon hash value (for example, the last certain digits of the Chameleon hash value are assigned to the contract address).

[0060] 3. Submit transaction: When submitting a contract deployment transaction, the collision parameter r b Set to empty because no hash collision calculation is required. Instead, when submitting a contract update transaction, the collision parameter r calculated by the hash collision is used. b The value of is recorded into the transaction structure. Then according to the collision parameter r b The contract address is calculated in the blockchain operating environment.

[0061] For smart contract deployment, the blockchain operating environment creates a contract account, which in turn initiates the creation of the smart contract. This invention designs the execution logic of the contract account creation operation in the blockchain operating environment to support the contract update method based on the controllable chameleon hash function. The execution process is as follows: Figure 6 As shown. The operation process first adjusts the collision parameter r of the transaction during the deployment process. b Make a judgment.

[0062] 1. If the collision parameter r b If the value is empty, the system will identify the transaction as a new contract deployment request initiated by the contract deployer. In this case, the CCH.HashP algorithm will be used to obtain the Chameleon hash value based on the parameters of the contract deployment transaction, and then a new contract address will be calculated.

[0063] 2. On the contrary, if the collision parameter r b If it is not empty, it means that the updater has initiated a contract update request. In this case, the CCH.HashP algorithm will be used in combination with the collision parameter r b , using the Chameleon hash function to ensure that the calculated contract address is consistent with the contract address before the update.

[0064] The blockchain operating environment maintains the uniqueness of the contract address through the contract account creation operation, ensuring that each contract has a unique contract address to prevent conflicts. In order to implement the contract update method proposed in this invention and support the consistency of the contract address before and after the update, this invention proposes a smart contract address conflict check strategy. If there is no contract at the target address, it means that the contract can be deployed to the address; if it is detected that a contract already exists at the target address and the collision parameter r b If it is empty, it means that a new contract is being deployed and the new contract attempts to use an already occupied address, resulting in an address conflict. In this case, the system will throw an exception and prevent the address from being occupied by the new contract to avoid potential conflicts and security risks. If it is detected that a contract already exists at the target address and the collision parameter r b If it is not empty, it means that the contract updater requests to update this contract. At this time, the blockchain operating environment will perform the following steps:

[0065] 1. Mark the old smart contract as destroyed to ensure that it no longer participates in any calls on the network.

[0066] 2. Deploy the new version of the smart contract to the original contract address to complete the contract update.

[0067] Beneficial effects of the present invention:

[0068] 1) Design a new algorithm: Controllable Chameleon Hash Function (CCH), which integrates chameleon hash with control strategy to realize a secure and controllable chameleon hash update method.

[0069] 2) A "hard update" method for smart contracts is proposed. This method ensures the consistency of contract update addresses, removes redundant contracts, reduces management costs and security risks, and helps promote the improvement of blockchain smart contract engineering systems.

[0070] 3) A smart contract update process is designed, which controls the contract update based on the access strategy of the controllable chameleon hash function to ensure the credibility of the update process.

[0071] The following describes the processes of each stage of the present invention in detail with reference to the accompanying drawings, and those skilled in the art will better understand the above and other objects, advantages and features of the present invention.

[0072] The controlled update method for blockchain smart contracts involves four main components: the blockchain, the deployer, and the updater. The blockchain deploys an authentication contract, allowing users to perform hash calculations and compare them with the hash values ​​on the blockchain. A node in the blockchain is selected to serve as the authentication node, responsible for generating public and private keys, receiving authentication information, decrypting it, and sending it to the authentication contract for verification. The deployer can deploy smart contracts to the blockchain and define related update policies, while the updater can update the contract. The trusted execution environment utilizes hardware-based security technology and can perform certain trusted computations within it.

[0073] The overall operation of this method is divided into four stages: system initialization, contract deployment, attribute key generation and contract update. Figure 11 . During the system initialization phase, the blockchain stores the hash value of the participant's identity for identity authentication. The participants and authentication nodes generate public and private keys for secure transmission. During the contract deployment phase, the deployer and the trusted execution environment perform identity authentication, and then the trusted execution environment generates relevant parameters and shares them with all users and deployers according to needs. The deployer executes the contract deployment operation process and shares relevant data. During the attribute key generation phase, the updater and the trusted execution environment perform identity authentication, and then the deployer and updater send encrypted relevant attributes to the trusted execution environment. The trusted execution environment generates an attribute key and encrypts it and sends it to the updater. During the contract update phase, the updater obtains the controllable chameleon hash ciphertext set, generates relevant parameters, verifies them, executes the contract update operation process, and shares relevant data. The specific process is further described as:

[0074] 1) System initialization. The system initialization phase is as follows Figure 7 As shown in Figure 1, it includes one step, namely user and node parameter initialization. First, the participant i in the system (user and trusted execution environment) generates a public-private key pair pk locally. i ,sk i During the initialization phase, each participant i will be jointly reviewed offline by all blockchain participants to obtain a unique identity identifier Uid. i . Among them pk i It can be disclosed to other participants, thus realizing the encrypted transmission of data. i and Uid i The authentication node of the blockchain will initialize and generate the public-private key pair pk v ,sk v , and the public key pk v Sent to all participants.

[0075] 2) Contract deployment. The contract deployment phase is as follows Figure 8As shown, it includes three steps, namely identity authentication, system parameter initialization and contract deployment. During the identity authentication process, the deployer first sends a contract deployment request and sends the identity identifier Uid i Pass the public key pk of the authentication node v Encrypted and transmitted to the trusted execution environment. The trusted execution environment uploads the encrypted deployer identity and an encrypted trusted execution environment identity The authentication node on the blockchain decrypts the deployer's identity, Uid2, and the trusted execution environment's identity, Uid1. It then calls the on-chain authentication contract to perform a hash match of the identities. The authentication node then returns the verification result to the deployer and the trusted execution environment. If verification passes, subsequent operations can proceed.

[0076] During system initialization, the CCH.Setup function is executed by the Trusted Execution Environment (TEE), generating the system public key pk, master key mk, contract number Cid, and a controllable trapdoor set CCS containing the encrypted Chameleon trapdoor tk. The TEE shares the system public key pk and contract number Cid with all users and the controllable trapdoor set CCS with the deployer.

[0077] During the contract deployment process, the deployer is responsible for executing the contract deployment operation process to deploy the smart contract on the blockchain. The deployer must first define an access policy A and calculate the chameleon hash value based on the relevant data of the contract, which refers to the deployer's account address and account transaction sequence number. Then, the variable parameter r is generated. a , executes the CCH.HashP function to generate the controllable chameleon hash set CCHS1. The chameleon hash value in CCHS1 is converted into a contract address, and a contract deployment transaction is sent to the blockchain. After blockchain consensus, a new contract account is created, and the contract is deployed on the chain. The deployer then shares the generated controllable chameleon hash set CCHS1 and the contract number Cid for subsequent download by updaters.

[0078] 3) Attribute key generation. The attribute key generation stage is as follows Figure 9 As shown, this phase consists of three steps: authentication, uploading attributes, and attribute key generation.

[0079] During the authentication process, an updater sends a contract update request to the trusted execution environment, attaching a contract number Cid and the public key pk of the authentication node. v Encrypted identity Trusted execution environment uploads encrypted updater identity and an encrypted trusted execution environment identity The authentication node decrypts the updater's identity, Uid3, and the trusted execution environment's identity, Uid1. It then calls the authentication contract on the blockchain to perform a hash match. The authentication node then returns the verification result to the updater and the trusted execution environment. If verification passes, subsequent operations can proceed.

[0080] During the attribute upload process, the TEE sends a contract update request to the deployer, along with a contract ID (Cid). Upon receiving the request, the deployer sends the environment attributes encrypted with public key pk1 to the TEE. The updater then sends the subject attributes, identity attributes, and its own public key (pk3), encrypted with public key pk1.

[0081] During the attribute key calculation process, the trusted execution environment decrypts the specific value of the attribute using its own private key sk1. It then executes the CCH.KeyGen function to generate the attribute key ak, which is then encrypted using the updater's public key pk3 and sent to the updater.

[0082] 4) Contract update. The contract update stage is as follows Figure 10 As shown in Figure 1, the process consists of three steps: decrypting ciphertext, verifying parameters, and contract updating. During the decryption process, the updater retrieves the controllable chameleon hash ciphertext set CCHS1 of the contract to be updated from the shared directory based on the contract number Cid, inputs the system public key pk, the relevant data msg2 of the new contract, and the attribute key ak decrypted using its own private key sk3, and executes CCH.HashCol to generate a collision parameter r. b .

[0083] In the process of verifying parameters, in order to verify the correctness of the CCH.HashCol calculation result, the contract updater will pass the collision parameter r b , the new contract data msg2 and the controllable chameleon hash ciphertext set CCHS1 are sent to the trusted execution environment to execute CCH.Ver on r b Verify. If the output is 1, it means the calculated collision parameter r b True; otherwise, output 0.

[0084] During the contract update process, the updater executes the contract update operation process to update the contract. This operation process requires two steps of calculation: First, it executes the CCH.HashP function to calculate the new contract address and update the policy. The contract address is based on the collision parameter r band the new contract data msg2, and generates a new controllable chameleon hash set CCHS2, which contains the new contract update strategy. The updater sends a contract update transaction to the blockchain, which records the collision parameter r required for calculation in the blockchain operating environment. b After consensus is reached, the new contract is deployed to the chain, and the contract "hard update" is completed. Finally, the updater shares the controllable chameleon hash set CCHS2 and the contract number Cid after the updated strategy.

[0085] In the above embodiments, all or part of the functions can be implemented by software, hardware, or a combination of software and hardware. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrations. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).

[0086] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present invention should be included in the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.

Claims

1. A controllable update method for blockchain smart contracts, characterized in that: include: System initialization: Each participant in the system Generate a public-private key pair , , used for encrypted transmission of data during communication, and initialization of public and private key pairs by the authentication node of the blockchain , , each participant During the initialization phase, a unique identity identifier is obtained through offline review by blockchain participants. ; Participants save it themselves and ; These identities will be stored on the blockchain The hash value of The authentication node will send its public key Sent to all participants; Contract deployment: The trusted execution environment encrypts the deployer's identity and your own encrypted identity The authentication node uploaded to the blockchain will verify and return the verification result to the deployer and the trusted execution environment; the trusted execution environment executes Function operation, generate system public key 𝑝𝑘, master key 𝑚𝑘, contract number and encrypted Chameleon trapdoors Controllable trapdoor set ; The trusted execution environment will use its own public key , controllable public key 𝑝𝑘 and contract number Shared with all users, and the controllable trapdoor set Shared with the deployer; execute the contract deployment operation process, and then the deployer will generate a controllable chameleon hash set and contract number Share it for subsequent updaters to download; Attribute key generation: Trusted execution environment uploads encrypted updater identity and an encrypted trusted execution environment identity To the authentication node of the blockchain, the authentication node verifies and returns the verification result to the updater and the trusted execution environment; the deployer sends the public key to the trusted execution environment Encrypted environment attributes, the updater sends to the trusted execution environment through the public key Encrypted subject attributes, identity attributes, and own public key ; Trusted Execution Environment through its own private key Decrypt the specific value of the attribute and generate the attribute key , and pass the public key of the updater The attribute key Encrypted and sent to the updater; Contract update: The updater updates the contract according to the contract number. Retrieve the controllable Chameleon hash set from the shared directory to update the contract ,implement Function operation, generating a collision parameter ; The updater passes the collision parameter , new contract data and controllable chameleon hash ciphertext collection Sent to the Trusted Execution Environment for execution Function pair Verify; the updater executes the contract update operation process to update the contract, and updates the controllable chameleon hash ciphertext set after the updated strategy and contract number to share.

2. The method according to claim 1, wherein: The trusted execution environment will use the encrypted identity of the deployer and your own encrypted identity The authentication node uploaded to the blockchain performs verification and returns the verification results to the deployer and the trusted execution environment, including: The deployer first sends a contract deployment request to the trusted execution environment and identifies the Pass the public key of the authenticated node Encrypted transmission to the trusted execution environment, which uploads the encrypted deployer identity and an encrypted trusted execution environment identity To the authentication node of the blockchain, the authentication node decrypts the deployer's identity and the identity of the trusted execution environment , the authentication contract on the call chain is used to match the hash value of the identity. The authentication node returns the verification result to the deployer and the trusted execution environment. If the verification passes, subsequent operations can be performed.

3. The method according to claim 1, wherein: The execution contract deployment operation process, and then the deployer will generate a controllable chameleon hash ciphertext set and contract number Shared for subsequent updaters to download include: The specific contract deployment operation process is as follows: the deployer must first define an access policy , and calculate the chameleon hash value based on the relevant data of the contract, which refers to the deployer's account address and account transaction sequence number, and then generate variable parameters ,implement Function operation generates a controllable chameleon hash ciphertext set , take the The chameleon hash value in the contract address is converted into a contract address, and a contract deployment transaction is sent to the blockchain. After the blockchain consensus, a new contract account is created. At this time, the contract is deployed on the chain. Subsequently, the deployer generates a controllable chameleon hash ciphertext set. and contract number Share it for subsequent updaters to download.

4. The method according to claim 1, wherein: The trusted execution environment uploads the encrypted updater identity and an encrypted trusted execution environment identity To the authentication node of the blockchain, the authentication node verifies and returns the verification result to the updater and the trusted execution environment; the deployer sends the public key to the trusted execution environment Encrypted environment attributes, the updater sends to the trusted execution environment through the public key Encrypted subject attributes, identity attributes, and own public key ; Trusted Execution Environment through its own private key Decrypt the specific value of the attribute and generate the attribute key , and pass the public key of the updater The attribute key The encrypted data is sent to the updater. The method includes three steps: identity authentication, uploading attributes and attribute key generation. During the authentication process, an updater sends a contract update request to the trusted execution environment and attaches a contract number. and the public key of the authenticated node Encrypted identity , the trusted execution environment uploads the encrypted updater identity and an encrypted trusted execution environment identity To the authentication node of the blockchain, the authentication node decrypts the identity of the updater and trusted execution environment identity , calling the authentication contract on the chain to perform identity hash matching, the authentication node returns the verification result to the updater and the trusted execution environment. If the verification passes, subsequent operations can be performed; During the property upload process, the trusted execution environment sends a contract update request to the deployer, appending a contract number. After receiving the request, the deployer sends the public key to the trusted execution environment Encrypted environment attributes, the updater sends to the trusted execution environment through the public key Encrypted subject attributes, identity attributes, and own public key ; During the attribute key calculation process, the trusted execution environment uses its own private key Decrypt the specific value of the attribute and execute Function to generate attribute keys , and pass the public key of the updater The attribute key Encrypted and sent to the updater.

5. The method according to claim 1, wherein: The updater is based on the contract number Retrieve the controllable Chameleon hash set from the shared directory to update the contract ,implement Function operation generates a collision parameter ; The updater passes the collision parameter , new contract data and controllable chameleon hash ciphertext collection Sent to the Trusted Execution Environment for execution Function pair Verify the effectiveness of The updater executes the contract update operation process to update the contract and updates the controllable chameleon hash ciphertext set after the updated strategy. and contract number The method includes three steps: decrypting ciphertext, verifying parameters and contract updating. In the process of decrypting the ciphertext, the updater uses the contract number Retrieve the controllable Chameleon hash set from the shared directory to update the contract , input the system public key 𝑝𝑘 and the relevant data of the new contract and using your own private key Decrypted attribute key , and execute Function operation generates a collision parameter ; In the process of verifying parameters, in order to verify The correctness of the function calculation result, the contract updater adds the collision parameter , New Contract Data and controllable chameleon hash ciphertext collection Sent to the Trusted Execution Environment for execution Function pair Verify, if the output result is 1, it means the calculated result collision parameter Correct; otherwise output 0; During the contract update process, the updater executes the contract update operation process to update the contract. The contract update operation process requires two steps of calculation: first, it executes The function calculates the new contract address based on the collision parameter and updates the policy. and new contract data Generated, and generate a new controllable chameleon hash ciphertext set , Contains a new contract update strategy. The updater sends a contract update transaction to the blockchain. The transaction records the collision parameters required for calculation in the blockchain operating environment. After consensus, the new contract is deployed to the chain, and the updater will update the controllable chameleon hash set after the strategy is updated. and contract number to share.

6. The method according to claim 1, wherein: described The function is specifically: :Input security parameter 𝜆, output system public key 𝑝𝑘, master key 𝑚𝑘, controllable trapdoor set and contract number ,include: First, receive a security parameter , the security parameters Used to determine the security level of the algorithm; then, initialize a random vector array , used to calculate including , , , The elliptic curve array is included, and then the Chameleon public parameters are obtained. , Chameleon public key and trapdoors , , as well as and Forming the system public key , generate a symmetric key by using the trapdoor key initialization vector , trap door Encrypted to To protect the safety of the trapdoor, and then, by , Combined to form the master key , the elliptic group element information and the trapdoor key initialization vector are combined to form the decryption check factor, the access control policy matrix , trapdoor ciphertext , and the decryption check factor together form a controllable trapdoor set .

7. The method according to claim 3, wherein: When the contract deployer deploys the contract, the function is expressed as: , first determine the controllable trapdoor set Access control policy matrix in Is it empty? If it is empty, the access control policy Convert to , update the controllable trapdoor set , similarly, if the controllable trapdoor set Access control policy matrix in If it is not empty, Convert and Compare to see if they are equal, if they are equal, control the trapdoor set No change, if not equal, update in , then, using variable parameters 、 and news Calculating Chameleon Hash Value , output controllable chameleon hash ciphertext set , when the contract updater updates the contract, the function is expressed as: , first extract Medium controllable trapdoor set in , and with Compare, other operations are the same as the above process.

8. The method according to claim 5, characterized in that: described The function is specifically: , input the controllable chameleon hash ciphertext set , algorithm public key , attribute key And a new message , output a collision parameter ,include: First, based on the attributes that the user has Filter the access control policy matrix to obtain the effective matrix , using the effective matrix and controllable chameleon hash ciphertext collection Medium controllable trapdoor set The decryption check factor in the symmetric key is recovered through a series of calculations , using the decryption key Decrypt the ciphertext to get the trapdoor , and finally get the collision parameter through hash collision .

Citation Information

Patent Citations

  • Intelligent contract dynamic deployment and evolution method and device based on blockchain

    CN110377609A

  • Block chain data updating method, device, equipment and system and readable storage medium

    CN111641496A