Nft atomic exchange method, system, computer readable storage medium and terminal device

By restricting the input/output structure and signing method of NFT transactions, and combining Merkel proofs and block header verification, the complexity of NFT transactions and the problem of reliance on trusted third parties are solved, enabling efficient and reliable offline NFT transactions.

CN114358948BActive Publication Date: 2026-01-02FUJIAN BOQUAN HASH TECHBOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210038211.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-13
Publication Date
2026-01-02
Estimated Expiration
2042-01-13

AI Technical Summary

Technical Problem

Existing NFT transaction solutions suffer from transaction complexity and reliance on trusted third parties, making it difficult to complete transactions efficiently when both parties are offline.

Method used

By restricting atomic swap transactions to multiple inputs and two outputs, the NFT seller fills in one input and one output, and the NFT buyer fills in the remaining inputs and outputs after verifying the existence and traceability of the transaction locally. Offline verification is performed using Merkel proofs and block headers, and the transaction is signed using the SINGLE|ANYONECANPAY method in SIGHASH_flag. The mapping relationship between NFTs and UTXOs is then published through public channels.

Benefits of technology

It enables efficient and simple NFT transactions even when both parties are offline, ensuring transaction consistency and not relying on a trusted third party. The transaction result has only two outcomes: success or failure, and the transaction process is transparent and reliable.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114358948B_ABST
    Figure CN114358948B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of non-homogeneous token circulation, and particularly discloses an NFT atomic exchange method, an NFT atomic exchange system, a computer readable storage medium and a terminal device, the method comprising the following steps: an NFT sender constructs a latest atomic exchange transaction of an NFT; the NFT sender sends the latest atomic exchange transaction of the NFT, a transaction chain between an original atomic exchange transaction corresponding to the NFT and a final atomic exchange transaction, and a Merkle proof of an output representing the NFT in the final atomic exchange transaction to an NFT buyer; the NFT buyer performs existence verification of the NFT and local tracing in a local SPV; after confirming that the transaction of the NFT exists and the tracing is successful, the NFT buyer fills in inputs and outputs in the latest atomic exchange transaction and broadcasts the latest atomic exchange transaction to full nodes to complete the latest atomic exchange transaction of the NFT. The application guarantees the consistency of NFT transactions, so that the NFT transactions can be independent of any trusted third party, and the whole transaction process is simple and efficient.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of non-fungible token circulation, and particularly relates to an NFT atomic exchange method, system, computer readable storage medium and terminal device. BACKGROUND

[0002] A token or a cryptographic token (in the context of blockchain) is a unique virtual token representing a digital asset on each blockchain. Cryptographic tokens are divided into two categories, namely homogeneous tokens and non-homogeneous tokens. Homogeneous tokens are the same, meaning that one token has exactly the same features as another token, as long as they are called the same name; and non-homogeneous tokens (NFT, Non-Fungible Token) are different, which have the characteristics of indivisibility, uniqueness, etc., indicating that no NFT has similar functions to other functions.

[0003] Non-homogeneous tokens (NFT) have the following characteristics: (1) standardization: NFT has some standardized functions, including ownership, transfer, etc. All non-homogeneous tokens have these functions. Any developer can take advantage of this function to build their own NFT. (2) universality: NFT is universal, that is, any application that wants to use NFT can use it. Because the blockchain is publicly accessible, and everyone can read the smart contract that deploys the NFT. (3) Liquidity: The liquidity market related to cryptographic assets is very large. People can easily exchange them for cash or other cryptocurrencies according to their needs. Therefore, NFT has high liquidity. (4) Invariability: Blockchain is famous for its invariability. NFT is implemented through a smart contract. This makes NFT immutable, that is, users cannot change their NFT to other NFTs. The ownership of NFT will be permanently recorded on the blockchain, unless the user decides to transfer it to other users. (5) Programmable: NFT is implemented through a smart contract. NFT tokens can be enhanced and contain other complex functions.

[0004] NFT is mostly used in the transaction of collectibles, game props, certificates, etc. The present application aims to provide a new NFT transaction scheme. SUMMARY

[0005] In view of the technical problems in the prior art, the present application provides an NFT atomic exchange method, system, computer readable storage medium and terminal device.

[0006] The NFT atomic exchange method of the present application comprises:

[0007] The NFT issuer constructs the latest atomic swap transaction of the NFT by taking a TxOut representing the NFT as an input, a lock script and an amount that can be opened by the NFT issuer as an output, wherein the atomic swap transaction is limited to include multiple inputs and two outputs;

[0008] The NFT issuer sends the latest atomic swap transaction of the NFT, a transaction chain between the original atomic swap transaction corresponding to the NFT and the final atomic swap transaction, and a Merkle proof of the output representing the NFT in the final atomic swap transaction to the NFT purchaser;

[0009] The NFT purchaser performs the existence verification of the NFT locally by the Merkle proof and the block header of the final atomic swap transaction, and if the verification is passed, the transaction exists;

[0010] The NFT purchaser performs the local tracing upwards along the transaction chain between the original atomic swap transaction and the final atomic swap transaction of the NFT by the input of the latest atomic swap transaction of the NFT, and if the final tracing result conforms to the pre-published NFT-TxOut mapping relationship, the tracing is successful;

[0011] After confirming that the transaction of the NFT exists and the tracing is successful, the NFT purchaser fills in the input and output in the latest atomic swap transaction of the NFT and broadcasts to the full node to complete the latest atomic swap transaction of the NFT.

[0012] Further, the method further comprises:

[0013] The one-to-one mapping relationship between the NFT and the TxOut represented by the NFT in the UTXO is pre-set as the NFT-TxOut mapping relationship, and is published to a public channel.

[0014] Further, the public channel comprises one or more of a microblog, a press conference and an exhibition.

[0015] Further, the NFT issuer limits the output of the atomic swap transaction to two outputs by the OP_PUSH_TX technology.

[0016] Further, when constructing the latest atomic swap transaction of the NFT, the NFT issuer signs the transaction by the SINGLE|ANYONECANPAY mode in the SIGHASH_flag.

[0017] Further, if the NFT purchaser confirms that the transaction of the NFT does not exist and / or the tracing fails, the transaction is ended.

[0018] The application also provides an NFT atomic swap system, which adopts the NFT atomic swap method to realize the atomic swap transaction of the NFT.

[0019] The application further provides a computer readable storage medium, and the computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the NFT atomic exchange method.

[0020] The application further provides a terminal device, which comprises a computer readable storage medium and a processor, wherein,

[0021] The computer readable storage medium stores computer instructions.

[0022] The processor is configured to run the computer instructions to enable the terminal device to execute the NFT atomic exchange method.

[0023] The NFT atomic exchange method, system, computer readable storage medium and terminal device provided by the application limit the atomic exchange transaction to multiple inputs and two outputs, fill in one output and one input by the NFT sender when constructing the latest atomic exchange transaction, and fill in the remaining inputs and outputs by the NFT buyer after verifying the existence of the transaction and successfully tracing the source locally, so as to complete the atomic exchange transaction. The NFT atomic exchange method, system, computer readable storage medium and terminal device provided by the application perform the transaction of NFT, and the transaction result has only two results of success and failure, thereby ensuring the consistency of the transaction. Moreover, the existence verification of NFT can be completed locally (in an offline state) through the Merkle proof of the final atomic exchange transaction and the block header, and the tracing of NFT can be completed locally (in an offline state) through the input of the latest atomic exchange transaction of NFT and the transaction chain between the original atomic exchange transaction and the final atomic exchange transaction, thereby completing the transaction of NFT in the case that both parties are offline, and the entire transaction process is simple and efficient. Meanwhile, in the NFT atomic exchange method provided by the application, the transaction of NFT is point-to-point, and does not need to depend on any trusted third party. In addition, the one-to-one mapping relationship between the NFT and the TxOut represented by the NFT in the UTXO is published in a public channel in advance, so as to facilitate the user to know the corresponding relationship between the NFT and the TxOut represented by the NFT in the UTXO. BRIEF DESCRIPTION OF DRAWINGS

[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed in the embodiments or the prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor on the basis of these drawings.

[0025] Figure 1 It is a NFT atomic exchange method flowchart of an embodiment of the present application.

[0026] Figure 2 This is a schematic diagram illustrating the implementation principle of limiting the number of transaction outputs according to an embodiment of the present invention;

[0027] Figure 3 This is a schematic diagram of a transaction signed using the SINGLE|ANYONECANPAY method according to an embodiment of the present invention;

[0028] Figure 4 This is a schematic diagram illustrating the implementation principle of an NFT atomic exchange method according to an embodiment of the present invention.

[0029] Figure 5 This is a schematic diagram of another NFT atomic exchange method according to an embodiment of the present invention;

[0030] Figure 6 This is a schematic diagram illustrating the principle of upward tracing in an embodiment of the present invention.

[0031] Figure 7 This is a structural diagram of a terminal device according to an embodiment of the present invention. Detailed Implementation

[0032] The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the protection scope of the present invention.

[0033] In one embodiment of the present invention, an NFT atomic swap method is provided, wherein the term "atomic" in atomic swap represents the consistency of the transaction, that is, the transaction is either completely successful or completely unsuccessful. If either party to the transaction abandons the transaction or fails to execute it as expected during the transaction process, the contract will be cancelled and the funds will be automatically returned to their original owner.

[0034] like Figure 1 As shown, the NFT atomic swap method provided in this embodiment includes the following steps:

[0035] Step S10: The NFT seller takes the TxOut representing an NFT as input, the lock script that the NFT seller can open, and the amount as output to construct the latest atomic swap transaction for the NFT.

[0036] In this context, atomic swap transactions are restricted to having multiple inputs and two outputs.

[0037] In this step, the TxOut representing an NFT refers to an unspent transaction output owned by the NFT issuer. The locking script is a script that can be opened by the NFT issuer, for example, the locking script can write 1+1=?(referring to the pre-set unlocking logic), and the unlocking script inputs 2, which completes the unlocking, and after unlocking, the corresponding money can be taken away for spending. The amount refers to the selling amount of the NFT.

[0038] In an implementation manner, the NFT issuer can limit the output of the atomic exchange transaction to two outputs through the OP_PUSH_TX technology, of course, those skilled in the art can also adopt other technologies to limit the output of the atomic exchange transaction to two outputs, and the present application does not limit this. When the NFT issuer limits the output of the atomic exchange transaction to two outputs through the OP_PUSH_TX technology, as shown in Figure 2 The specific implementation method is:

[0039] 1. Define the logic for unlocking transaction 1 in the locking script in transaction 1: a. Verify the transaction original image; b. Get the first transaction output and the second transaction output in the unlocking script; c. Concatenate the two transaction outputs and hash them; d. Compare the hash of the transaction original image output with the hash of the concatenated transaction output; e. If the comparison passes, the locking script can be unlocked. Note: This only expresses the implementation logic and does not involve specific operation codes.

[0040] 2. Place the original image of transaction 2 and the two outputs of the current transaction (transaction 2) in the unlocking script as parameters.

[0041] That is, as long as the hash value of the transaction original image of transaction 2 is compared with the hash value of the concatenated first transaction output and second transaction output of transaction 2, the locking script of transaction 1 can be unlocked.

[0042] In the above implementation manner, the locking script defines that in order to be unlocked, the hash of the concatenated first transaction output and second transaction output of the transaction must be compared with the hash of the output of the transaction original image and pass (i.e., the hash values are the same), and the comparison passing indicates that the output of the transaction original image only contains the first transaction output and the second transaction output (if the output of the transaction original image only contains one transaction output, or also contains a third transaction output or more transaction outputs, the comparison passing condition cannot be met), thus the output of the atomic exchange transaction is limited to two outputs.

[0043] Further, when the NFT issuer constructs the latest atomic swap transaction of the NFT, in order to enable the NFT purchaser to add inputs and outputs in the latest atomic swap transaction of the NFT constructed by the NFT issuer, and thus complete the atomic swap transaction, the NFT issuer can sign the transaction by SINGLE|ANYONECANPAY in SIGHASH_flag when constructing the latest atomic swap transaction of the NFT.

[0044] Signing the transaction by SINGLE|ANYONECANPAY in SIGHASH_flag enables the constructor of the transaction to require others to complete the transaction in the case of one input and one output.

[0045] For example, the transaction constructor takes his own openable locking script as the output, and the output is 100 units, but the input of the transaction is only 1 unit, so the other person supplements the other 99 units on the input side, so that the transaction is complete.

[0046] Signing the transaction means generating a signature, which is used in subsequent transactions to verify the correctness of the signature by the transaction processor, so as to ensure the safety of the transaction. The signature is generated by encrypting the plaintext with a private key, and the plaintext is determined by SIGHASH_flag. Different values of SIGHASH_flag correspond to different plaintexts.

[0047] SIGHASH_flag refers to signature hash type. The signature of the virtual currency has a way to indicate which part of the transaction data is included in the hash signed by the private key using the SIGHASH flag. The SIGHASH flag is a single byte attached to the signature.

[0048] SIGHASH has three flags: ALL, NONE, and SINGLE, and they can all be combined with ANYONECANPAY to meet the corresponding needs.

[0049] SIGHASH_ALL signs the plaintext of all inputs and outputs of the transaction, which means that the transaction cannot be changed after being signed, and if it is changed, it will not pass the verification of the transaction processor in subsequent transactions.

[0050] If SIGHASH_flag is signed as SIGHASH_ALL, it means that new inputs and outputs cannot be added.

[0051] If SIGHASH_flag is signed as SIGHASH_NONE, it means that new inputs cannot be added, but outputs can be added. Anyone can take this transaction and spend the money on themselves.

[0052] If SIGHASH_flag is signed as SIGHASH_SINGLE, it means that new inputs cannot be added, and the output of the same sequence cannot be changed. Anyone can take this transaction and spend part of the money for themselves.

[0053] And ANYONECANPAY means that anyone can pay, and all SIGHASH_flags combined with ANYONECANPAY only sign the input on the input side.

[0054] Among them, SINGLE|ANYONECANPAY means signing only the input on the input side and the output of the same sequence. Figure 3 For example, user A fills in a 1 yuan output and signs SINGLE|ANYONECANPAY, and the output of the same sequence is 5 yuan (indicating payment of 5 yuan to user C); User A sends this transaction to user B, user B adds an 8 yuan input and pays user D 10 yuan, and then sends the transaction to user E; User E adds a 7 yuan input and pays user F 1 yuan. That is, after receiving the transaction, users B and E cannot modify the input and output filled in by user A, but can only fill in their own input and output based on the input and output filled in by user A, thereby completing the transaction.

[0055] Therefore, in this embodiment, the NFT sender signs the transaction through the SINGLE|ANYONECANPAY mode in the SIGHASH_flag when constructing the latest atomic exchange transaction of the NFT, which can ensure that during the subsequent transaction process, on the one hand, the NFT buyer can fill in the input and output in the latest atomic exchange transaction to complete the entire atomic exchange transaction, and on the other hand, the input and output determined by the NFT sender cannot be tampered with.

[0056] Step S20: The NFT sender sends the latest atomic exchange transaction of the NFT, the transaction chain between the original atomic exchange transaction and the final atomic exchange transaction corresponding to the NFT, and the Merkle proof of the output representing the NFT in the final atomic exchange transaction to the NFT buyer.

[0057] Among them, at this time, the latest atomic exchange transaction of the NFT only includes one input and one output filled in by the NFT sender.

[0058] The more the number of transactions of the NFT, the longer the transaction chain between the original atomic exchange transaction and the final atomic exchange transaction corresponding to the NFT. With the completion of each atomic exchange transaction of the NFT, the transaction chain between the original atomic exchange transaction and the final atomic exchange transaction corresponding to the NFT will be updated (newly completed atomic exchange transactions will be added, that is, the latest completed atomic exchange transaction will be added).

[0059] It should be understood that only the transaction that has been out-blocked has the Merkel proof, and the Merkel proof of the final atomic exchange transaction representing the NFT output in the final atomic exchange transaction means the Merkel proof of the unspent transaction output representing the NFT.

[0060] The Merkel proof can be used to prove the existence of a specific transaction in thousands of transactions in a block with a large number of bytes. In order to prove that a specific transaction is included in a block, a node only needs to calculate log2(N) 32-byte hash values to form an authentication path or Merkel proof from the specific transaction to the tree root.

[0061] In this step, the NFT sender sends the latest atomic exchange transaction of the NFT, the transaction chain between the original atomic exchange transaction corresponding to the NFT and the final atomic exchange transaction, and the Merkel proof of the final atomic exchange transaction to the NFT buyer, and then performs step S30.

[0062] Step S30: The NFT buyer verifies the existence of the NFT through the Merkel proof of the final atomic exchange transaction and the block header in the local SPV, and judges whether the verification is passed. If the verification is passed, the transaction exists, and step S40 is continued to be executed. Otherwise, the verification is not passed, and the transaction does not exist, and step S60 is executed.

[0063] The block header is an 80-byte data structure containing a version number, a parent block header hash value, a Merkel root, a timestamp, a difficulty target, and a Nonce value. A block is produced every 10 minutes on average, and about 4.2M block header data is produced in a year. SPV only needs to update the block header locally to quickly verify the existence of the transaction received by SPV, without the participation of the full node.

[0064] SPV, also known as "light node" or "user node", stores information related to users such as public and private keys, block headers, Merkel proofs, UTXOs, etc., and has the ability to construct transactions and forward transactions.

[0065] The full node, also known as "transaction processor", stores all user-related transactions, all block headers and Merkel proofs, UTXOs, etc., and has the functions of virtual currency production, transaction forwarding, double-spend detection, etc.

[0066] The verification of the existence of the transaction can be achieved when the NFT sender and the NFT purchaser are offline. In the blockchain, a slight change in a block will cause a change in the block header hash, so that the block header hash cannot correspond to the requirement of the corresponding difficulty, and the SPV can quickly verify whether the received UTXO is correct locally. The transaction of offline payment can be broadcast to the full node when there is a forwarding condition. Since offline payment still has some risks, the value scale of offline payment should be low, for example, small payment.

[0067] The NFT purchaser verifies the existence of the transaction by receiving the Merkle proof and the Merkle root in the block header. When the hash value calculated according to the Merkle proof is equal to the hash value of the Merkle root, the verification is passed, and the transaction exists. If they are not equal, the verification fails, and the transaction does not exist.

[0068] Step S40: The NFT purchaser performs local tracing upwards along the transaction chain between the original atomic swap transaction and the final atomic swap transaction of the NFT by using the input of the latest atomic swap transaction of the NFT, and determines whether the final tracing result conforms to the pre-published NFT-TxOut mapping relationship. If yes, the tracing is successful, and step S50 is performed. Otherwise, the tracing is unsuccessful, and step S60 is performed.

[0069] As shown in Figure 4 After obtaining the latest atomic swap transaction and the transaction chain between the original atomic swap transaction and the final atomic swap transaction corresponding to the NFT, the NFT purchaser performs local tracing upwards along the transaction chain between the original atomic swap transaction and the final atomic swap transaction by using the input of the latest atomic swap transaction of the NFT.

[0070] Specifically, the local tracing upwards along the transaction chain between the original atomic swap transaction and the final atomic swap transaction means tracing from the final atomic swap transaction to an output of the original atomic swap transaction along the transaction chain, taking the output as a final tracing output, and taking the TxOut of the final tracing output as a final tracing result. If the TxOut of the final tracing output is the same as the TxOut corresponding to the NFT in the pre-published NFT-TxOut mapping relationship, it is determined that the final tracing result conforms to the pre-published NFT-TxOut mapping relationship, and the tracing is successful. If the TxOut of the final tracing output is different from the TxOut corresponding to the NFT in the pre-published NFT-TxOut mapping relationship, it is determined that the final tracing result does not conform to the pre-published NFT-TxOut mapping relationship, and the tracing fails.

[0071] The NFT-TxOut mapping relationship is pre-set, that is, before step S10, as shown in Figure 5 The atomic swap method further includes:

[0072] Step S70: Pre-set the one-to-one mapping relationship between the NFT and the TxOut in the UTXO represented by the NFT as the NFT-TxOut mapping relationship, and publish it to the public channel.

[0073] The transaction of the virtual currency is composed of transaction input and transaction output, and each transaction spends an input and generates an output, and the output generated is the "unspent transaction output", that is, UTXO.

[0074] TxOut refers to an output in a transaction. In this embodiment, the atomic exchange transaction is limited to include multiple inputs and two outputs, so the one-to-one mapping relationship between the NFT and the TxOut in the UTXO represented by the NFT is pre-set, and the public channel is disclosed, that is, the public can know which output in the atomic exchange transaction the NFT corresponds to.

[0075] In this embodiment, the public channel can be various, such as microblog, press conference, exhibition, etc. For example, the one-to-one correspondence between the NFT and the TxOut in the UTXO represented by the NFT (indicating that a certain NFT corresponds to the xth output with TXID XXXX) can be realized by holding a press conference.

[0076] Further, when tracing the source upwards, as shown in Figure 6 , an input of the current atomic exchange transaction is traced to an output of the previous atomic exchange transaction through a hash pointer (taking the current atomic exchange transaction as the latest atomic exchange transaction, and the previous atomic exchange transaction as the final atomic exchange transaction in the transaction chain).

[0077] Step S50: After confirming that the transaction of the NFT exists and the tracing is successful, the NFT purchaser fills in the input and output in the latest atomic exchange transaction of the NFT, and broadcasts it to the full node to complete the latest atomic exchange transaction of the NFT.

[0078] Step S60: End the transaction.

[0079] Specifically, in this embodiment, the execution order of steps S30 and S40 can be exchanged, that is, step S30 can be executed first, and then step S40 can be executed, or step S40 can be executed first, and then step S30 can be executed; or steps S30 and S40 can be executed simultaneously. Those skilled in the art can set it according to actual needs, and the present application does not limit it.

[0080] The NFT atomic exchange method provided in the embodiment limits the atomic exchange transaction to multiple inputs and two outputs, fills in one output and one input by the NFT sender when constructing the latest atomic exchange transaction, and fills in the remaining inputs and outputs by the NFT buyer after locally verifying the existence of the transaction and successfully tracing the source, so as to complete the atomic exchange transaction. The NFT atomic exchange method provided in the embodiment has only two results, success and failure, which ensures the consistency of the transaction. The existence of the NFT can be verified locally (in an offline state) through the Merkle proof and the block header of the final atomic exchange transaction, and the tracing of the NFT can be completed locally (in an offline state) through the input of the latest atomic exchange transaction of the NFT and the transaction chain between the original atomic exchange transaction and the final atomic exchange transaction, so that the transaction of the NFT can be completed in the offline state of both parties, and the whole transaction process is simple and efficient. Meanwhile, the transaction of the NFT in the NFT atomic exchange method provided in the application is point-to-point, and does not need to rely on any trusted third party.

[0081] In another embodiment of the application, an NFT atomic exchange system is also provided, which adopts the NFT atomic exchange method with the following steps to realize the atomic exchange transaction of the NFT.

[0082] The NFT atomic exchange method of the embodiment includes:

[0083] Step S10: The NFT sender constructs the latest atomic exchange transaction of the NFT by taking the TxOut representing the NFT as an input, and the lock script and the amount that can be opened by the NFT sender as an output.

[0084] Step S20: The NFT sender sends the latest atomic exchange transaction of the NFT, the transaction chain between the original atomic exchange transaction and the final atomic exchange transaction corresponding to the NFT, and the Merkle proof of the final atomic exchange transaction to the NFT buyer.

[0085] Step S30: The NFT buyer performs the existence verification of the NFT locally through the Merkle proof and the block header of the final atomic exchange transaction, and judges whether the verification is passed. If the verification is passed, the transaction exists, and the step S40 is continued to be executed. Otherwise, the verification is not passed, the transaction does not exist, and the step S60 is executed.

[0086] Step S40: The NFT buyer performs the local tracing along the transaction chain between the original atomic exchange transaction and the final atomic exchange transaction through the input of the latest atomic exchange transaction of the NFT, and judges whether the final tracing result conforms to the pre-published NFT-TxOut mapping relationship. If yes, the tracing is successful, and the step S50 is executed. Otherwise, the tracing is not successful, and the step S60 is executed.

[0087] Step S50: After confirming that the transaction of the NFT exists and the traceability is successful, the NFT buyer fills in the input and output in the latest atomic exchange transaction and broadcasts to the full node to complete the latest atomic exchange transaction of the NFT.

[0088] Step S60: End the transaction.

[0089] The application also provides a computer readable storage medium, and the computer readable storage medium stores a computer program, and the computer program is executed by a processor to realize the NFT atomic exchange method.

[0090] The application also protects a terminal device 10, such as Figure 7 As shown, the terminal device 10 comprises a computer readable storage medium 101 and a processor 102, wherein the computer readable storage medium 101 stores computer instructions; and the processor 102 is configured to run the computer instructions to enable the terminal device 10 to execute the NFT atomic exchange method.

[0091] Through the description of the above embodiments, those skilled in the art can clearly understand that the application can be implemented by means of software combined with a hardware platform. Based on such understanding, all or part of the technical solutions of the application that contribute to the background art can be embodied in the form of a software product. The computer software product can be stored in a storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, etc., and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, a smart phone, or a network device, etc.) to execute the methods described in various embodiments or some parts of the embodiments of the application.

[0092] The NFT atomic exchange method, system, computer readable storage medium and terminal device provided by the application limit the atomic exchange transaction to multiple inputs and two outputs, fill in one output and one input by the NFT sender when constructing the latest atomic exchange transaction, fill in the remaining inputs and outputs by the NFT buyer after verifying the existence of the transaction and successfully tracing the source locally, and complete the atomic exchange transaction. The NFT atomic exchange method, system, computer readable storage medium and terminal device provided by the application perform the transaction of NFT, and the transaction result has only two results of success and failure, which guarantees the consistency of the transaction. Moreover, the existence verification of NFT can be completed locally (in an offline state) through the Merkle proof of the final atomic exchange transaction and the block header, and the tracing of NFT can be completed locally (in an offline state) through the input of the latest atomic exchange transaction of NFT and the transaction chain between the original atomic exchange transaction and the final atomic exchange transaction, so that the transaction of NFT can be completed in the case that both parties are offline, and the whole transaction process is simple and efficient. Meanwhile, in the NFT atomic exchange method provided by the application, the transaction of NFT is point-to-point, and does not need to depend on any trusted third party. In addition, the one-to-one mapping relationship between the NFT and the TxOut represented by the NFT in the UTXO is published in a public channel in advance, so that the user can know the corresponding relationship between the NFT and the TxOut represented by the NFT in the UTXO.

[0093] The above further describes the application by means of specific embodiments, but it should be understood that the specific description herein should not be understood as limiting the essence and scope of the application, and various modifications made by those skilled in the art after reading the above description also belong to the scope of protection of the application.

Claims

1. An NFT atomic exchange method, characterized in that the method The method comprises: The NFT issuer constructs the latest atomic swap transaction of the NFT, wherein the atomic swap transaction is limited to include multiple inputs and two outputs; The NFT issuer sends the latest atomic swap transaction of the NFT, the transaction chain between the original atomic swap transaction corresponding to the NFT and the final atomic swap transaction, and the Merkle proof of the output representing the NFT in the final atomic swap transaction to the NFT purchaser; The NFT purchaser performs the existence verification of the NFT locally through the Merkle proof and the block header of the final atomic swap transaction, and the transaction exists if the verification is passed; The NFT purchaser performs the local tracing upwards along the transaction chain between the original atomic swap transaction and the final atomic swap transaction of the NFT through the input of the latest atomic swap transaction of the NFT, and the tracing is successful if the final tracing result conforms to the pre-published NFT-TxOut mapping relationship; The NFT purchaser fills in the input and output in the latest atomic swap transaction of the NFT and broadcasts to the full node to complete the latest atomic swap transaction of the NFT after confirming the existence of the transaction of the NFT and the success of the tracing; The method further comprises: pre-setting the one-to-one mapping relationship between the NFT and the TxOut represented by the NFT in the UTXO as the NFT-TxOut mapping relationship, and publishing it to the public channel; The NFT issuer limits the output of the atomic swap transaction to two outputs through the OP_PUSH_TX technology; The NFT issuer signs the transaction through the SINGLE|ANYONECANPAY mode in the SIGHASH_flag when constructing the latest atomic swap transaction of the NFT.

2. The NFT atomic exchange method of claim 1, wherein, The public channel comprises one or more of a microblog, a press conference, and an exhibition.

3. The NFT atomic exchange method of claim 1, wherein, If the NFT purchaser confirms that the transaction of the NFT does not exist and / or the tracing fails, the transaction is ended.

4. An NFT atomic exchange system, characterized by, The system adopts the NFT atomic swap method according to any one of claims 1-3 to realize the atomic swap transaction of the NFT.

5. A computer readable storage medium, characterized in that, The computer program is stored on the computer readable storage medium and is executed by the processor to realize the NFT atomic swap method according to any one of claims 1-3.

6. A terminal device, characterized by comprising: The computer readable storage medium stores computer instructions, and the processor is configured to run the computer instructions to enable the terminal device to execute the NFT atomic swap method according to any one of claims 1-3. ​ ​

Citation Information

Patent Citations

  • Blockchain tokens

    GB202011753D0

  • Computer implemented methods and systems

    WO2021250046A1