CN117614707B - Block chain transaction method, system, electronic equipment and medium based on intelligent contract - Google Patents

Block chain transaction method, system, electronic equipment and medium based on intelligent contract Download PDF

Info

Publication number
CN117614707B
CN117614707B CN202311615004.6A CN202311615004A CN117614707B CN 117614707 B CN117614707 B CN 117614707B CN 202311615004 A CN202311615004 A CN 202311615004A CN 117614707 B CN117614707 B CN 117614707B
Authority
CN
China
Prior art keywords
transaction
public key
node
transaction information
sub
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202311615004.6A
Other languages
Chinese (zh)
Other versions
CN117614707A (en
Inventor
杨圣坤
晁高锋
石峰
于洪杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Golden Network Beijing E Commerce Co ltd
Original Assignee
Golden Network Beijing E Commerce Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Golden Network Beijing E Commerce Co ltd filed Critical Golden Network Beijing E Commerce Co ltd
Priority to CN202311615004.6A priority Critical patent/CN117614707B/en
Publication of CN117614707A publication Critical patent/CN117614707A/en
Application granted granted Critical
Publication of CN117614707B publication Critical patent/CN117614707B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
    • G06F21/6245Protecting personal data, e.g. for financial or medical purposes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • H04L63/0478Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload applying multiple layers of encryption, e.g. nested tunnels or encrypting the content with a first key and then with at least a second key
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/08Network architectures or network communication protocols for network security for authentication of entities
    • H04L63/083Network architectures or network communication protocols for network security for authentication of entities using passwords
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/008Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols involving homomorphic encryption
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3247Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving digital signatures
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/50Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Computing Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Finance (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • Accounting & Taxation (AREA)
  • Marketing (AREA)
  • Databases & Information Systems (AREA)
  • General Business, Economics & Management (AREA)
  • Economics (AREA)
  • Software Systems (AREA)
  • Development Economics (AREA)
  • Technology Law (AREA)
  • Medical Informatics (AREA)
  • Strategic Management (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

The application discloses a blockchain transaction method, a device, electronic equipment and a storage medium based on an intelligent contract, which are used for carrying out double encryption on transaction data during transaction, so that transaction information is completely invisible when the intelligent contract is used for carrying out transaction, the risk of leakage is reduced, and a private key does not participate in transmission in the whole transaction information transmission process, thereby avoiding the risk of interception of the private key during transmission and further reducing the probability of cracking the transaction information; meanwhile, one-time encryption of transaction information is realized by introducing a plurality of edge nodes; based on the uncertainty of the edge node selection, the first public key is regenerated every transaction, so that the risk of encryption cracking can be reduced; in summary, the application can reduce the risk of leakage of transaction data existing in the transaction by using the intelligent contract, and can improve the reliability of the transaction by using the tamper-proof characteristic of the intelligent contract.

Description

Block chain transaction method, system, electronic equipment and medium based on intelligent contract
Technical Field
The invention belongs to the technical field of blockchain transactions, and particularly relates to a blockchain transaction method, a system, electronic equipment and a medium based on intelligent contracts.
Background
The block chain technology is built on a transmission network (also called a block chain network), distributed node equipment in the transmission network realizes that block data is generated by a preset consensus strategy by running a block chain program, and the block data is verified and stored by utilizing a chain data structure so as to finally realize a data tamper-proof mechanism; thus, the blockchain technology is a technology which is constructed based on the decentralized distributed protocol, the consensus algorithm, the asymmetric key signature, the hash and the like, can safely store digital asset information and cannot forge and tamper the information, wherein all nodes on the blockchain network execute transactions respectively and complete result confirmation together, and the consensus algorithm ensures the consistency of executing the transactions by all the nodes, so that a safe and reliable operation transaction environment is provided for business development.
At present, most of nodes in the blockchain realize transaction among each other by using intelligent contracts, wherein the intelligent contracts are deployed on the blockchain and realize transaction operation by using distributed computation and storage, supervision and arbitration of the contracts are completed by a computer, the nodes are non-tamper-proof, a convenient and safe means is provided for the transaction among the nodes of the blockchain, and the nodes are widely used; in actual use, although the data on the smart contract is not tamperable, since the content of the smart contract is visible to all users on the blockchain (including but not limited to resources labeled private); thus, in a transaction, there is a risk that user transaction privacy information is easily compromised; based on this, how to provide a blockchain transaction method based on intelligent contracts, which can protect user transaction privacy data during transaction, has become a problem to be solved.
Disclosure of Invention
The invention aims to provide a blockchain transaction method, a system, electronic equipment and a medium based on an intelligent contract, which are used for solving the problem that transaction privacy data are easy to leak when the intelligent contract is used for carrying out blockchain transaction in the prior art.
In order to achieve the above purpose, the present invention adopts the following technical scheme:
In a first aspect, there is provided a blockchain transaction method based on an intelligent contract, comprising:
The transaction initiating node selects any edge node from a plurality of edge nodes as an intermediate node of the transaction, and sends a key acquisition request to the intermediate node, wherein the plurality of edge nodes are independently deployed between the blockchain network and the transaction initiating node;
After receiving the key acquisition request, the intermediate node generates a first key pair for the transaction, and sends a first public key of the first key pair to the transaction initiating node;
The transaction initiating node receives a first public key, and encrypts transaction information by using the first public key to obtain first encrypted transaction information, wherein the first encrypted transaction information comprises a contract address and transaction service parameters;
The transaction initiating node sends the first encrypted transaction information to the intermediate node;
the intermediate node performs validity verification on the first encrypted transaction information, and after the validity verification is passed, the intermediate node performs encryption processing on the first encrypted transaction information and a first private key in the first key pair by using a second public key disclosed by an accounting node in a blockchain network to obtain second encrypted transaction information;
The intermediate node sends the second encrypted transaction information to an accounting node in a blockchain network;
The billing node performs validity verification on the second encrypted transaction information, and after the validity verification is passed, performs one-time decryption on the second encrypted transaction information to obtain a first private key and first encrypted transaction information, and performs one-time decryption on the first encrypted transaction information by using the first private key to obtain a contract address and transaction service parameters;
The accounting node acquires an intelligent contract matched with the contract address from a blockchain network according to the contract address, and executes a transaction corresponding to the transaction service parameter based on the transaction service parameter and the acquired intelligent contract to obtain transaction data;
The billing node updates the state data in the intelligent contract by using the transaction data, fully encrypts the updated state data, and publishes the fully encrypted intelligent contract after encryption so as to complete the transaction after publication.
Based on the above disclosure, the blockchain transaction method provided by the invention realizes one-time encryption processing of transaction information corresponding to the transaction initiating node by introducing a plurality of edge nodes; the method comprises the steps that a plurality of edge nodes are independently arranged between a transaction initiating node and a blockchain network, when a transaction is initiated, the transaction initiating node selects any one of the edge nodes to serve as an intermediate node of the transaction, then the selected intermediate node generates a first key pair for the transaction, and a first public key of the first key pair is disclosed to the transaction initiating node; then, the transaction initiating node encrypts the transaction information based on the first public key and sends the encrypted transaction information to the intermediate node, and at this time, the one-time encryption process can be completed.
After the primary encryption is finished, the intermediate node acquires a second public key disclosed by an accounting node in the blockchain network, and encrypts the first encrypted transaction information and the first private key of the intermediate node by utilizing the second public key (the second encryption) to obtain second encrypted transaction information; then, the intermediate node sends the second encrypted transaction information to the accounting node, the accounting node decrypts the second encrypted transaction information to obtain the contract address and the business transaction parameter in the transaction information so as to determine the intelligent contract used by the transaction based on the contract address, and the transaction data is obtained based on the determined intelligent contract and the business transaction parameter so as to update the intelligent contract; and finally, the billing node encrypts the updated intelligent contract in an isomorphic mode and publishes the encrypted intelligent contract, so that the transaction can be completed.
Through the design, the transaction data is doubly encrypted during transaction, so that the transaction information is completely invisible when the intelligent contract is used for transaction, the risk of leakage is reduced, and the private key does not participate in transmission in the whole transaction information transmission process, so that the risk of interception of the private key during transmission can be avoided, and the probability of cracking the transaction information can be further reduced; meanwhile, one-time encryption of transaction information is realized by introducing a plurality of edge nodes, wherein each transaction is to randomly select one edge node, and a first public key of the selected node generated at the time is a public key used for one-time encryption; based on the uncertainty of the edge node selection and the regeneration of the first public key in each transaction, the risk of encryption cracking can be reduced, and the encryption security is improved; in addition, the application also carries out full homomorphic encryption on the state data in the intelligent contract after transaction, thereby making the transaction information in the intelligent contract invisible, thus further protecting the transaction privacy data and further preventing lawless persons from stealing the user transaction data through the intelligent contract; in summary, the method and the system can reduce the risk of leakage of transaction data existing in the transaction by using the intelligent contract, and can improve the reliability of the transaction by using the tamper-proof characteristic of the intelligent contract, so that the method and the system are very suitable for large-scale application and popularization in the field of blockchain transaction.
In one possible design, the intermediate node generates a first key pair for the present transaction after receiving the key acquisition request, including:
The intermediate node selects a random number meeting a preset condition from a random number library to be used as a first sub-public key, wherein the preset condition is that the selected random number is prime, and the difference between the selected random number and 1 has a large prime factor;
Determining a second sub-public key based on the first sub-public key;
the intermediate node randomly selects an integer from the integer set as a first private key;
Calculating a third sub public key based on the first sub public key, the second sub public key and the first private key;
Forming a first public key by using the first sub public key, the second sub public key and the third sub public key;
And utilizing the first public key and the first private key to form the first key pair.
In one possible design, the second sub-public key is a positive integer, where the second sub-public key and the first sub-public key satisfyAnd/>Are different from each other, and/>Representing the second sub-public key,/>Representing a first sub-public key;
Correspondingly, calculating the third sub public key based on the first sub public key, the second sub public key and the first private key includes:
based on the first sub public key, the second sub public key and the first private key, calculating to obtain a third sub public key according to the following formula (1);
(1)
in the above-mentioned formula (1), Representing a third sub-public key,/>Representing the first private key, mod represents the modulo operation.
In one possible design, the first public key includes a first sub public key, a second sub public key, and a third sub public key, where the transaction initiating node receives the first public key, and encrypts the transaction information by using the first public key to obtain first encrypted transaction information, including:
The transaction initiating node randomly generates an integer as a first encryption parameter;
Calculating a second encryption parameter by using the first sub-public key, the third sub-public key and the first encryption parameter according to the following formula (2);
(2)
In the above-mentioned formula (2), Representing the second encryption parameter,/>Representing a third sub-public key,/>Representing a first sub-public key,/>Representing the first encryption parameter, mod representing a modulo operation;
according to the first encryption parameter, the second sub-public key and the first sub-public key, a first ciphertext is calculated according to the following formula (3);
(3)
In the above-mentioned formula (3), Representing the first ciphertext,/>Representing the second sub-public key;
Performing coding operation on the transaction service parameters and the contract address to obtain a first coding value and a second coding value respectively, and performing splicing processing on the first coding value and the second coding value to obtain a transaction plaintext;
based on the second encryption parameter and the first sub-public key, encrypting the transaction plaintext according to the following formula (4) to obtain a second ciphertext;
(4)
in the above-mentioned formula (4), Representing the second ciphertext,/>Representing the plaintext of the transaction;
forming initial encrypted transaction information by utilizing the first ciphertext and the second ciphertext;
And carrying out digital signature processing on the initial encrypted transaction information to obtain the first encrypted transaction information after the digital signature processing.
In one possible design, encrypting the first encrypted transaction information and the first private key in the first key pair using a second public key disclosed by an accounting node in a blockchain network to obtain second encrypted transaction information includes:
after the validity verification is passed, the intermediate node sends an encryption request to an accounting node in the blockchain network;
after receiving the encryption request, the billing node generates two large prime numbers for the transaction, and generates a second private key and a second public key by using the two large prime numbers;
The billing node utilizes the second private key and the second public key to form a second key pair, stores the second private key in the second key pair, and transmits the second public key in the second key pair to the intermediate node;
The intermediate node encrypts the first encrypted transaction information and a first private key in the first key pair by using the second public key to obtain initial second encrypted transaction information;
and carrying out digital signature processing on the initial second encrypted transaction information to obtain second encrypted transaction information.
In one possible design, the billing node, upon receiving the encryption request, generates two large prime numbers for the current transaction, including:
The method comprises the steps that a billing node randomly generates a group of first arrays, wherein any element in the first arrays is odd, any element can be divided by a preset value, and any element is larger than a calibration threshold value;
acquiring a pseudo prime number table, and screening elements in the first array based on the pseudo prime number table to remove pseudo prime numbers in the array so as to obtain a second array;
performing prime number judgment on each element in the second array by using a probability property prime number judgment algorithm, and screening out elements belonging to prime numbers in the second array to form a prime number library;
and randomly selecting two elements from the prime number database to serve as two large prime numbers corresponding to the transaction.
In one possible design, the billing node performs a re-decryption process on the second encrypted transaction information to obtain the first private key and the first encrypted transaction information, including:
the billing node uses a second private key of the billing node to perform repeated decryption processing on the second encrypted transaction information to obtain a first private key and first encrypted transaction information, wherein the second private key corresponds to the second public key, and the first encrypted transaction information comprises a first ciphertext and a second ciphertext;
correspondingly, the billing node performs double decryption processing on the first encrypted transaction information by using the first private key to obtain a contract address and transaction service parameters, including:
the method comprises the steps that an accounting node obtains a first public key which is disclosed by an intermediate node and corresponds to a first private key, wherein the first public key comprises a first sub-public key;
the billing node decrypts the first ciphertext by using the first sub-public key and the first private key according to the following formula (5) to obtain a plaintext corresponding to the first ciphertext;
(5)
In the above-mentioned formula (5), Representing plaintext corresponding to the first ciphertext,/>Representing the first ciphertext,/>Representing a first private key,/>Representing a first sub-public key, mod represents a modulo operation;
The billing node decrypts the second ciphertext based on the plaintext corresponding to the first ciphertext and the first sub-public key according to the following formula (6) to obtain a transaction plaintext;
(6)
In the above-mentioned formula (6), Representing the plaintext of the transaction,/>Representing a second ciphertext;
and the accounting node obtains the contract address and the transaction service parameter according to the transaction plaintext.
In a second aspect, there is provided a blockchain transaction system based on smart contracts, comprising: a transaction initiation node, an accounting node, and a plurality of edge nodes;
The transaction initiating node is used for selecting any edge node from a plurality of edge nodes as an intermediate node of the transaction, and sending a key acquisition request to the intermediate node, wherein the plurality of edge nodes are independently deployed between the blockchain network and the transaction initiating node;
The intermediate node is used for generating a first key pair for the transaction after receiving the key acquisition request and sending a first public key of the first key pair to the transaction initiating node;
The transaction initiating node is used for receiving the first public key, and encrypting the transaction information by utilizing the first public key to obtain first encrypted transaction information, wherein the first encrypted transaction information comprises a contract address and transaction service parameters;
The transaction initiating node is further configured to send the first encrypted transaction information to the intermediate node;
the intermediate node is used for verifying the validity of the first encrypted transaction information, and after the validity is verified, the first encrypted transaction information and a first private key in the first key pair are encrypted by using a second public key disclosed by an accounting node in the blockchain network to obtain second encrypted transaction information;
the intermediate node is further used for sending the second encrypted transaction information to an accounting node in the blockchain network;
The billing node is used for verifying the validity of the second encrypted transaction information, performing a re-decryption process on the second encrypted transaction information after the validity is verified, obtaining a first private key and first encrypted transaction information, and performing a re-decryption process on the first encrypted transaction information by using the first private key, so as to obtain a contract address and transaction service parameters;
The accounting node is used for acquiring an intelligent contract matched with the contract address from the blockchain network according to the contract address, and executing a transaction corresponding to the transaction service parameter based on the transaction service parameter and the acquired intelligent contract to obtain transaction data;
And the billing node is also used for updating the state data in the intelligent contract by using the transaction data, fully homomorphic encrypting the updated state data, and publishing the fully homomorphic encrypted intelligent contract after encrypting so as to complete the transaction after publishing.
In a third aspect, a blockchain transaction device based on an intelligent contract is provided, taking the device as an electronic device for example, and the blockchain transaction device comprises a memory, a processor and a transceiver which are sequentially and communicatively connected, wherein the memory is used for storing a computer program, the transceiver is used for receiving and sending messages, and the processor is used for reading the computer program and executing the blockchain transaction method based on the intelligent contract, which is possibly designed in the first aspect or any one of the first aspect.
In a fourth aspect, there is provided a storage medium having instructions stored thereon which, when executed on a computer, perform the smart contract-based blockchain transaction method as in the first aspect or any of the possible designs of the first aspect.
In a fifth aspect, there is provided a computer program product comprising instructions which, when run on a computer, cause the computer to perform the smart contract-based blockchain transaction method as in the first aspect or any of the possible designs of the first aspect.
The beneficial effects are that:
(1) The application carries out double encryption on the transaction data during transaction, thus, when the intelligent contract is used for carrying out transaction, the transaction information is completely invisible, the risk of leakage is reduced, and the private key does not participate in transmission in the whole transaction information transmission process, thereby avoiding the risk of interception of the private key during transmission and further reducing the probability of cracking the transaction information; meanwhile, one-time encryption of transaction information is realized by introducing a plurality of edge nodes, wherein each transaction is to randomly select one edge node, and a first public key of the selected node generated at the time is a public key used for one-time encryption; based on the uncertainty of the edge node selection and the regeneration of the first public key in each transaction, the risk of encryption cracking can be reduced, and the encryption security is improved; in addition, the application also carries out full homomorphic encryption on the state data in the intelligent contract after transaction, thereby making the transaction information in the intelligent contract invisible, thus further protecting the transaction privacy data and further preventing lawless persons from stealing the user transaction data through the intelligent contract; in summary, the method and the system can reduce the risk of leakage of transaction data existing in the transaction by using the intelligent contract, and can improve the reliability of the transaction by using the tamper-proof characteristic of the intelligent contract, so that the method and the system are very suitable for large-scale application and popularization in the field of blockchain transaction.
Drawings
FIG. 1 is a flowchart illustrating steps of a blockchain transaction method based on intelligent contracts according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a blockchain transaction system based on smart contracts according to an embodiment of the present invention;
Fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the present invention will be briefly described below with reference to the accompanying drawings and the description of the embodiments or the prior art, and it is obvious that the following description of the structure of the drawings is only some embodiments of the present invention, and other drawings can be obtained according to these drawings without inventive effort to a person skilled in the art. It should be noted that the description of these examples is for aiding in understanding the present invention, but is not intended to limit the present invention.
It will be understood that, although the terms first, second, etc. may be used herein to describe various elements, these elements should not be limited by these terms. These terms are only used to distinguish one element from another element. For example, a first element could be termed a second element, and, similarly, a second element could be termed a first element, without departing from the scope of example embodiments of the present invention.
It should be understood that for the term "and/or" that may appear herein, it is merely one association relationship that describes an associated object, meaning that there may be three relationships, e.g., a and/or B, may represent: a alone, B alone, and both a and B; for the term "/and" that may appear herein, which is descriptive of another associative object relationship, it means that there may be two relationships, e.g., a/and B, it may be expressed that: a alone, a alone and B alone; in addition, for the character "/" that may appear herein, it is generally indicated that the context associated object is an "or" relationship.
Examples:
Referring to fig. 1, in the blockchain transaction method based on the intelligent contract provided in this embodiment, by introducing an edge node, dual encryption of transaction data is implemented, and during transaction, the transaction information after dual encryption is sent to the blockchain network, so that the blockchain network implements the transaction based on the dual encryption data and the determined intelligent contract; therefore, through the design, when the intelligent contract is used for carrying out the transaction, the transaction information is completely invisible, so that the risk of leakage is reduced; meanwhile, the introduced edge node is determined in a random selection mode, and a key pair is required to be regenerated in each transaction, so that the risk of cracking encryption can be reduced, and the encryption safety is improved; alternatively, the method may be, but not limited to, executed at the transaction initiation node, the edge node, and the accounting node, and it is to be understood that the foregoing execution bodies are not limited to the embodiments of the present application, and accordingly, the steps of the method may be, but not limited to, as shown in the following steps S1 to S9.
S1, a transaction initiating node selects any edge node from a plurality of edge nodes as an intermediate node of the transaction, and sends a key acquisition request to the intermediate node, wherein the plurality of edge nodes are independently deployed between a blockchain network and the transaction initiating node; when the method is applied specifically, a plurality of edge nodes are independently deployed between the transaction initiating node and the blockchain network, wherein each edge node does not store any data (such as transaction information, service data, blockdata and the like) participating in blockchain operation, and the edge nodes serve as intermediate nodes only when block transaction is carried out to realize transfer transmission of transaction data; optionally, the number of the edge nodes may be specifically set according to actual use, and in this embodiment, the number of the edge nodes is set to be the same as the number of the transaction initiation nodes (for example, n edge nodes are set); therefore, the randomness of the selected nodes can be increased when each transaction is performed, and the security of the transaction is improved.
After any edge node is selected from a plurality of edge nodes to serve as an intermediate node of the transaction, a key acquisition request can be sent to the intermediate node, so that the intermediate node can generate a first key pair for the transaction after receiving the key acquisition request, and primary encryption of transaction information is carried out based on a first public key of the first key pair; the process of generating the first key pair may be, but is not limited to, as shown in step S2 below.
S2, after receiving the key acquisition request, the intermediate node generates a first key pair for the transaction, and sends a first public key in the first key pair to the transaction initiating node; in this embodiment, the example intermediate node may, but is not limited to, employ the following steps S21 to S26 to generate the first key pair.
S21, selecting a random number meeting a preset condition from a random number library by an intermediate node to serve as a first sub-public key, wherein the preset condition is that the selected random number is prime, and the difference between the selected random number and 1 has a large prime factor; in the embodiment, the random number library is preset in the intermediate node and is called when in use; after the random number meeting the preset condition is selected from the random number library, the random number may be used as the first sub-public key, and the second sub-public key may be generated based on the first sub-public key, as shown in step S22 below.
S22, determining a second sub-public key based on the first sub-public key; in this embodiment, the second sub-public key is a positive integer, where the second sub-public key and the first sub-public key satisfy the following conditionsAnd/>Are different from each other andRepresenting the second sub-public key,/>Representing a first sub-public key; in a specific application, the second sub-public key can be determined based on the relation satisfied between the first sub-public key and the second sub-public key, and of course, if there are multiple second sub-public keys, one sub-public key is selected randomly.
After the second sub-public key is obtained, a private key may be generated, as shown in step S23 below.
S23, the intermediate node randomly selects an integer from the integer set to serve as a first private key, and in the embodiment, the value of the integer selected from the integer set is (1, t-1); after the first private key is generated, a third sub-public key may be generated based on the two sub-public keys and the first private key, where the generation process is shown in step S24 below.
S24, calculating a third sub public key based on the first sub public key, the second sub public key and the first private key; in the present embodiment, the third sub-public key may be calculated by, for example, but not limited to, following formula (1).
(1)
In the above-mentioned formula (1),Representing a third sub-public key,/>Representing the first private key, mod represents the modulo operation.
After calculating the third sub-public key based on the formula (1), the two sub-public keys can be combined to form a first public key; then, the first public key and the first private key may be used to form a first key pair, as shown in step S25 and step S26 below.
S25, utilizing the first sub public key, the second sub public key and the third sub public key to form a first public key.
S26, utilizing the first public key and the first private key to form the first key pair; in this embodiment, the first public key may be disclosed, for example, when the transaction is performed, the first public key is disclosed to the transaction initiating node and the accounting node; the first private key needs to be stored in the intermediate node and is not disclosed.
Thus, through the foregoing steps S21 to S26, the first key pair used for the first encryption of the present transaction may be generated, and then, the intermediate node may send the first public key in the first key pair to the transaction initiating node, so that the transaction initiating node encrypts the transaction information corresponding to the present transaction by using the first public key, where the transaction information encryption process may be, but is not limited to, as shown in the following step S3.
S3, the transaction initiating node receives the first public key, and encrypts transaction information by utilizing the first public key to obtain first encrypted transaction information, wherein the first encrypted transaction information comprises a contract address and transaction service parameters; in this embodiment, example transaction parameters may include, but are not limited to, payer identity IDENTITYA (i.e., the identity of the transaction initiating node), payee identity, single transaction amount, transaction total, transaction content, etc.; of course, the foregoing is merely illustrative and is not limited in this regard as to transaction information relating to a particular transaction type.
Meanwhile, the encryption processing of the transaction information may be, for example, but not limited to, as shown in the following steps S31 to S37.
S31, randomly generating an integer by a transaction initiating node as a first encryption parameter; in this embodiment, the value range of the first encryption parameter is also (1, t-1); of course, the transaction initiating node is also provided with an integer library, and the integer library is called when in use; after the first encryption parameter is obtained, the second encryption parameter required for the present encryption can be calculated by combining the first public key disclosed by the intermediate node, wherein the calculation process can be, but is not limited to, as shown in the following step S32.
S32, calculating a second encryption parameter by using the first sub-public key, the third sub-public key and the first encryption parameter according to the following formula (2).
(2)
In the above-mentioned formula (2),Representing the second encryption parameter,/>Representing a third sub-public key,/>Representing a first sub-public key,/>Representing the first encryption parameter, mod represents a modulo operation.
Based on the formula (2), a second encryption parameter can be calculated, and then the ciphertext can be generated by using the first encryption parameter and the second encryption parameter; in this embodiment, two ciphertexts are generated, and the generation process is shown in the following steps S33 to S35.
S33, calculating a first ciphertext according to the first encryption parameter, the second sub-public key and the first sub-public key and the following formula (3).
(3)
In the above-mentioned formula (3),Representing the first ciphertext,/>Representing the second sub-public key.
In this embodiment, the first ciphertext may be regarded as an interference ciphertext, and the ciphertext representing the transaction information is encrypted by using a second encryption parameter, where in this embodiment, the transaction information needs to be digitized first, and then the digitized transaction information is encrypted by using the second encryption parameter, so as to obtain the second ciphertext containing the transaction information; alternatively, the digitizing process of the transaction information may be, but is not limited to, as shown in step S34 below.
S34, carrying out coding operation on the transaction service parameters and the contract address to respectively obtain a first coding value and a second coding value, and carrying out splicing processing on the first coding value and the second coding value to obtain a transaction plaintext; in a specific application, for example, but not limited to, a segmentation character is arranged between the splice parts of the first code value and the second code value, so that the two can be segmented in the subsequent decryption; meanwhile, the divided character is also represented by a number (the number representing the divided character can be preset, such as the continuous number 0 or number 4, etc.; of course, the representation of the divided character can be specifically set according to the actual use, and is not limited to the foregoing examples); furthermore, the transaction service parameters and the contract address can be directly combined, and the segmentation characters are added at the joint; then, the combined information is subjected to coding operation uniformly, so that a transaction plaintext is obtained; in addition, the intermediate node stores a code table, wherein codes corresponding to different characters (codes can be represented by numbers) are stored in the code table, so that the code operation of transaction service parameters and contract addresses can be performed based on the code table.
After obtaining the transaction plaintext, the transaction plaintext may be encrypted by using the second encryption parameter, so as to obtain a second ciphertext including transaction information, where the encryption process is as follows in step S35.
S35, based on the second encryption parameter and the first sub public key, encryption processing is carried out on the transaction plaintext according to the following formula (4) to obtain a second ciphertext.
(4)
In the above-mentioned formula (4),Representing the second ciphertext,/>Representing the plaintext of the transaction.
Thus, the second ciphertext including the transaction information may be obtained through the above formula (4), and then the first ciphertext and the second ciphertext may be utilized to form the initial encrypted transaction information, as shown in step S36.
S36, utilizing the first ciphertext and the second ciphertext to form initial encrypted transaction information; in this embodiment, the initial encrypted transaction information may be represented, but is not limited to, as; Meanwhile, in this embodiment, after the initial encrypted transaction information is obtained, digital signature processing is further required to be performed on the initial encrypted transaction information to ensure the authenticity of the information sender, where the digital signature processing procedure is shown in the following step S37.
S37, carrying out digital signature processing on the initial encrypted transaction information to obtain the first encrypted transaction information after the digital signature processing; in specific application, for example, a DSA digital signature algorithm may be used, but not limited to, to perform digital signature processing on the initial encrypted transaction information to obtain first encrypted transaction information; of course, the remaining digital signature algorithms may also be used, and in this embodiment, are not particularly limited.
Thus, through the steps S31 to S37, the first encryption of the transaction information can be completed at the transaction initiating node, and the first encrypted transaction information is obtained; then, the first encrypted transaction information can be sent to an intermediate node, the intermediate node carries out secondary encryption and then sends the second encrypted transaction information to an accounting node in the blockchain network, and the transaction is realized based on the accounting node; the transmission process and the secondary encryption process are as follows in step S4 and step S5.
And S4, the transaction initiating node sends the first encrypted transaction information to the intermediate node.
S5, the intermediate node performs validity verification on the first encrypted transaction information, and after the validity verification is passed, the first encrypted transaction information and a first private key in the first key pair are subjected to encryption processing by using a second public key disclosed by an accounting node in the blockchain network to obtain second encrypted transaction information; in this embodiment, the intermediate node performs validity verification on the first encrypted transaction information, and performs digital signature authentication on the first encrypted transaction information, so that it can be determined whether the identity of the node that sends the first encrypted transaction information is true; if the digital signature passes the authentication, the identity of the sender of the first encrypted transaction information is true, and the next operation can be performed; otherwise, the transaction is required to be ended.
Further, the process of encrypting (i.e., twice encrypting) the first encrypted transaction information and the first private key by the intermediate node may be, but not limited to, the following steps S51 to S55.
And S51, after the validity verification is passed, the intermediate node sends an encryption request to an accounting node in the blockchain network.
S52, after receiving the encryption request, the billing node generates two large prime numbers for the transaction, and generates a second private key and a second public key by using the two large prime numbers; in a specific application, the billing node regenerates two large prime numbers at each transaction to generate a private key and a public key for use in secondary encryption based on the two generated prime numbers; alternatively, the billing node may, but is not limited to, employ the following steps S52 a-S52 d to generate the two major prime numbers.
S52a, randomly generating a group of first arrays by the accounting node, wherein any element in the first arrays is odd, any element can be divided by a preset value, and any element is larger than a calibration threshold value; in this embodiment, the preset value is 5, that is, any element in the first array is an odd number and can be divided by 5; meanwhile, the calibration threshold may be, but is not limited to 10000; of course, the configuration may be specifically set according to actual use, and is not limited to the foregoing examples.
After the first array is generated, the pseudo prime numbers can be removed from the first array, wherein in the embodiment, in order to improve prime number generation efficiency, a pseudo prime number table is preset in an accounting node, so that the pseudo prime numbers in the first array can be removed according to the pseudo prime number table; alternatively, the rejection process is as shown in step S52b below.
S52b, acquiring a pseudo prime number table, and screening elements in the first array based on the pseudo prime number table to remove pseudo prime numbers in the array so as to obtain a second array; in the present embodiment, examples of the pseudo-prime number table may include, but are not limited to, a prime number of Fischer Ma Wei, a Kamiakel number, and an Euler pseudo prime number; therefore, based on the pseudo prime number table, the pseudo prime numbers in the first array can be rapidly removed, so that a second array is obtained; then, the prime number (i.e., prime number) of each element in the second array may be determined, so as to form a prime number library by using the determined prime numbers, where the prime number determination process of each element in the second array is as follows in step S53 c.
S52c, performing prime number judgment on each element in the second array by using a probability property prime number judgment algorithm, and screening out elements belonging to prime numbers in the second array to form a prime number library; in this embodiment, for example, but not limited to, a Miller-Rabin probability property prime number judgment algorithm, a Solovay-Strassen probability property prime number judgment algorithm, or a Lehamn probability property prime number judgment algorithm may be used to perform prime number judgment on each element in the second array, and of course, the foregoing algorithms are all common techniques for prime number judgment, and the principles thereof are not repeated.
After prime number identification of each element in the second array is completed, prime number data can be formed by utilizing each prime number in the second array; then, two prime numbers can be randomly selected from the prime number library to be used as two large prime numbers used in the transaction, wherein the selection process is as shown in the following step S52 d.
S52d, randomly selecting two elements from the prime number database to serve as two large prime numbers corresponding to the transaction.
Thus, through the steps S52a to S52d, two large prime numbers used in the second encryption can be generated, and then, an RAS key pair (i.e., a second key pair) can be generated by using the two large prime numbers and adopting the RSA key generation algorithm; finally, the billing node locally reserves the second private key in the second key pair, and then discloses the second public key in the second key pair to the intermediate node, so that the intermediate node performs secondary encryption of the transaction information based on the second public key, wherein the issuing of the second key pair and the secondary encryption process of the transaction information are respectively shown in the following steps S53 and S54. ,
And S53, the billing node utilizes the second private key and the second public key to form a second key pair, stores the second private key in the second key pair, and sends the second public key in the second key pair to the intermediate node.
S54, the intermediate node encrypts the first encrypted transaction information and a first private key in the first key pair by using the second public key to obtain initial second encrypted transaction information; in this embodiment, the encryption processing is performed on the first encrypted transaction information and the first private key by using the RSA encryption algorithm, so as to obtain initial second encrypted transaction information; of course, the RAS encryption algorithm is a common technique for encrypting data, and the principle thereof is not described in detail.
After the initial second encrypted transaction information is obtained, in order to ensure the authenticity of the identity of the intermediate node, a digital signature process is also required for the initial second encrypted transaction information, where the digital signature process is as shown in step S55 below.
S55, carrying out digital signature processing on the initial second encrypted transaction information to obtain second encrypted transaction information; in this embodiment, the digital signature process of the initial second encrypted transaction information is the same as the principle of the digital signature process of the initial encrypted transaction information, and will not be described herein.
The second encryption of the transaction information and the encryption processing of the first private key generated by the intermediate node can be completed through the steps S51 to S55, so that the second encrypted transaction information containing the transaction information and the first private key is obtained; then, the second encrypted transaction information can be sent to an accounting node, and the accounting node performs double decryption to obtain specific transaction information and contract address so as to complete the transaction based on the contract address and the transaction information; the uploading process and the decrypting process of the second encrypted transaction information may be, but are not limited to, as shown in the following step S6 and step S7.
And S6, the intermediate node sends the second encrypted transaction information to an accounting node in the blockchain network.
S7, the billing node performs validity verification on the second encrypted transaction information, and after the validity verification is passed, performs one-time decryption on the second encrypted transaction information to obtain a first private key and first encrypted transaction information, and performs one-time decryption on the first encrypted transaction information by using the first private key to obtain a contract address and transaction service parameters; in a specific application, the billing node also performs digital signature authentication on the validity verification of the second encrypted transaction information, wherein a re-decryption process is to decrypt the second encrypted transaction information by using a second private key (namely an RSA private key) of a second key pair generated by the billing node, so as to obtain the first encrypted transaction information and the first private key; and then, the first private key is utilized to carry out secondary decryption on the first encrypted transaction information, so that the transaction information and the contract address are obtained.
Alternatively, the second decryption process may be, but is not limited to, as shown in steps S71 to S74 described below.
S71, the billing node acquires a first public key which is disclosed by the intermediate node and corresponds to the first private key, wherein the first public key comprises a first sub-public key; in the present embodiment, it is equivalent to acquiring parameters in the first public key; Then, the first sub-public key/>, can be utilizedAnd a first private key to decrypt the first ciphertext in the first encrypted transaction information, wherein the decryption process is as shown in step S72, below.
S72, the billing node decrypts the first ciphertext by using the first sub-public key and the first private key according to the following formula (5) to obtain a plaintext corresponding to the first ciphertext.
(5)
In the above-mentioned formula (5),Representing plaintext corresponding to the first ciphertext,/>Representing the first ciphertext,/>Representing a first private key,/>Representing the first sub-public key, mod represents the modulo operation.
Based on the formula (5), the first ciphertext can be decrypted, so that a plaintext corresponding to the first ciphertext is obtained; then, the second ciphertext may be decrypted based on the decrypted plaintext, as shown in step S73.
S73, the billing node decrypts the second ciphertext based on the plaintext corresponding to the first ciphertext and the first sub-public key according to the following formula (6) to obtain a transaction plaintext.
(6)
In the above-mentioned formula (6),Representing the plaintext of the transaction,/>Representing the second ciphertext.
Based on the formula (6), a transaction plaintext representing a hash value obtained by combining the contract address and the transaction service parameter can be obtained, and the contract address and the transaction service parameter can be obtained by performing inverse coding operation; the inverse coding operation is as follows in step S74.
S74, the billing node obtains the contract address and the transaction service parameter according to the transaction plaintext; in this embodiment, the inverse coding operation obtains the corresponding character of each code according to the coding table, so as to restore the original data.
Thus, after the double decryption of the double encrypted transaction information is completed through the steps S71 to S74, the transaction information initiated by the transaction initiating node can be obtained, then, based on the contract address in the transaction information, the intelligent contract used by the present transaction can be determined, and based on the intelligent contract and the service parameter data, the present transaction can be completed, wherein the transaction process is as shown in the following step S8.
S8, the billing node acquires an intelligent contract matched with the contract address from a blockchain network according to the contract address, and executes transaction corresponding to the transaction service parameter based on the transaction service parameter and the acquired intelligent contract to obtain transaction data; in this embodiment, the transaction corresponding to the transaction service parameter is implemented by using the intelligent contract, if the transaction service parameter is that the transaction initiating node A1 transfers 500 to the transaction receiving node B1, after the intelligent contract is triggered, 500 can be deducted from the account of the transaction initiating node A1 and transferred to the account of the transaction receiving node B1; of course, the principle of the transaction process corresponding to the rest of transaction service parameters is the same as that of the foregoing example, and will not be repeated here.
After the corresponding transaction is completed based on the determined intelligent contract and transaction service parameters, transaction data can be generated, wherein the example transaction data can include, but is not limited to, transaction time, transaction results, transaction amount, transaction credentials, identity of both parties, and the like; after transaction data is obtained, the accounting node writes the transaction data into the intelligent contract to update the intelligent contract so as to embody the transaction on the intelligent contract; meanwhile, in this embodiment, in order to further improve the privacy of data, an encryption process of data in the smart contract is further provided, where the encryption process is as follows in step S9.
S9, the billing node updates the state data in the intelligent contract by using the transaction data, fully homomorphic encrypts the updated state data, and publishes the fully homomorphic encrypted intelligent contract after encryption so as to complete the transaction after publication; in this embodiment, the status data of the smart contract shows the current running status of the contract, such as the current balance, the number of transactions, the contract code, etc.; therefore, if the state data is transparent, lawless persons can obtain transaction detail information of the transaction, so that data leakage is caused; based on the above, in this embodiment, before the smart contract of the present transaction is published, the state data in the smart contract is fully encrypted, and then is disclosed after encryption; thus, the transaction information in the intelligent contract is invisible, so that the transaction privacy data is further protected; of course, in the present embodiment, isomorphic encryption is a common technique in the blockchain data encryption process, and the principle thereof is not described again.
The invention realizes double encryption of transaction data by introducing edge nodes through the blockchain transaction method based on intelligent contracts described in detail in the steps S1-S9, and sends transaction information after double encryption to a blockchain network during transaction, so that the blockchain network realizes the transaction based on the double encryption data and the determined intelligent contracts; through the design, when the intelligent contract is used for carrying out transaction, the transaction information is completely invisible, so that the risk of leakage is reduced; meanwhile, the introduced edge node is determined in a random selection mode, and a key pair is required to be regenerated in each transaction, so that the risk of cracking encryption can be reduced, and the encryption safety is improved; in addition, the invention also carries out full homomorphic encryption on the state data in the intelligent contract after transaction, thereby making the transaction information in the intelligent contract invisible, and further protecting the transaction privacy data; through the design, the method and the system can reduce the risk of leakage of transaction data existing in the transaction by using the intelligent contract, and can improve the reliability of the transaction by using the tamper-proof characteristic of the intelligent contract, so that the method and the system are very suitable for large-scale application and popularization in the field of blockchain transaction.
As shown in fig. 2, a second aspect of the present embodiment provides a hardware system for implementing the blockchain transaction method based on smart contracts according to the first aspect of the present embodiment, including: a transaction initiation node, an accounting node, and a plurality of edge nodes;
and the transaction initiating node is used for selecting any edge node from the plurality of edge nodes as an intermediate node of the transaction and sending a key acquisition request to the intermediate node, wherein the plurality of edge nodes are independently arranged between the blockchain network and the transaction initiating node.
And the intermediate node is used for generating a first key pair for the transaction after receiving the key acquisition request and sending a first public key of the first key pair to the transaction initiating node.
The transaction initiating node is used for receiving the first public key, and encrypting the transaction information by utilizing the first public key to obtain first encrypted transaction information, wherein the first encrypted transaction information comprises a contract address and transaction service parameters.
And the transaction initiating node is further used for sending the first encrypted transaction information to the intermediate node.
And the intermediate node is used for verifying the validity of the first encrypted transaction information, and after the validity is verified, the first encrypted transaction information and the first private key in the first key pair are encrypted by using the second public key disclosed by the accounting node in the blockchain network to obtain second encrypted transaction information.
The intermediate node is further configured to send the second encrypted transaction information to an accounting node in the blockchain network.
And the billing node is used for verifying the validity of the second encrypted transaction information, performing a re-decryption process on the second encrypted transaction information after the validity is verified, obtaining a first private key and first encrypted transaction information, and performing a re-decryption process on the first encrypted transaction information by using the first private key, so as to obtain a contract address and transaction service parameters.
And the accounting node is used for acquiring the intelligent contract matched with the contract address from the blockchain network according to the contract address, and executing the transaction corresponding to the transaction service parameter based on the transaction service parameter and the acquired intelligent contract to obtain transaction data.
And the billing node is also used for updating the state data in the intelligent contract by using the transaction data, fully homomorphic encrypting the updated state data, and publishing the fully homomorphic encrypted intelligent contract after encrypting so as to complete the transaction after publishing.
The working process, working details and technical effects of the device provided in this embodiment may refer to the second aspect of the embodiment, and are not described herein again.
As shown in fig. 3, a third aspect of the present embodiment provides a blockchain transaction device based on an intelligent contract, taking the device as an electronic device as an example, including: the system comprises a memory, a processor and a transceiver which are connected in sequence in communication, wherein the memory is used for storing a computer program, the transceiver is used for receiving and transmitting messages, and the processor is used for reading the computer program and executing the blockchain transaction method based on the intelligent contract according to the first aspect of the embodiment.
By way of specific example, the Memory may include, but is not limited to, random access Memory (random access Memory, RAM), read Only Memory (ROM), flash Memory (Flash Memory), first-in-first-Out Memory (First Input First Output, FIFO) and/or first-in-last-Out Memory (FIRST IN LAST Out, FILO), and the like; in particular, the processor may include one or more processing cores, such as a 4-core processor, an 8-core processor, or the like. The processor may be implemented in at least one hardware form of DSP (DIGITAL SIGNAL Processing), FPGA (Field-Programmable gate array), PLA (Programmable Logic Array ), and may also include a main processor and a coprocessor, where the main processor is a processor for Processing data in a wake-up state, and is also called CPU (Central Processing Unit ); a coprocessor is a low-power processor for processing data in a standby state.
In some embodiments, the processor may be integrated with a GPU (Graphics Processing Unit, image processor) for rendering and drawing of content required to be displayed by the display screen, e.g., the processor may not be limited to a microprocessor of the STM32F105 family, a reduced instruction set computer (reduced instruction set computer, RISC) microprocessor, an X86 or other architecture processor, or a processor that integrates an embedded neural network processor (neural-network processing units, NPU); the transceiver may be, but is not limited to, a wireless fidelity (WIFI) wireless transceiver, a bluetooth wireless transceiver, a General Packet Radio Service (GPRS) wireless transceiver, a ZigBee wireless transceiver (low power local area network protocol based on the ieee802.15.4 standard), a 3G transceiver, a 4G transceiver, and/or a 5G transceiver, etc. In addition, the device may include, but is not limited to, a power module, a display screen, and other necessary components.
The working process, working details and technical effects of the electronic device provided in this embodiment may refer to the first aspect of the embodiment, and are not described herein again.
A fourth aspect of the present embodiment provides a storage medium storing instructions containing the intelligent contract-based blockchain transaction method of the first aspect of the present embodiment, i.e., the storage medium has instructions stored thereon that, when executed on a computer, perform the intelligent contract-based blockchain transaction method of the first aspect of the present embodiment.
The storage medium refers to a carrier for storing data, and may include, but is not limited to, a floppy disk, an optical disk, a hard disk, a flash Memory, a flash disk, and/or a Memory Stick (Memory Stick), where the computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable devices.
The working process, working details and technical effects of the storage medium provided in this embodiment may refer to the first aspect of the embodiment, and are not described herein again.
A fifth aspect of the present embodiment provides a computer program product comprising instructions which, when run on a computer, cause the computer to perform the intelligent contract-based blockchain transaction method of the first aspect of the embodiment, wherein the computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable device.
Finally, it should be noted that: the foregoing description is only of the preferred embodiments of the invention and is not intended to limit the scope of the invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A blockchain transaction method based on intelligent contracts, comprising:
The transaction initiating node selects any edge node from a plurality of edge nodes as an intermediate node of the transaction, and sends a key acquisition request to the intermediate node, wherein the plurality of edge nodes are independently deployed between the blockchain network and the transaction initiating node;
After receiving the key acquisition request, the intermediate node generates a first key pair for the transaction, and sends a first public key of the first key pair to the transaction initiating node;
The transaction initiating node receives a first public key, and encrypts transaction information by using the first public key to obtain first encrypted transaction information, wherein the first encrypted transaction information comprises a contract address and transaction service parameters;
The transaction initiating node sends the first encrypted transaction information to the intermediate node;
the intermediate node performs validity verification on the first encrypted transaction information, and after the validity verification is passed, the intermediate node performs encryption processing on the first encrypted transaction information and a first private key in the first key pair by using a second public key disclosed by an accounting node in a blockchain network to obtain second encrypted transaction information;
The intermediate node sends the second encrypted transaction information to an accounting node in a blockchain network;
The billing node performs validity verification on the second encrypted transaction information, and after the validity verification is passed, performs one-time decryption on the second encrypted transaction information to obtain a first private key and first encrypted transaction information, and performs one-time decryption on the first encrypted transaction information by using the first private key to obtain a contract address and transaction service parameters;
The accounting node acquires an intelligent contract matched with the contract address from a blockchain network according to the contract address, and executes a transaction corresponding to the transaction service parameter based on the transaction service parameter and the acquired intelligent contract to obtain transaction data;
The billing node updates the state data in the intelligent contract by using the transaction data, fully encrypts the updated state data, and publishes the fully encrypted intelligent contract after encryption so as to complete the transaction after publication.
2. The method of claim 1, wherein the intermediate node, upon receiving the key acquisition request, generates a first key pair for the current transaction, comprising:
The intermediate node selects a random number meeting a preset condition from a random number library to be used as a first sub-public key, wherein the preset condition is that the selected random number is prime, and the difference between the selected random number and 1 has a large prime factor;
Determining a second sub-public key based on the first sub-public key;
the intermediate node randomly selects an integer from the integer set as a first private key;
Calculating a third sub public key based on the first sub public key, the second sub public key and the first private key;
Forming a first public key by using the first sub public key, the second sub public key and the third sub public key;
And utilizing the first public key and the first private key to form the first key pair.
3. The method of claim 2, wherein the second sub-public key is a positive integer, wherein the second sub-public key and the first sub-public key satisfy therebetweenAnd/>Are different from each other, and/>Representing the second sub-public key,/>Representing a first sub-public key;
Correspondingly, calculating the third sub public key based on the first sub public key, the second sub public key and the first private key includes:
based on the first sub public key, the second sub public key and the first private key, calculating to obtain a third sub public key according to the following formula (1);
(1)
in the above-mentioned formula (1), Representing a third sub-public key,/>Representing the first private key, mod represents the modulo operation.
4. The method of claim 1, wherein the first public key comprises a first sub-public key, a second sub-public key, and a third sub-public key, wherein the transaction initiating node receives the first public key and encrypts the transaction information using the first public key to obtain first encrypted transaction information, and wherein the encrypting the transaction information comprises:
The transaction initiating node randomly generates an integer as a first encryption parameter;
Calculating a second encryption parameter by using the first sub-public key, the third sub-public key and the first encryption parameter according to the following formula (2);
(2)
In the above-mentioned formula (2), Representing the second encryption parameter,/>Representing a third sub-public key,/>Representing a first sub-public key,/>Representing the first encryption parameter, mod representing a modulo operation;
according to the first encryption parameter, the second sub-public key and the first sub-public key, a first ciphertext is calculated according to the following formula (3);
(3)
In the above-mentioned formula (3), Representing the first ciphertext,/>Representing the second sub-public key;
Performing coding operation on the transaction service parameters and the contract address to obtain a first coding value and a second coding value respectively, and performing splicing processing on the first coding value and the second coding value to obtain a transaction plaintext;
based on the second encryption parameter and the first sub-public key, encrypting the transaction plaintext according to the following formula (4) to obtain a second ciphertext;
(4)
in the above-mentioned formula (4), Representing the second ciphertext,/>Representing the plaintext of the transaction;
forming initial encrypted transaction information by utilizing the first ciphertext and the second ciphertext;
And carrying out digital signature processing on the initial encrypted transaction information to obtain the first encrypted transaction information after the digital signature processing.
5. The method of claim 1, wherein encrypting the first encrypted transaction information and the first private key in the first key pair using a second public key disclosed by a billing node in a blockchain network to obtain second encrypted transaction information comprises:
after the validity verification is passed, the intermediate node sends an encryption request to an accounting node in the blockchain network;
after receiving the encryption request, the billing node generates two large prime numbers for the transaction, and generates a second private key and a second public key by using the two large prime numbers;
The billing node utilizes the second private key and the second public key to form a second key pair, stores the second private key in the second key pair, and transmits the second public key in the second key pair to the intermediate node;
The intermediate node encrypts the first encrypted transaction information and a first private key in the first key pair by using the second public key to obtain initial second encrypted transaction information;
and carrying out digital signature processing on the initial second encrypted transaction information to obtain second encrypted transaction information.
6. The method of claim 5, wherein the billing node, upon receiving the encryption request, generates two large prime numbers for the current transaction comprising:
The method comprises the steps that a billing node randomly generates a group of first arrays, wherein any element in the first arrays is odd, any element can be divided by a preset value, and any element is larger than a calibration threshold value;
acquiring a pseudo prime number table, and screening elements in the first array based on the pseudo prime number table to remove pseudo prime numbers in the array so as to obtain a second array;
performing prime number judgment on each element in the second array by using a probability property prime number judgment algorithm, and screening out elements belonging to prime numbers in the second array to form a prime number library;
and randomly selecting two elements from the prime number database to serve as two large prime numbers corresponding to the transaction.
7. The method of claim 1, wherein the billing node performs a re-decryption process on the second encrypted transaction information to obtain the first private key and the first encrypted transaction information, comprising:
the billing node uses a second private key of the billing node to perform repeated decryption processing on the second encrypted transaction information to obtain a first private key and first encrypted transaction information, wherein the second private key corresponds to the second public key, and the first encrypted transaction information comprises a first ciphertext and a second ciphertext;
correspondingly, the billing node performs double decryption processing on the first encrypted transaction information by using the first private key to obtain a contract address and transaction service parameters, including:
the method comprises the steps that an accounting node obtains a first public key which is disclosed by an intermediate node and corresponds to a first private key, wherein the first public key comprises a first sub-public key;
the billing node decrypts the first ciphertext by using the first sub-public key and the first private key according to the following formula (5) to obtain a plaintext corresponding to the first ciphertext;
(5)
In the above-mentioned formula (5), Representing plaintext corresponding to the first ciphertext,/>Representing the first ciphertext,/>Representing a first private key of the device,Representing a first sub-public key, mod represents a modulo operation;
The billing node decrypts the second ciphertext based on the plaintext corresponding to the first ciphertext and the first sub-public key according to the following formula (6) to obtain a transaction plaintext;
(6)
In the above-mentioned formula (6), Representing the plaintext of the transaction,/>Representing a second ciphertext;
and the accounting node obtains the contract address and the transaction service parameter according to the transaction plaintext.
8. A blockchain transaction system based on smart contracts, comprising: a transaction initiation node, an accounting node, and a plurality of edge nodes;
The transaction initiating node is used for selecting any edge node from a plurality of edge nodes as an intermediate node of the transaction, and sending a key acquisition request to the intermediate node, wherein the plurality of edge nodes are independently deployed between the blockchain network and the transaction initiating node;
The intermediate node is used for generating a first key pair for the transaction after receiving the key acquisition request and sending a first public key of the first key pair to the transaction initiating node;
The transaction initiating node is used for receiving the first public key, and encrypting the transaction information by utilizing the first public key to obtain first encrypted transaction information, wherein the first encrypted transaction information comprises a contract address and transaction service parameters;
The transaction initiating node is further configured to send the first encrypted transaction information to the intermediate node;
the intermediate node is used for verifying the validity of the first encrypted transaction information, and after the validity is verified, the first encrypted transaction information and a first private key in the first key pair are encrypted by using a second public key disclosed by an accounting node in the blockchain network to obtain second encrypted transaction information;
the intermediate node is further used for sending the second encrypted transaction information to an accounting node in the blockchain network;
The billing node is used for verifying the validity of the second encrypted transaction information, performing a re-decryption process on the second encrypted transaction information after the validity is verified, obtaining a first private key and first encrypted transaction information, and performing a re-decryption process on the first encrypted transaction information by using the first private key, so as to obtain a contract address and transaction service parameters;
The accounting node is used for acquiring an intelligent contract matched with the contract address from the blockchain network according to the contract address, and executing a transaction corresponding to the transaction service parameter based on the transaction service parameter and the acquired intelligent contract to obtain transaction data;
And the billing node is also used for updating the state data in the intelligent contract by using the transaction data, fully homomorphic encrypting the updated state data, and publishing the fully homomorphic encrypted intelligent contract after encrypting so as to complete the transaction after publishing.
9. An electronic device, comprising: a memory, a processor and a transceiver in communication with each other, wherein the memory is configured to store a computer program, the transceiver is configured to receive and transmit messages, and the processor is configured to read the computer program and perform the smart contract-based blockchain transaction method of any of claims 1-7.
10. A computer readable storage medium having instructions stored thereon which, when executed on a computer, perform the intelligent contract-based blockchain transaction method of any of claims 1-7.
CN202311615004.6A 2023-11-29 2023-11-29 Block chain transaction method, system, electronic equipment and medium based on intelligent contract Active CN117614707B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311615004.6A CN117614707B (en) 2023-11-29 2023-11-29 Block chain transaction method, system, electronic equipment and medium based on intelligent contract

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311615004.6A CN117614707B (en) 2023-11-29 2023-11-29 Block chain transaction method, system, electronic equipment and medium based on intelligent contract

Publications (2)

Publication Number Publication Date
CN117614707A CN117614707A (en) 2024-02-27
CN117614707B true CN117614707B (en) 2024-05-14

Family

ID=89953070

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311615004.6A Active CN117614707B (en) 2023-11-29 2023-11-29 Block chain transaction method, system, electronic equipment and medium based on intelligent contract

Country Status (1)

Country Link
CN (1) CN117614707B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118378287B (en) * 2024-06-21 2024-09-06 深圳市豪斯莱科技有限公司 Encryption system for digital collection

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107342858A (en) * 2017-07-05 2017-11-10 武汉凤链科技有限公司 A kind of intelligent contract guard method and system based on trusted context
CN107911216A (en) * 2017-10-26 2018-04-13 矩阵元技术(深圳)有限公司 A kind of block chain transaction method for secret protection and system
CN109361704A (en) * 2018-12-12 2019-02-19 深圳市网心科技有限公司 Cloud storage data encryption and transmission method, system, equipment and storage medium
CN109462588A (en) * 2018-11-13 2019-03-12 上海物融智能科技有限公司 A kind of decentralization data trade method and system based on block chain
CN110020538A (en) * 2019-04-15 2019-07-16 山东省计算中心(国家超级计算济南中心) Transaction data encryption and decryption method and system based on block chain
CN111639362A (en) * 2019-02-19 2020-09-08 阿里巴巴集团控股有限公司 Method, node and storage medium for implementing privacy protection in block chain
WO2021233090A1 (en) * 2020-05-19 2021-11-25 京东数科海益信息科技有限公司 Transaction tracing method and apparatus based on blockchain
CN113837875A (en) * 2020-06-22 2021-12-24 京东方科技集团股份有限公司 Transaction method, node and medium based on block chain network
CN114529297A (en) * 2022-01-25 2022-05-24 苏州浪潮智能科技有限公司 Offline transaction method and device based on block chain and storage medium
CN114548983A (en) * 2021-08-26 2022-05-27 厦门哈希科技有限公司 Block chain private data processing method, carbon transaction implementation method and system
KR20230052165A (en) * 2021-10-12 2023-04-19 삼성전자주식회사 Electronic device including partial ledger and method in blockchain network

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107342858A (en) * 2017-07-05 2017-11-10 武汉凤链科技有限公司 A kind of intelligent contract guard method and system based on trusted context
CN107911216A (en) * 2017-10-26 2018-04-13 矩阵元技术(深圳)有限公司 A kind of block chain transaction method for secret protection and system
CN109462588A (en) * 2018-11-13 2019-03-12 上海物融智能科技有限公司 A kind of decentralization data trade method and system based on block chain
CN109361704A (en) * 2018-12-12 2019-02-19 深圳市网心科技有限公司 Cloud storage data encryption and transmission method, system, equipment and storage medium
CN111639362A (en) * 2019-02-19 2020-09-08 阿里巴巴集团控股有限公司 Method, node and storage medium for implementing privacy protection in block chain
CN110020538A (en) * 2019-04-15 2019-07-16 山东省计算中心(国家超级计算济南中心) Transaction data encryption and decryption method and system based on block chain
WO2021233090A1 (en) * 2020-05-19 2021-11-25 京东数科海益信息科技有限公司 Transaction tracing method and apparatus based on blockchain
CN113837875A (en) * 2020-06-22 2021-12-24 京东方科技集团股份有限公司 Transaction method, node and medium based on block chain network
CN114548983A (en) * 2021-08-26 2022-05-27 厦门哈希科技有限公司 Block chain private data processing method, carbon transaction implementation method and system
KR20230052165A (en) * 2021-10-12 2023-04-19 삼성전자주식회사 Electronic device including partial ledger and method in blockchain network
CN114529297A (en) * 2022-01-25 2022-05-24 苏州浪潮智能科技有限公司 Offline transaction method and device based on block chain and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
区块链交易数据隐私保护方法;许重建;李险峰;;计算机科学;20200331;47(03);全文 *

Also Published As

Publication number Publication date
CN117614707A (en) 2024-02-27

Similar Documents

Publication Publication Date Title
Zhang et al. Research on a covert communication model realized by using smart contracts in blockchain environment
CN111008836B (en) Privacy security transfer payment method, device, system and storage medium
CN108898475B (en) Attribute encryption-based alliance block chain credit implementation method and system
US20230108682A1 (en) Data processing method and apparatus, device, and computer-readable storage medium
EP4184410A1 (en) Operating system for blockchain iot devices
CN107395349A (en) A kind of block chain network cryptographic key distribution method based on self-certified public key system
CN113874897A (en) Computer-implemented system and method for effecting transfers over blockchain networks
CN117614707B (en) Block chain transaction method, system, electronic equipment and medium based on intelligent contract
CN110971390A (en) Fully homomorphic encryption method for intelligent contract privacy protection
Asfia et al. Energy trading of electric vehicles using blockchain and smart contracts
CN113095826B (en) Hidden communication method and system based on block chain multi-signature
CN103444128B (en) Key PV signs
CN107276752A (en) The methods, devices and systems that limitation key is decrypted are paid to cloud
CN110505067A (en) Processing method, device, equipment and the readable storage medium storing program for executing of block chain
CN113393225B (en) Digital currency encryption payment method and system
CN107070896B (en) Safe and efficient block chain network customized login method and safe reinforcement system
CN106341384A (en) Methods for facilitating secure communication
CN112115201A (en) Transaction processing method and device based on block chain and transaction tracking method and device
CN111738857B (en) Generation and verification method and device of concealed payment certificate applied to block chain
CN117744123A (en) Security protection method and system for private data, electronic equipment and storage medium
CN109660344A (en) Anti- quantum calculation block chain method of commerce and system based on unsymmetrical key pond route device
CN109687961A (en) Anti- quantum calculation block chain method of commerce and system based on pool of symmetric keys route device
CN110677246A (en) Key generation method and device based on block chain
CN111311210B (en) Asymmetric encryption digital currency transaction data processing method and device
CN114677128A (en) Block chain-based public purse cubing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant