Electronic resource trading methods, apparatus, electronic equipment and readable storage media

By combining binary relation pairs and adapter signature technology with smart contracts in electronic resource transactions, the problem of low security in electronic resource transactions is solved, enabling secure transactions without third-party guarantees and protecting the legitimate rights and interests of both parties.

CN116245646BActive Publication Date: 2026-05-26CHONGQING XINZHI JINFU INFORMATION TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHONGQING XINZHI JINFU INFORMATION TECH CO LTD
Filing Date
2023-03-14
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

Existing electronic resource trading schemes have low security, making it difficult to protect the legitimate rights and interests of both parties in the transaction. In particular, there are risks in the transaction process when there is no third-party guarantee.

Method used

Electronic resources are encrypted using binary relation pairs (such as public-private key pairs), and transaction behavior is bound through adapter signatures and smart contract technology to ensure transaction security.

Benefits of technology

It enables secure transactions without third-party guarantees, protects the legitimate rights and interests of both parties, and improves transaction efficiency and security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116245646B_ABST
    Figure CN116245646B_ABST
Patent Text Reader

Abstract

This application provides an electronic resource trading method, apparatus, electronic device, and readable storage medium. The method includes: applying to a resource sender; generating a binary relation pair, the binary relation pair including a first element and a second element; encrypting a pre-generated symmetric key using the first element to obtain key ciphertext; uploading the key ciphertext to a third-party storage node, and uploading the resource sender information, the storage address of the resource ciphertext and the key ciphertext, and the resource ciphertext information to a publicly available blockchain; receiving a smart contract deployment address sent by a resource receiver; sending the first element to the resource receiver; receiving a pre-signature sent by the resource receiver; verifying the pre-signature based on the first element, the transaction information of the publicly available resource ciphertext on the blockchain, and the blockchain public key of the resource receiver; if the verification is successful, converting the pre-signature into a signature using the second element and an adapter signature algorithm; sending the signature to the smart contract; and receiving digital assets transferred by the smart contract.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of blockchain technology, and in particular to an electronic resource trading method, apparatus, electronic device, and readable storage medium. Background Technology

[0002] Blockchain is increasingly being applied in fields such as finance, the Internet of Things, philanthropy, healthcare, and supply chains. Taking the financial sector as an example, blockchain enables fair digital asset transactions without the need for third-party institutions.

[0003] Currently, the typical implementation of blockchain transactions for electronic resources involves the two parties negotiating the transaction details offline, determining the order of transactions, and specifying the account addresses. The resource recipient first submits a blockchain transaction request to transfer digital assets to the designated account address. The resource sender then checks the on-chain transaction details to confirm the receipt of the digital assets and sends the transaction details to the resource recipient off-chain.

[0004] Current electronic resource trading methods have low security, and the legitimate rights and interests of both parties, especially the resource recipients, are not easily protected. Summary of the Invention

[0005] In order to improve the security of electronic resource transactions and enable the two parties to complete the transaction without third-party guarantee, thereby effectively protecting the legitimate rights and interests of both parties, this application provides an electronic resource transaction method, apparatus, electronic device, and readable storage medium.

[0006] Firstly, this application provides an electronic resource trading method applied to a resource sender; the method includes generating a binary relation pair, the binary relation pair including a first element and a second element; encrypting a pre-generated symmetric key using the first element to obtain key ciphertext; the symmetric key being used to encrypt the electronic resource to obtain resource ciphertext; uploading the key ciphertext to a third-party storage node to obtain the storage address of the key ciphertext; uploading the resource sender information, the storage address corresponding to the key ciphertext and the information of the resource ciphertext to the blockchain for public disclosure; and receiving the smart contract deployment address sent by the resource receiver after the resource receiver has deployed a smart contract. The smart contract is used to verify transaction conditions. When the transaction conditions are met, the digital assets of the resource recipient's account in the smart contract are transferred to the resource sender; the first element of the pre-generated binary relation pair is sent to the resource recipient; a pre-signature sent by the resource recipient is received; the pre-signature is generated based on the first element; the pre-signature is verified based on the first element, the transaction information of the publicly available encrypted resource on the blockchain, and the blockchain public key of the resource recipient; if the verification is successful, the pre-signature is converted into a signature using the second element and the adapter signature algorithm; the signature is sent to the smart contract; and the digital assets transferred by the smart contract are received.

[0007] In the above implementation process, by generating adapter signatures and cooperating with smart contract technology, the transfer of digital assets and the exposure of resource content in the transaction are bound together, making the transaction behavior atomic, thereby ensuring the security of the transaction and protecting the legitimate rights and interests of both parties.

[0008] Furthermore, the second element cannot be derived from the first element in polynomial time.

[0009] In the above implementation process, since the first element is public, the security of the transaction can be guaranteed when the second element cannot be derived from the first element in polynomial time.

[0010] Furthermore, the binary relation pair is a public-private key pair, which is used to encrypt or decrypt the symmetric key; the symmetric key is used to encrypt or decrypt the electronic resource; the first element is the public key in the public-private key pair; and the second element is the private key in the public-private key pair.

[0011] In the above implementation process, the public and private key pairs are treated as binary relation pairs, which can facilitate the encryption and / or decryption of the symmetric key while satisfying the generation conditions of the adapter signature.

[0012] Furthermore, before generating the binary relation pair, the method further includes: generating a symmetric key; encrypting the electronic resource using the symmetric key to obtain the ciphertext of the resource; and uploading the ciphertext of the resource to a third-party storage node to obtain the storage address of the ciphertext of the resource.

[0013] In the above implementation process, since the binary relation pairs are generated in real time for each transaction, encrypting electronic resources with symmetric keys can achieve the effect of supporting multiple transactions with a single encryption, thereby improving transaction efficiency while ensuring the security of electronic resources.

[0014] Secondly, this application provides an electronic resource transaction method applied to a resource recipient. The method includes: deploying a smart contract on a blockchain; the smart contract is used to verify transaction conditions, and when the transaction conditions are met, transferring the digital assets of the resource recipient's account in the smart contract to the resource sender; receiving the deployment address of the smart contract sent by the blockchain; sending the address of the smart contract to the resource sender; receiving a first element sent by the resource sender; pre-signing the transaction information of the encrypted resource text on the blockchain according to the first element and the sender's own blockchain private key; the encrypted resource text is the encrypted electronic resource; the transaction information is published on the blockchain in advance by the resource sender; sending the pre-signature to the resource sender so that the resource sender generates a signature according to the pre-signature and submits the signature to the smart contract; obtaining the signature from the smart contract, and extracting a second element from the signature according to the first element and the pre-signature; the first element and the second element constitute a binary relation pair; decrypting the encrypted resource text according to the second element, the encrypted resource text being downloaded in advance from the blockchain based on the transaction information of the publicly available encrypted resource text on the blockchain.

[0015] In the above implementation process, the transfer of digital assets and the exposure of resource content in the transaction are bound together by the combined use of adapter signature and smart contract technology, making the transaction behavior atomic, thereby ensuring the security of the transaction and protecting the legitimate rights and interests of both parties.

[0016] Furthermore, the binary relation pair is a pre-generated public-private key pair, which is used to encrypt or decrypt the symmetric key; the symmetric key is used to encrypt or decrypt the electronic resource; and the first element is the public key in the public-private key pair.

[0017] In the above implementation process, the public and private key pairs are treated as binary relation pairs, which can facilitate the encryption and / or decryption of the symmetric key while satisfying the generation conditions of the adapter signature.

[0018] Thirdly, this application provides an electronic resource trading method applied to blockchain; the method includes: sending a smart contract deployment address to a resource recipient; the smart contract is used to verify transaction conditions, and when the transaction conditions are met, transferring the digital assets of the resource recipient's account in the smart contract to the resource sender; receiving a signature sent by the resource sender; the smart contract verifies the signature, and if the verification is successful, transferring the digital assets of the resource recipient's account in the smart contract to the resource sender.

[0019] In the above implementation process, by generating adapter signatures and cooperating with smart contract technology, the transfer of digital assets and the exposure of resource content in the transaction are bound together, making the transaction behavior atomic, thereby ensuring the security of the transaction and protecting the legitimate rights and interests of both parties.

[0020] Fourthly, this application provides an electronic resource trading device for use by a resource sender;

[0021] The device includes a relationship pair generation module, a key encryption module, a storage module, a transaction on-chain module, a second receiving module, a second sending module, a pre-signature receiving module, a pre-signature verification module, a signature generation module, a third sending module, and an asset receiving module.

[0022] The relation pair generation module is used to generate binary relation pairs, wherein the binary relation pairs include a first element and a second element;

[0023] The key encryption module is used to encrypt a pre-generated symmetric key using the first element to obtain key ciphertext; the symmetric key is used to encrypt the electronic resource to obtain resource ciphertext.

[0024] The storage module is used to upload the key ciphertext to a third-party storage node to obtain the storage address of the key ciphertext;

[0025] The transaction on-chain module is used to upload the key ciphertext to a third-party storage node to obtain the storage address of the key ciphertext;

[0026] The second receiving module is used to receive the smart contract deployment address sent by the resource recipient after the resource recipient has deployed the smart contract; the smart contract is used to verify the transaction conditions, and when the transaction conditions are met, the digital assets of the resource recipient's account in the smart contract are transferred to the resource sender;

[0027] The second sending module is used to send the first element of the pre-generated binary relation pair to the resource receiver;

[0028] The pre-signature receiving module is used to receive a pre-signature sent by the resource recipient; the pre-signature is generated based on the first element;

[0029] The pre-signature verification module is used to verify the pre-signature based on the first element, the transaction information of the publicly disclosed encrypted resource on the blockchain, and the blockchain public key of the resource recipient.

[0030] The signature generation module is used to convert the pre-signature into a signature using the second element and the adapter signature algorithm after the pre-signature verification is passed.

[0031] The third sending module is used to send the signature to the smart contract;

[0032] The asset receiving module is used to receive digital assets transferred by smart contracts.

[0033] Alternatively, the first element cannot be derived from the second element in polynomial time.

[0034] Optionally, the binary relation pair is a public-private key pair, where the first element is the public key in the public-private key pair, and the second element is the private key in the public-private key pair.

[0035] Fifthly, this application provides an electronic resource trading device applied to a resource recipient; the device includes a contract deployment module, a receiving module, a sending module, a pre-signature generation module, a pre-signature sending module, an extraction module, and a decryption module; the contract deployment module is used to deploy a smart contract on a blockchain; the smart contract is used to verify transaction conditions, and when the transaction conditions are met, the digital assets of the resource recipient's account in the smart contract are transferred to the resource sender; the receiving module is used to receive the deployment address of the smart contract sent by the blockchain; the sending module is used to send the address of the smart contract to the resource sender; the receiving module is used to receive a first element sent by the resource sender; the pre-signature generation module is used to generate a pre-signature based on the first element and its own blockchain private key. The system includes a pre-signature module for transmitting transaction information of encrypted resource text on a blockchain, wherein the encrypted resource text is the encrypted electronic resource, and the transaction information is published in advance on the blockchain by the resource sender; a pre-signature sending module for sending the pre-signature to the resource sender, enabling the resource sender to generate a signature based on the pre-signature and submit the signature to the smart contract; an extraction module for obtaining the signature from the smart contract and extracting a second element from the signature based on the first element and the pre-signature; the first element and the second element forming a binary relation pair; and a decryption module for decrypting the encrypted resource text based on the second element, wherein the encrypted resource text is downloaded in advance from the blockchain based on the transaction information of the publicly available encrypted resource text.

[0036] Optionally, the binary relation pair is a pre-generated public-private key pair, which is used to encrypt or decrypt the symmetric key; the symmetric key is used to encrypt or decrypt the electronic resource; and the first element is the public key in the public-private key pair.

[0037] Sixthly, this application provides an electronic resource trading device applied to blockchain; the device includes a fourth sending module, a signature receiving module, and a verification module; the fourth sending module is used to send a smart contract deployment address to a resource recipient; the smart contract is used to verify transaction conditions, and when the transaction conditions are met, the digital assets of the resource recipient's account in the smart contract are transferred to the resource sender; the signature receiving module is used to receive a signature sent by the resource sender; the verification module is used to verify the signature, and if the verification is successful, the digital assets of the resource recipient's account in the smart contract are transferred to the resource sender.

[0038] In a seventh aspect, this application provides an electronic device, comprising: a processor and a memory; the processor is configured to execute a program stored in the memory to implement the electronic resource trading method as described in any one of the first to third aspects.

[0039] Eighthly, this application provides a computer-readable storage medium storing one or more programs that can be executed by one or more processors to implement the electronic resource trading method as described in any one of the first to third aspects. Attached Figure Description

[0040] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0041] Figure 1 A flowchart illustrating the electronic resource trading method provided in Embodiment 1 of this application;

[0042] Figure 2 This is a schematic diagram of the structure of the electronic resource trading device provided in Embodiment 2 of this application;

[0043] Figure 3 This is a schematic diagram of the structure of the electronic resource trading device provided in Embodiment 3 of this application;

[0044] Figure 4 This is a schematic diagram of the structure of the electronic resource trading device provided in Embodiment 4 of this application;

[0045] Figure 5 This is a schematic diagram of the structure of the electronic device provided in Embodiment 5 of this application. Detailed Implementation

[0046] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.

[0047] To better understand the electronic resource trading solution provided in this application, the inventive concept of this application will be introduced below.

[0048] Given the low security of existing technologies in electronic resource transactions, the inventors, through creative research, believe that the low security stems from the lack of effective linkage between the exposure of electronic resource content and the transfer of digital assets. Only by effectively linking these two aspects can transaction risks be reduced, transaction security improved, and the legitimate rights and interests of both parties protected. Therefore, the inventors introduced smart contracts and adapter signature technology. Adapter signature technology fixes key information affecting the exposure of electronic resource content and key information allowing the transfer of digital assets into the adapter signature. The smart contract, acting as a substitute for a human, executes the transaction rules, verifies the adapter signature, and determines whether to proceed with the transfer of digital assets based on the verification result. The resource recipient can also extract the key information affecting the exposure of electronic resource content from the adapter signature to obtain the electronic resources, thus effectively ensuring transaction security.

[0049] To better understand the electronic resource trading solution provided in this application, the application scenarios of the technical solution are introduced below.

[0050] The electronic resource trading scheme provided in this application is applied to the trading of electronic resources. Electronic resources refer to resources stored in the form of electronic data, including but not limited to video files, electronic documents, music files, game items, etc. One application scenario of this application's transaction architecture includes a resource sender, a resource provider, and a blockchain, with communication connections between the resource sender, resource provider, and blockchain. The resource sender generates a binary relation pair, encrypts it with a symmetric key to obtain ciphertext, uploads the ciphertext to a third-party storage, and publishes the transaction information of the ciphertext on the blockchain. After viewing the transaction information on the blockchain, the resource receiver deploys a smart contract on the blockchain. The resource receiver and resource sender jointly generate an adapter signature, submit the adapter signature to the smart contract for verification, and after successful verification, transfer the digital assets of the asset receiver to the resource sender. The resource receiver can also decrypt the ciphertext by extracting the second element from the signature.

[0051] Example 1

[0052] To improve the security of electronic resource transactions, this application provides an electronic resource transaction method. Figure 1 This is a flowchart illustrating the electronic resource trading method provided in this application. When applied to a resource sender, the method includes:

[0053] S101: Generate a binary relation pair, which includes a first element and a second element.

[0054] S102: Encrypt the pre-generated symmetric key using the first element to obtain the key ciphertext. The symmetric key is used to encrypt electronic resources to obtain resource ciphertext.

[0055] S103: Upload the encrypted key to a third-party storage node to obtain the storage address of the encrypted key.

[0056] S104: Upload the resource sender information, the storage address corresponding to the resource ciphertext and key ciphertext, and the information of the resource ciphertext to the blockchain for public disclosure.

[0057] S105: After the resource recipient deploys the smart contract, receive the smart contract deployment address sent by the resource recipient. The smart contract is used to verify the transaction conditions. When the transaction conditions are met, the digital assets in the resource recipient's account are transferred to the resource sender.

[0058] S106: Send the first element of the pre-generated binary relation pair to the resource receiver.

[0059] S107: Receive a pre-signature sent by the resource recipient. The pre-signature is generated based on the first element.

[0060] S108: Verify the pre-signature based on the first element, the transaction information of the publicly available encrypted resource on the blockchain, and the blockchain public key of the resource recipient.

[0061] S109: If the verification passes, the pre-signature is converted into a signature using the second element and the adapter signature algorithm.

[0062] S110: Send the signature to the smart contract.

[0063] S111: Receive digital assets transferred via smart contracts.

[0064] When the electronic resource trading method provided in this application is applied to the resource recipient, it includes:

[0065] S201: Deploy smart contracts on the blockchain. Smart contracts are used to verify transaction conditions, and when the transaction conditions are met, the digital assets of the resource recipient's account are transferred to the resource sender in the smart contract.

[0066] S202: The deployment address of the smart contract sent by the blockchain.

[0067] S203: Send the address of the smart contract to the resource sender.

[0068] S204: The first element sent by the resource sender.

[0069] S205: Pre-sign the transaction information of the encrypted resource on the blockchain based on the first element and your own blockchain private key. The encrypted resource is an encrypted electronic resource. The transaction information is published on the blockchain in advance by the resource sender.

[0070] S206: Send the pre-signature to the resource sender so that the resource sender can generate a signature based on the pre-signature and submit the signature to the smart contract.

[0071] S207: Obtain the signature from the smart contract, and extract the second element from the signature based on the first element and the pre-signature. The first element and the second element form a binary relation pair.

[0072] S208: Decrypt the resource ciphertext based on the second element. The resource ciphertext is downloaded in advance from the blockchain based on the transaction information of the publicly available resource ciphertext.

[0073] Specifically, the method for decrypting the ciphertext of the resource based on the second element involves decrypting the ciphertext of the key based on the second element to obtain the symmetric key. The ciphertext of the resource is then decrypted using the symmetric key to obtain the electronic resource. The method of decrypting the ciphertext of the key using the second element corresponds to the method of encrypting the symmetric key. The method of decrypting the ciphertext of the resource using the symmetric key corresponds to the method of encrypting the electronic resource.

[0074] When the electronic resource trading method provided in this application is applied to blockchain, the method includes:

[0075] S301: Send the smart contract deployment address to the resource recipient. The smart contract is used to verify the transaction conditions. When the transaction conditions are met, the digital assets in the resource recipient's account are transferred to the resource sender.

[0076] S302: Receive the signature sent by the resource sender.

[0077] S303: Smart contract signature verification.

[0078] S304: If the verification is successful, the digital assets of the resource recipient's account in the smart contract will be transferred to the resource sender.

[0079] A smart contract is a set of commitments defined in digital form, including protocols that allow contract participants to execute these commitments. A binary relation pair is used to express that two elements are mathematically related. In this embodiment, the binary relation pair includes a first element and a second element. Both the first and second elements are numbers; the first element is a random natural number, and the second element is the coordinates of a point on a selected elliptic curve. The pre-signature is a concept in adapter signatures, which is a complete two-step signature algorithm including five specific algorithms: a pre-signature generation algorithm, a pre-signature verification algorithm, a signature generation algorithm, and an extraction algorithm.

[0080] Specifically, in step S101, the resource sender generates a binary relation pair, and the method for generating the binary relation pair is not specifically limited. In this embodiment, the method for generating the binary relation pair is as follows:

[0081] Random selection Calculate h = g x Then (h,x) is a binary relation pair.

[0082] in, Let q be the set of natural numbers coprime to q, and g be the generator of the selected elliptic curve.

[0083] In one feasible implementation, in S101, the first element in the binary relation pair cannot be derived from the second element in polynomial time.

[0084] Polynomial time refers to the time required to compute a problem that is no greater than a polynomial multiple of the problem size.

[0085] In the above implementation process, since the first element is public, the restriction that the second element cannot be derived from the first element in polynomial time can ensure the security of the transaction.

[0086] In one feasible implementation, in S101, the binary relation pair is a public-private key pair, where the first element is the public key and the second element is the private key.

[0087] The method for generating public and private key pairs is not specifically limited; any asymmetric encryption algorithm can be used to generate public and private key pairs.

[0088] Optionally, in the embodiments of this application, the public and private key pairs are generated using the Elliptic Curve Cryptography (ECC) algorithm.

[0089] In the above implementation process, the public and private key pairs are treated as binary relation pairs, which can facilitate the encryption and / or decryption of symmetric keys while satisfying the generation conditions of adapter signatures, achieving multiple benefits at once.

[0090] After generating the binary relation pair, step S102 is executed, where the first element of the binary relation pair is used to encrypt the pre-generated symmetric key to obtain the ciphertext. The encryption method is not specifically limited and can be any asymmetric encryption algorithm. In this embodiment, ECDSA and a public key are used to encrypt the symmetric key to obtain the ciphertext.

[0091] After generating the ciphertext key, step S103 is executed: the resource sender uploads the ciphertext key to a third-party storage node, which then returns the storage address of the ciphertext key to the resource sender. Since the resource sender encrypted the electronic resource and stored it on the third-party storage node before the transaction, the resource sender is able to know the storage address of the encrypted electronic resource.

[0092] Following S103, S104 is executed, whereby the resource sender sends an on-chain transaction request to the blockchain, publicly disclosing the transaction information of the encrypted electronic resource. This on-chain transaction request carries the resource sender's information, the storage address corresponding to the encrypted resource and key, and information about the encrypted resource. The resource sender's information is not limited; for example, it may include the resource sender's account and contact information. The information in the encrypted resource is not specifically limited, but it must at least include the resource price. For example, it may include a resource description and resource price.

[0093] After S104, the resource recipient finds the transaction information of the encrypted resource on the blockchain, executes S201 to deploy a smart contract on the blockchain, and then executes S301, where the blockchain returns the smart contract deployment address to the resource recipient. Then, S202 and S203 are executed, where the resource recipient receives the smart contract deployment address sent by the blockchain and notifies the resource sender of the smart contract address.

[0094] After executing S203, execute S105. After the resource sender receives the notification from the resource receiver and sees the smart contract on the blockchain, execute S106. Send the first element of the pre-generated binary relationship pair to the resource receiver off-chain. This first element is not specifically limited; for example, it can be a large random number.

[0095] Following S106, S204 is executed. After receiving the first element, the resource recipient pre-signs the transaction information based on the first element and its own blockchain private key. The method for generating the pre-signature is not specifically limited; for example, the elliptic curve public-key cryptography algorithm SM2 or the elliptic curve digital signature algorithm ECDSA can be used to pre-sign the transaction information.

[0096] Optionally, in this embodiment of the application, the pre-signature generation algorithm adopts the ECDSA algorithm. The specific implementation of the pre-signature generation algorithm is as follows:

[0097]

[0098] Where m is the transaction information, z is the hash value of m, G is the generator of the selected elliptic curve, k is the random number generated using the deterministic random algorithm RFC6979, * represents element-wise multiplication, Y is the first element, r is the X coordinate value of R, x is the blockchain private key of the resource recipient, || represents element concatenation, and perSign is the generated pre-signature, which contains R, Ra, s, and proof.

[0099] After the pre-signature is generated, step S206 is executed, and the resource recipient sends the pre-signature to the resource sender off-chain. Specifically, the resource recipient can send the pre-signature to the resource sender via network transmission. After executing S206, step S107 is executed, and the resource sender receives the pre-signature. Then, step S108 is executed, and the resource sender verifies the pre-signature. The pre-signature verification method is not specifically limited. However, this verification method must correspond to the pre-signature generation algorithm. In other words, if the pre-signature generation algorithm uses the SM2 algorithm, the pre-signature verification algorithm must also use the SM2 algorithm. If the pre-signature generation algorithm uses the ECDSA algorithm, the pre-signature verification algorithm must also use the ECDSA algorithm.

[0100] Optionally, the ECDSA algorithm can be implemented to verify pre-signatures in the following ways:

[0101]

[0102] Where s, Ra, and R are obtained by parsing the pre-signature, r is the X coordinate value of R, z is the hash value of the transaction information m, G is the generator of the selected elliptic curve, Y is the first element, and check is the verification identity symbol. When both identities in formula (2) are true, the pre-signature verification is successful.

[0103] Following S108, S109 is executed. If the pre-signature verification is successful, the resource sender converts the pre-signature into a signature based on the second element of the binary relation pair and the corresponding signature generation algorithm. The signature generation algorithm is not specifically limited, but it corresponds to the pre-signature generation algorithm.

[0104] Optionally, in this embodiment of the application, the adapter signature is generated using the ECDSA algorithm. The specific implementation is as follows:

[0105]

[0106] Where s and R are obtained by parsing the pre-signature, y is the second element, * represents element-wise multiplication, r is the X coordinate value of R, || represents element concatenation, and sign is the generated signature.

[0107] After generating the signature, step S110 is executed, whereby the resource sender submits the signature to a smart contract on the blockchain via a transaction. Following S110, step S302 is executed, where the smart contract receives the signature. Step S303 is executed, where the smart contract verifies the signature according to a pre-determined verification method. This verification method is not specifically limited. For example, verification can be performed by directly verifying the signature, or by extracting the signer's public key and comparing it with the resource recipient's blockchain public key. Existing technologies can be used for signature verification, which will not be elaborated upon here.

[0108] Optionally, in this embodiment of the application, the signature verification algorithm is implemented by using the ECDSA algorithm to recover the signer's public key to extract the signer's public key from the signature and comparing the public key with the blockchain public key of the resource recipient.

[0109] Once the signature verification is successful, execute S304, the smart contract extracts the resource price from the transaction information, extracts digital assets equal to the resource price from the account and transfers them to the resource sender, and the resource sender executes S111 to receive the digital assets.

[0110] After the smart contract transfers digital assets to the resource sender, the resource recipient executes S206, retrieving the signature from the blockchain. The resource recipient then extracts the second element from the signature based on the pre-signature, the first element, and the extraction algorithm. This extraction algorithm is not specifically limited, but it must correspond to the signature generation algorithm.

[0111] Optionally, in this embodiment, the extraction algorithm uses the ECDSA extraction algorithm. The specific implementation is as follows:

[0112]

[0113] Where s, R, and Y are obtained by parsing the pre-signature, and r and s a r is obtained by parsing the signature. imp Here is the X-coordinate value of R, and `check` is used to verify the identity symbol. If the formula is identical, subsequent calculations continue. `*` represents the element-wise dot product, and G is the generator of the selected elliptic curve. imp When Y is equal to Y, the extraction result y of the second element is... imp When equal to -, the extraction result of the second element is -y.

[0114] After the second element is extracted, the resource receiver executes step S207 to decrypt the ciphertext using the second element, obtaining the symmetric key. The decryption method corresponds to the encryption method used for the symmetric key. The resource receiver then uses the symmetric key and the corresponding decryption algorithm to decrypt the resource ciphertext, obtaining the electronic resource.

[0115] In one feasible implementation, before S101, which generates binary relation pairs, the method further includes:

[0116] S401: Generate a symmetric key.

[0117] The method for generating the symmetric key is not specifically limited and can be any symmetric encryption algorithm. Optionally, in this embodiment, the symmetric key is generated by the DES symmetric encryption algorithm.

[0118] S402: Encrypt the electronic resource using a symmetric key to obtain the ciphertext of the resource.

[0119] Specifically, the resource sender encrypts the electronic resource using a symmetric key and a corresponding symmetric encryption algorithm to obtain the ciphertext of the resource. The symmetric encryption algorithm is not specifically limited.

[0120] S403: Upload the encrypted resource to a third-party storage node to obtain the storage address of the encrypted resource.

[0121] Specifically, the resource sender sends the encrypted resource to a third-party storage node, and the storage node returns the storage address of the encrypted resource to the resource sender.

[0122] In the above implementation process, since the binary relation pairs are generated in real time for each transaction, encrypting electronic resources with symmetric keys can achieve the effect of supporting multiple transactions with a single encryption, thereby improving transaction efficiency while ensuring the security of electronic resources.

[0123] In the above implementation process, the transfer of digital assets and the exposure of resource content in the transaction are bound together by the combined use of adapter signature and smart contract technology, making the transaction behavior atomic, thereby ensuring the security of the transaction and protecting the legitimate rights and interests of both parties.

[0124] Example 2

[0125] This application provides an electronic resource trading device 600, such as... Figure 2 As shown, the device 600 is applied to the resource recipient. The device 600 includes a contract deployment module 601, a receiving module 602, a sending module 603, a pre-signature generation module 604, a pre-signature sending module 605, an extraction module 606, and a decryption module 607.

[0126] Contract deployment module 601 is used to deploy smart contracts on the blockchain. The smart contract verifies transaction conditions, and when these conditions are met, transfers the digital assets of the resource recipient's account to the resource sender within the smart contract.

[0127] The receiving module 602 is used to receive the deployment address of the smart contract sent by the blockchain.

[0128] The sending module 603 is used to send the address of the smart contract to the resource sender.

[0129] The receiving module 602 is used to receive the first element sent by the resource sender.

[0130] The pre-signature generation module 604 is used to pre-sign transaction information of the encrypted resource on the blockchain based on the first element and the user's own blockchain private key. The encrypted resource is an encrypted electronic resource. The transaction information is published on the blockchain in advance by the resource sender.

[0131] The pre-signature sending module 605 is used to send the pre-signature to the resource sender so that the resource sender can generate a signature based on the pre-signature and submit the signature to the smart contract.

[0132] Extraction module 606 is used to obtain the signature from the smart contract and extract the second element from the signature based on the first element and the pre-signature. The first element and the second element form a binary relation pair.

[0133] The decryption module 607 is used to decrypt the resource ciphertext based on the second element, which is downloaded in advance from the blockchain based on the transaction information of the publicly available resource ciphertext.

[0134] Optionally, in device 600, the binary relation pair is a pre-generated public-private key pair, which is used to encrypt or decrypt the symmetric key. The symmetric key is used to encrypt or decrypt electronic resources. The first element is the public key in the public-private key pair.

[0135] Example 3

[0136] This application provides an electronic resource trading device 700, such as... Figure 3 As shown, device 700 is applied to the resource sender. Device 700 includes a relationship pair generation module 701, a key encryption module 702, a storage module 703, a transaction on-chain module 704, a second receiving module 705, a second sending module 706, a pre-signature receiving module 707, a pre-signature verification module 708, a signature generation module 709, a third sending module 710, and an asset receiving module 711.

[0137] The relation pair generation module 701 is used to generate binary relation pairs, which include a first element and a second element.

[0138] The key encryption module 702 is used to encrypt a pre-generated symmetric key using a first element to obtain key ciphertext. The symmetric key is used to encrypt electronic resources to obtain resource ciphertext.

[0139] Storage module 703 is used to upload the key ciphertext to a third-party storage node to obtain the storage address of the key ciphertext.

[0140] The transaction on-chain module 704 is used to upload the key ciphertext to a third-party storage node and obtain the storage address of the key ciphertext.

[0141] The second receiving module 705 is used to receive the smart contract deployment address sent by the resource recipient after the resource recipient has deployed the smart contract. The smart contract is used to verify the transaction conditions, and when the transaction conditions are met, the digital assets in the resource recipient's account are transferred to the resource sender.

[0142] The second sending module 706 is used to send the first element of the pre-generated binary relation pair to the resource receiver.

[0143] The pre-signature receiving module 707 is used to receive a pre-signature sent by the resource recipient. The pre-signature is generated based on the first element.

[0144] The pre-signature verification module 708 is used to verify the pre-signature based on the first element, the transaction information of the publicly disclosed encrypted resource on the blockchain, and the blockchain public key of the resource recipient.

[0145] The signature generation module 709 is used to convert the pre-signature into a signature using the second element and the adapter signature algorithm after the pre-signature verification is passed.

[0146] The third sending module 710 is used to send the signature to the smart contract.

[0147] Asset receiving module 711 is used to receive digital assets transferred by smart contracts.

[0148] Alternatively, in device 700, the first element cannot be derived into the second element in polynomial time.

[0149] Optionally, in device 700, the binary relation pair is a public-private key pair, where the first element is the public key and the second element is the private key.

[0150] Example 4

[0151] This application provides an electronic resource trading device 800, such as... Figure 4 As shown, device 800 is applied to blockchain. Device 800 includes a fourth sending module 801, a signature receiving module 802, and a verification module 803.

[0152] The fourth sending module 801 is used to send the smart contract deployment address to the resource recipient. The smart contract is used to verify the transaction conditions, and when the transaction conditions are met, the digital assets in the resource recipient's account are transferred to the resource sender.

[0153] The signature receiving module 802 is used to receive the signature sent by the resource sender.

[0154] The verification module 803 is used to verify the signature. If the verification is successful, the digital assets of the resource recipient's account in the smart contract will be transferred to the resource sender.

[0155] Example 5

[0156] This application provides an electronic device 900, such as... Figure 5 As shown, the electronic device 900 includes a processor 901 and a memory 902. The processor 901 is used to execute the program stored in the memory 902 to implement the electronic resource trading method as described in any one of Embodiments 1.

[0157] Understandable. Figure 5 The structure shown is for illustrative purposes only; the electronic device may also include components that are more advanced than those shown. Figure 5 The more or fewer components shown, or having the same Figure 5 The different configurations shown.

[0158] For example, the processor 901 and the memory 902 may be connected via a communication bus. As another example, the electronic device may also include components such as a display, mouse, and keyboard.

[0159] In this embodiment, the processor 901 can be a central processing unit, a microprocessor, a microcontroller, etc., but this is not a limitation. The memory 902 can be a random access memory, a read-only memory, a programmable read-only memory, an erasable read-only memory, an electrically erasable read-only memory, etc., but this is not a limitation.

[0160] In the embodiments of this application, the electronic device can be, but is not limited to, physical devices such as desktop computers, laptops, smartphones, smart wearable devices, and in-vehicle devices, or virtual devices such as virtual machines. Furthermore, the electronic device is not necessarily a single device; it can be a combination of multiple devices, such as a server cluster, etc.

[0161] This application also provides a computer-readable storage medium, such as a floppy disk, optical disk, hard disk, flash memory, USB flash drive, SD (Secure Digital Memory Card), MMC (Multimedia Card), etc., which stores one or more programs. These programs can be executed by one or more processors to implement the electronic resource trading method described in any of the embodiments.

[0162] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and there may be other division methods in actual implementation. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.

[0163] In the various embodiments of this application, the functional modules can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.

[0164] In this document, relational terms such as first and second are used only to distinguish one entity or operation from another entity or operation, without necessarily requiring or implying any such actual relationship or order between these entities or operations.

[0165] In this article, "multiple" refers to two or more.

[0166] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.

Claims

1. A method for electronic resource trading, characterized in that, Applied to the resource sender; including: Generate binary relation pairs, wherein the binary relation pairs include a first element and a second element; The first element is used to encrypt a pre-generated symmetric key to obtain key ciphertext; the symmetric key is used to encrypt electronic resources to obtain resource ciphertext. The encrypted key is uploaded to a third-party storage node to obtain the storage address of the encrypted key. The information of the resource sender, the storage address of the resource ciphertext and the key ciphertext, and the information of the resource ciphertext are uploaded to the blockchain for public disclosure; After the resource recipient deploys the smart contract, the system receives the smart contract deployment address sent by the resource recipient. The smart contract is used to verify the transaction conditions. When the transaction conditions are met, the system transfers the digital assets of the resource recipient's account in the smart contract to the resource sender. Send the first element to the resource recipient; Receive a pre-signature sent by the resource recipient; the pre-signature is generated based on the first element and the Elliptic Curve Digital Signature Algorithm (ECDSA). The pre-signature is verified based on the first element, the transaction information of the publicly disclosed encrypted resource on the blockchain, the blockchain public key of the resource recipient, and ECDSA. If the verification passes, the pre-signature is converted into a signature using the second element and the adapter signature algorithm. Send the signature to the smart contract; Receive digital assets transferred via smart contracts.

2. The electronic resource trading method as described in claim 1, characterized in that, The second element cannot be derived from the first element in polynomial time.

3. The electronic resource trading method as described in claim 1 or 2, characterized in that, The binary relation pair is a public-private key pair, where the first element is the public key in the public-private key pair, and the second element is the private key in the public-private key pair.

4. The electronic resource trading method as described in claim 3, characterized in that, Before generating binary relation pairs, the method further includes: Generate a symmetric key; The electronic resources are encrypted using the symmetric key to obtain the ciphertext of the resources; The encrypted resource is uploaded to the third-party storage node to obtain the storage address of the encrypted resource.

5. A method for electronic resource trading, characterized in that, Applied to the resource recipient, the method includes: Deploy smart contracts on the blockchain; the smart contracts are used to verify transaction conditions, and when the transaction conditions are met, transfer the digital assets of the resource recipient's account in the smart contract to the resource sender; Receive the deployment address of the smart contract sent by the blockchain; Send the address of the smart contract to the resource sender; Receive the first element sent by the resource sender; The transaction information of the encrypted resource on the blockchain is pre-signed based on the first element, the Elliptic Curve Digital Signature Algorithm (ECDSA), and the private key of the user's blockchain; the encrypted resource is an encrypted electronic resource; the transaction information is published on the blockchain in advance by the resource sender. The pre-signature is sent to the resource sender so that the resource sender generates a signature based on the pre-signature and submits the signature to the smart contract; The signature is obtained from the smart contract, and the second element is extracted from the signature based on the first element and the pre-signature; the first element and the second element constitute a binary relation pair. The resource ciphertext is decrypted based on the second element, and the resource ciphertext is downloaded in advance from the blockchain based on the transaction information of the resource ciphertext publicly available on the blockchain.

6. The electronic resource trading method as described in claim 5, characterized in that, The binary relation pair is a pre-generated public-private key pair, which is used to encrypt or decrypt the symmetric key; the symmetric key is used to encrypt or decrypt the electronic resource; the first element is the public key in the public-private key pair.

7. A method for electronic resource trading, characterized in that, Applied to blockchain; the method includes: Send a smart contract deployment address to the resource recipient so that the resource sender can execute the method as described in claim 1; the smart contract is used to verify transaction conditions, and when the transaction conditions are met, the digital assets of the resource recipient's account in the smart contract are transferred to the resource sender; Receive the signature sent by the resource sender; The smart contract verifies the signature. If the verification is successful, the digital assets of the resource recipient's account in the smart contract are transferred to the resource sender.

8. An electronic resource trading device, characterized in that, Applied to the resource sender; the device includes a relationship pair generation module, a key encryption module, a storage module, a transaction on-chain module, a second receiving module, a second sending module, a pre-signature receiving module, a pre-signature verification module, a signature generation module, a third sending module, and an asset receiving module; The relation pair generation module is used to generate binary relation pairs, wherein the binary relation pairs include a first element and a second element; The key encryption module is used to encrypt a pre-generated symmetric key using the first element to obtain key ciphertext; the symmetric key is used to encrypt electronic resources to obtain resource ciphertext. The storage module is used to upload the key ciphertext to a third-party storage node to obtain the storage address of the key ciphertext; The transaction on-chain module is used to upload the information of the resource sender, the storage address of the resource ciphertext and the key ciphertext, and the information of the resource ciphertext to the blockchain for public disclosure; The second receiving module is used to receive the smart contract deployment address sent by the resource recipient after the resource recipient has deployed the smart contract; the smart contract is used to verify the transaction conditions, and when the transaction conditions are met, the digital assets of the resource recipient's account in the smart contract are transferred to the resource sender; The second sending module is used to send the first element to the resource receiver; The pre-signature receiving module is used to receive the pre-signature sent by the resource recipient; The pre-signature is generated based on the first element and the Elliptic Curve Digital Signature Algorithm (ECDSA). The pre-signature verification module is used to verify the pre-signature based on the first element, the transaction information of the publicly disclosed encrypted resource on the blockchain, the blockchain public key of the resource recipient, and ECDSA. The signature generation module is used to convert the pre-signature into a signature using the second element and the adapter signature algorithm after the pre-signature verification is passed. The third sending module is used to send the signature to the smart contract; The asset receiving module is used to receive digital assets transferred by smart contracts.

9. An electronic resource trading device, characterized in that, Applied to resource recipients; the device includes a contract deployment module, a receiving module, a sending module, a pre-signature generation module, a pre-signature sending module, an extraction module, and a decryption module; The contract deployment module is used to deploy smart contracts on the blockchain; the smart contract is used to verify transaction conditions, and when the transaction conditions are met, the digital assets of the resource recipient's account in the smart contract are transferred to the resource sender. The receiving module is used to receive the deployment address of the smart contract sent by the blockchain; The sending module is used to send the address of the smart contract to the resource sender; The receiving module is used to receive the first element sent by the resource sender; The pre-signature generation module is used to pre-sign transaction information of the encrypted resource on the blockchain based on the first element, the Elliptic Curve Digital Signature Algorithm (ECDSA), and the private key of the blockchain itself; the encrypted resource is an encrypted electronic resource; the transaction information is published on the blockchain in advance by the resource sender. The pre-signature sending module is used to send the pre-signature to the resource sender, so that the resource sender can generate a signature based on the pre-signature and submit the signature to the smart contract; The extraction module is used to obtain the signature from the smart contract, and extract the second element from the signature based on the first element and the pre-signature; the first element and the second element constitute a binary relation pair; The decryption module is used to decrypt the ciphertext of the resource based on the second element; The encrypted resource is downloaded in advance from the blockchain based on the transaction information of the publicly available encrypted resource on the blockchain.

10. An electronic resource trading device, characterized in that, Applied to blockchain; the device includes a fourth sending module, a signature receiving module, and a verification module; The fourth sending module is used to send the smart contract deployment address to the resource recipient so that the resource sender can execute the method as described in claim 1; the smart contract is used to verify the transaction conditions, and when the transaction conditions are met, the digital assets of the resource recipient's account in the smart contract are transferred to the resource sender. The signature receiving module is used to receive the signature sent by the resource sender; The verification module is used to verify the signature. If the verification is successful, the digital assets of the resource recipient's account in the smart contract are transferred to the resource sender.

11. An electronic device, characterized in that, include: Processor and memory; The processor is used to execute the program stored in the memory to implement the electronic resource trading method as described in any one of claims 1 to 7.

12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores one or more programs, which can be executed by one or more processors to implement the electronic resource trading method as described in any one of claims 1 to 7.