A data encryption signature verification method for Ethereum blockchain and related methods
By using data encryption signature verification method and SDK tools on the Ethereum blockchain, the security risks and inconvenience in writing and debugging in the deployment and call of smart contracts are solved, and a higher security and convenient development process is achieved.
Patent Information
- Application Number
- CN202310764693.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-27
- Publication Date
- 2025-06-17
- Estimated Expiration
- 2043-06-27
AI Technical Summary
In the existing technology, there are security risks in the deployment and call process of smart contracts, and the smart contract writing and debugging tools are not intelligent and convenient enough.
The data encryption signature verification method of the Ethereum blockchain is adopted, and the data is signed and decrypted through the collaborative work of the client and the server, and the data is signed and decrypted using encryption algorithms and real-time keys, and the writing and debugging process of smart contracts is simplified through SDK tools.
It improves the security of smart contracts, simplifies the writing and debugging process of smart contracts, and enhances the security and integrity of data.
Smart Images

Figure CN116707945B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of Ethereum blockchain, and more specifically, to a data encryption signature verification method and related methods for Ethereum blockchain. Background Art
[0002] In the existing blockchain technology, asymmetric encryption and digital signature technology are used to ensure the security and integrity of data. However, there are some problems and drawbacks in the deployment and invocation of smart contracts in the existing technology.
[0003] First of all, the digital signature and encryption verification in the existing technology are completed by the client, which results in the deployment and invocation of smart contracts being less secure. When the client uses the private key for digital signature, it is easily attacked or stolen by hackers, leading to certain risks in the invocation and deployment of contracts.
[0004] Secondly, the smart contract writing and debugging tools in the existing technology are relatively simple and not intelligent and convenient enough. When writing and debugging smart contracts, the Solidity programming language and development tools need to be used, which is difficult for non-professionals. Summary of the Invention
[0005] In view of this, the present invention provides a data encryption signature verification method and related methods for Ethereum blockchain, which can solve the problem of risks in the above digital signature and the problem of inconvenient writing and debugging of smart contracts.
[0006] To achieve the above object, the present invention adopts the following technical solutions:
[0007] In the first aspect, the present invention provides a data encryption signature verification method for Ethereum blockchain, including the following steps:
[0008] S1. Serialize and translate the smart contract deployment and / or invocation request into a hexadecimal command using ABI on the client, and encrypt the data to be transmitted using an encryption algorithm;
[0009] S2. Use the real-time key to extract the data signature of the encrypted data and the generated related information to obtain the data feature value, and send the encrypted data and the data signature to the server;
[0010] S3. Use the server real-time key and the generated related information to perform re-signature on the received encrypted data to extract the data feature value;
[0011] S4. Determine whether the data feature value extracted by the client is the same as the data feature value extracted by the server;
[0012] S5. When the judgment results are the same, the server uses a preset key to decrypt the received encrypted data; and deserializes the contract call information through the ABI service.
[0013] Further, it further includes:
[0014] S6. The deserialized information is formatted in the ABI fixed manner. If it does not meet the ABI regulations, content recognition cannot be performed and an exception is thrown to notify the supervision program for processing.
[0015] Further, the encryption algorithm is: AES mode CEB-Pkcs7 encryption algorithm.
[0016] Further, the generated relevant information includes:
[0017] The generated timestamp timestamp and the interference string nonce.
[0018] Further, it is judged whether the data feature values extracted by the client are the same as those extracted by the server; it includes:
[0019] Judging whether the four elements of the data feature values extracted by the client and the server: the key, the timestamp, the random interference string, and the ciphertext content, are consistent; and whether the timestamp is generated within the set time range.
[0020] Further, the preset key is an AES symmetric key.
[0021] In a second aspect, the present invention further provides a method for writing and debugging smart contracts of an Ethereum blockchain, including the following steps:
[0022] 1) Introduce the SDK file, and fill in the RPC after the page is loaded to complete the initialization of the SDK;
[0023] 2) Load the smart contract ABI and the contract address to complete the contract initialization;
[0024] 3) The SDK automatically adds the contract method to the SDK root object to complete the processing of the process and data feedback.
[0025] In a third aspect, an embodiment of the present invention further provides a method for deploying and executing smart contracts of an Ethereum blockchain, including the following steps:
[0026] (1). When initializing the contract, the corresponding contract address is not filled in, that is, it is defaulted to the undeployed state;
[0027] (2). The initialized contract object calls the ".deploy" method to automatically complete the deployment of the contract; the server automatically completes the contract method verification and compliance check.
[0028] As can be seen from the above technical solutions, compared with the prior art:
[0029] The present invention discloses a method for data encryption signature verification of an Ethereum blockchain, including: using ABI at the client to serialize and translate a smart contract deployment and / or call request into a hexadecimal command, and using an encryption algorithm to encrypt the data to be transmitted; using a real-time key to extract a data feature value from the encrypted data and the generated relevant information for data signature, and sending the encrypted data and the data signature to the server; using the server real-time key and the generated relevant information to perform re-signature on the received encrypted data to extract a data feature value; determining whether the data feature value extracted by the client is the same as the data feature value extracted by the server; when the determination result is the same, the server uses a preset key to decrypt the received encrypted data; and deserializing the contract call information through the ABI service. This method performs data encryption signature verification through the server, improving the security of smart contracts. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only the embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained according to the provided drawings.
[0031] Figure 1 It is a flowchart of the method for data encryption signature verification of the Ethereum blockchain provided by the present invention;
[0032] Figure 2 It is a flowchart showing the overall use of the SDK provided by the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0033] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention.
[0034] Embodiment 1:
[0035] The embodiment of the present invention discloses a method for data encryption signature verification of an Ethereum blockchain, as Figure 1 shown, including the following steps:
[0036] S1. Serialize and translate the smart contract deployment and / or call request into a hexadecimal command using ABI on the client side, and encrypt the data to be transmitted using an encryption algorithm.
[0037] S2. Use the real-time key to perform data signature on the encrypted data and the generated relevant information to extract the data feature value, and send the encrypted data and the data signature to the server.
[0038] S3. Use the server real-time key and the generated relevant information to perform re-signature on the received encrypted data to extract the data feature value.
[0039] S4. Determine whether the data feature value extracted by the client is the same as that extracted by the server.
[0040] S5. When the judgment results are the same, the server uses the preset key to decrypt the received encrypted data; deserialize the contract call information through the ABI service.
[0041] S6. Format the deserialized information in the fixed ABI manner. If it does not meet the ABI regulations, content recognition cannot be performed, and an exception is thrown and the supervision program is notified for processing.
[0042] In this embodiment, in step S1, the developer can serialize and translate the smart contract deployment / call request into a hexadecimal command using ABI, and encrypt the data to be transmitted using the AES mode CEB-Pkcs7 encryption algorithm.
[0043] In the above step S2, use the real-time key to perform data signature on the encrypted data, the timestamp "timestamp", and the interference string "nonce" to extract the data feature value, and send the encrypted data and the signature to the server.
[0044] In the above steps S3 - S4, use the server real-time key, the timestamp, and the interference string to perform re-signature on the received ciphertext to extract the data feature value, and compare it with the data feature value in the request to determine whether the request has been modified. The four elements of the feature value participating in the signature extraction on the client and server sides: the key, the timestamp, the random interference string, and the ciphertext content need to be consistent, and the timestamp needs to be generated within the specified time range. Otherwise, the feature values do not match, and the request is determined to be illegal.
[0045] In the above steps S5 - S6, the server uses the AES symmetric key to decrypt the ciphertext, deserializes the contract call information through the ABI service, and the deserialized information will be formatted in the fixed ABI manner. If it does not meet the ABI regulations, content recognition cannot be performed, and an exception is thrown and the supervision program is notified for processing.
[0046] This method performs data encryption signature verification through the server side, improving the security of smart contracts.
[0047] For example:
[0048] When a user needs to call the getBalance(address) method in a smart contract on the client side and clicks "Confirm Execution" in the information confirmation interface automatically popped up by the SDK, the SDK will automatically complete the following tasks:
[0049] 1. Serialize and encrypt the contract method and parameters;
[0050] 2. Generate a timestamp and a random interference string, and at the same time use the client key to sign and extract the feature value of the encrypted content. Then send the current user ID, the generated timestamp, random interference string, encrypted content, and feature value to the server side;
[0051] 3. The server side uses the key of the current user ID, timestamp, interference string, and encrypted content to sign and extract the feature value. Compare it with the feature value in the request to determine whether it has been tampered with;
[0052] 4. After determining that the encrypted content has not been tampered with, decrypt the serialized hexadecimal instruction through the encryption algorithm, and obtain the detailed information of the calling method and parameters through ABI deserialization. Compare it with the rules recorded in the database, determine that the user is allowed to call the getBalance method, and if the permission audit for the current operation passes, encrypt the serialized data using the corresponding blockchain private key and generate RAW to return to the client. RAW is the data content required for the client to call the blockchain for writing.
[0053] In this embodiment, the encryption signature of the signature data is changed to be completed by the server side. After the data transmitted by the user side is deserialized, the database established according to the ABI feature value is retrieved. If the method called by the user is marked as disabled, a signature exception error is returned. If there is no prohibition requirement, the corresponding blockchain account private key registered is used to sign the data, and the encrypted RAW information is generated. At the same time, steps S1 to S6 in the data encryption signature are executed and returned, for the client SDK to connect to the blockchain network and complete the accounting operation. With this mechanism, the deployment and invocation of blockchain smart contracts can be incorporated into the supervision system. This method can effectively avoid illegal transfer and other behaviors between users, ensuring the security and stability of the blockchain. In addition, the data security is higher: The present invention adopts symmetric encryption and asymmetric encryption technologies, digital signatures, and hash algorithms, which can effectively protect the integrity and confidentiality of data, preventing data from being tampered with or leaked.
[0054] Example 2:
[0055] The present invention also provides a method for writing and debugging smart contracts, making the writing and debugging of smart contracts more intelligent and convenient.
[0056] Writing and debugging of smart contracts:
[0057] The present invention provides a solution for writing and debugging smart contracts based on the Solidity programming language and development tools. Developers can conveniently write and debug smart contracts on this platform, reducing development costs and time.
[0058] 1). Introduce the SDK file and fill in the RPC after the page is loaded to complete the initialization of the SKD;
[0059] 2). Load the smart contract ABI and contract address to complete the contract initialization;
[0060] 3). The SDK will automatically add the contract methods to the SDK root object. Developers do not need to understand the rules and usage methods related to the blockchain and can directly call them using "." in the normal way: the processing of the process and data feedback is all automatically completed by the SDK. It includes the process of resource consumption confirmation, communication encryption, server-side verification, polymorphic selection of ABI methods, etc. Developers can complete the interaction with the smart contract using the normal javascript or node object call method.
[0061] Deployment and execution of smart contracts
[0062] The present invention provides a solution for deploying and executing smart contracts based on the Ethereum blockchain. Users can conveniently deploy and execute smart contracts through this platform to achieve secure transmission and exchange of data.
[0063] (1). When initializing the contract, if the corresponding contract address is not filled in, it is defaulted to the undeployed state.
[0064] (2). The initialized contract object calls the ".deploy" method, which will automatically complete the deployment of the contract. There is no need to compile and sign the contract again, and the server program will automatically complete operations such as contract method verification and compliance check.
[0065] In this embodiment, the method for writing, debugging, deploying, and executing smart contracts enables developers to develop and test smart contracts more efficiently.
[0066] In summary, the present invention solves the regulatory problems in the deployment and invocation of blockchain smart contracts in the prior art by providing new data encryption signature verification technology and a solution for writing, deploying, and executing smart contracts based on the Ethereum blockchain architecture, so as to achieve effective supervision of blockchain smart contracts.
[0067] Embodiment 3:
[0068] It is described in combination with the above-mentioned Embodiment 1 and Embodiment 2:
[0069] In specific implementation, for example, introducing the SDK at the head of any WEB / H5 project can complete the access.
[0070] For example, the secondary encapsulation of all standard interfaces based on WEB3JS simplifies the calling method: directly obtaining the smart contract object for calling can automatically complete the resource usage preview, node load, and server signature verification functions without the user's awareness.
[0071] As Figure 2 shown, it shows all the steps of using the SDK:
[0072] "A" is the deployment and access method of the SDK, specifically referring to the "Embodiment";
[0073] "B-D" are the interaction steps between the SDK and the user;
[0074] "E-H" are the interaction steps between the SDK and the server;
[0075] "J" is the information feedback of the SDK
[0076] The specific steps are described as follows:
[0077] A. To access the SDK, the user needs to execute a method in a certain smart contract to record data on the blockchain;
[0078] B. The SDK connects to the blockchain-readable node network manager through JSONRPC and simulates the execution to calculate whether the data can be recorded;
[0079] C. Calculate the energy value to be consumed through the RPC interface;
[0080] D. Pop up a window to display the called contract address, method, parameters, as well as the data to be recorded on the blockchain and the estimated energy consumption value, and wait for the user to confirm.
[0081] E. After the user confirms, query the available blockchain writing nodes;
[0082] F. Serialize, encrypt, sign the information such as the called method and parameters and send it to the server. The server obtains the information such as the contract method and parameters that the user is about to call through signature detection, decryption, and deserialization;
[0083] G. The server queries the risk control database to detect whether the user has the permission to call the specified contract and method. If it meets the risk control rules, use the user's private key to encrypt the serialized information to form RAW and return it to the client;
[0084] H. The client SDK selects a suitable blockchain writing node, sends the RAW data to the blockchain service through the RPC interface. The blockchain service decrypts the serialized content with the public key, calls the smart contract, and writes the content.
[0085] J-1. When the content is successfully written, the client pops up a success prompt message.
[0086] J-2. When the content writing fails, the client will parse the execution log and display the error prompt message returned by the blockchain service.
[0087] The present invention has higher data security, more convenient smart contract development and debugging, and a more flexible blockchain network architecture and node management, which can effectively improve the application value and popularization degree of blockchain technology.
[0088] In this specification, each embodiment is described in a progressive manner. The key point of each embodiment is to illustrate the differences from other embodiments. The same or similar parts among the embodiments can be referred to each other. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the method part.
[0089] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be obvious to those skilled in the art. The general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but will be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for data encryption signature verification of the Ethereum blockchain, characterized in that, It includes the following steps: S1. Connect to the SDK. The user needs to execute a method in a smart contract to record data on the blockchain. The SDK connects to the blockchain-readable node network management through JSONRPC, and simulates the execution to calculate whether the data can be recorded. The energy value consumed is calculated through the RPC interface; A pop-up window displays the contract address, method, parameters, the data to be recorded on the blockchain, and the estimated energy consumption value, waiting for the user to confirm. After the user confirms, query the available blockchain writing nodes. Serialize and translate the smart contract deployment and / or call request into a hexadecimal command using ABI on the client side, and encrypt the data to be transmitted using an encryption algorithm; Among them, the process of writing and debugging the smart contract includes the following steps: 1) Introduce the SDK file, and fill in the RPC after the page is loaded to complete the initialization of the SDK; 2) Load the smart contract ABI and contract address to complete the contract initialization; 3) The SDK automatically adds the contract method to the SDK root object to complete the processing of the process and data feedback; The process of deploying and executing the smart contract includes the following steps: 1) If the corresponding contract address is not filled in during the contract initialization, it is defaulted to the undeployed state; 2) The initialized contract object calls the ".deploy" method to automatically complete the deployment of the contract. The server automatically completes the contract method verification and compliance check; S2. Use the real-time key to perform data signature on the encrypted data and the generated relevant information to extract the data feature value, and send the encrypted data and the data signature to the server; S3. Use the server real-time key and the generated relevant information to perform re-signature on the received encrypted data to extract the data feature value; S4. Determine whether the data feature values extracted by the client are the same as those extracted by the server; S5. When the judgment results are the same, the server uses the preset key to decrypt the received encrypted data; deserialize the contract call information through the ABI service; S6. The deserialized information is formatted in the fixed ABI manner. If it does not meet the ABI regulations, content recognition cannot be performed, and an exception is thrown and notified to the supervision program for processing. The server queries the risk control database to detect whether the user has the permission to call the specified contract and method. If it meets the risk control rules, use the user's private key to encrypt the serialized information to form RAW and return it to the client. The client SDK selects a suitable blockchain writing node, sends the RAW data to the blockchain service through the RPC interface, and the blockchain service decrypts the serialized content through the public key, calls the smart contract, and writes the content.
2. The method for data encryption signature verification of the Ethereum blockchain according to claim 1, characterized in that, The encryption algorithm is: AES mode CEB-Pkcs7 encryption algorithm.
3. The method for data encryption signature verification of the Ethereum blockchain according to claim 1, characterized in that, The generated relevant information includes: The generated timestamp timestamp and the interference string nonce.
4. The method for data encryption signature verification of the Ethereum blockchain according to claim 3, characterized in that, Determine whether the data feature values extracted by the client are the same as those extracted by the server; including: Judge whether the four elements of the data feature values extracted by the client and the server: key, timestamp, random interference string, and ciphertext content, are consistent; and whether the timestamp is generated within the set time range.
5. The method for data encryption signature verification of the Ethereum blockchain according to claim 2, characterized in that, The preset secret key is an AES symmetric key.
Citation Information
Patent Citations
Method for automatically generating Solidy smart contract Java client program
CN110633076A
Service request method and device based on block chain
CN111241557A
Enabling platform based on block chain technology
CN113849561A