WO2021134426A1 - 一种基于区块链的数字货币交易方法、装置及系统 - Google Patents

一种基于区块链的数字货币交易方法、装置及系统 Download PDF

Info

Publication number
WO2021134426A1
WO2021134426A1 PCT/CN2019/130382 CN2019130382W WO2021134426A1 WO 2021134426 A1 WO2021134426 A1 WO 2021134426A1 CN 2019130382 W CN2019130382 W CN 2019130382W WO 2021134426 A1 WO2021134426 A1 WO 2021134426A1
Authority
WO
WIPO (PCT)
Prior art keywords
utxo
contract
digital currency
currency transaction
account
Prior art date
Application number
PCT/CN2019/130382
Other languages
English (en)
French (fr)
Inventor
张骁
辛佳骏
李武璐
来鑫
陈磊
Original Assignee
深圳市网心科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市网心科技有限公司 filed Critical 深圳市网心科技有限公司
Priority to CN201980059594.4A priority Critical patent/CN112740251A/zh
Priority to PCT/CN2019/130382 priority patent/WO2021134426A1/zh
Publication of WO2021134426A1 publication Critical patent/WO2021134426A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Definitions

  • the present invention relates to the technical field of block chains, and more specifically, to a method, device and system for digital currency transactions based on block chains.
  • Digital currency is a kind of virtual currency based on node network and digital encryption algorithm. It is usually issued and managed by developers and accepted and used by members of specific virtual communities.
  • the existing blockchain technology is usually divided into two types: Unspent Transaction Output (UTXO) represented by Bitcoin and Account model represented by Ethereum.
  • the UTXO model is a stateless model. Every transaction on the blockchain is a transfer of UXTO. Each unspent UTXO model is only related to the previous UTXO model, and has no relationship with other UTXOs. Since the global state is not required, the privacy protection on the UTXO model is relatively easy to implement. Therefore, in order to realize the privacy of digital currency transactions, the UTXO model is usually adopted.
  • the Account model is a stateful model. Each block in the blockchain has a global world state. This state is global and corresponds to all account balances on the blockchain. Each transaction or Only the change of the account balance caused by the call of the contract will cause the update of this global world state. Therefore, in order to allow the blockchain to better support smart contracts and prompt the scalability of the blockchain, the Account model is usually used.
  • the Account model is suitable for smart contracts, sharding, and cross-chain. Due to changes in the state of the world, it is easy to leak the privacy of the party to which the state belongs, making it more difficult for the Account model to protect the privacy of the transaction sender, receiver, and transaction amount.
  • the UTXO model is suitable for privacy protection. Since the state of the UTXO model may be scattered on every transaction in the history of the blockchain, there is no aggregate collective. Therefore, when the legality of the state needs to be judged, it is necessary to traverse all historical blocks, resulting in Resource loss makes it difficult for the UTXO model to implement smart contracts, sharding, and cross-chain. Therefore, whether it is the UTXO model or the Account model, it is difficult to simultaneously support the features of smart contracts, sharding, and cross-chain.
  • the present invention provides a blockchain-based digital currency transaction method, device, and system.
  • the UTXO model and the Account model can simultaneously support smart contracts, sharding, and The purpose of cross-chain.
  • the first aspect of the present invention discloses a blockchain-based digital currency transaction method, the method includes:
  • the balance is stored in the first account of the first user in the digital currency transaction contract.
  • the method further includes:
  • the balance is stored in the second account of the second user in the digital currency transaction contract.
  • the method further includes:
  • the receiving the balance transfer request initiated by the third user includes:
  • the transferring the balance in the third account account to the UTXO of the third user includes:
  • the transaction for invoking the digital currency transaction contract and the transaction for transferring the balance in the third account to the designated UTXO address are packaged in the same block.
  • the method further includes: if the third UTXO has not been consumed, storing the balance in the third account of the third user in the digital currency transaction contract.
  • the second aspect of the present invention discloses a blockchain-based digital currency transaction device.
  • the device includes a memory and a processor.
  • the memory stores a blockchain-based digital currency that can run on the processor.
  • a transaction program when the digital currency transaction program is executed by the processor, the blockchain-based digital currency transaction method as disclosed in any one of the first aspect is implemented.
  • the third aspect of the present invention discloses a blockchain-based digital currency transaction system, which includes:
  • the receiving unit is configured to receive a contract deployment transaction request initiated by the first user based on the first UTXO;
  • the first storage unit is configured to store the balance in the first account of the first user in the digital currency transaction contract if the first UTXO has not been consumed.
  • a computer-readable storage medium stores a digital currency transaction program, and the digital currency transaction program can be executed by one or more processors to achieve the following On the one hand, any one of the blockchain-based digital currency transaction methods disclosed.
  • the fifth aspect of the present invention discloses a computer program product, including computer instructions, which when run on a computer, enable the computer to execute any one of the blockchain-based digital currency transaction methods disclosed in the first aspect.
  • the first user receives the contract deployment transaction request initiated by the first UTXO, responds to the contract deployment transaction request, generates the corresponding digital currency transaction contract, and consumes the first UTXO as the gas for the deployment contract. If the first UTXO If it is not consumed, the balance is stored in the first account of the first user in the digital currency transaction contract.
  • the UTXO model and the Account model are combined to achieve the purpose of supporting smart contracts, sharding and cross-chain at the same time.
  • FIG. 1 is a schematic flowchart of a digital currency transaction method based on blockchain disclosed in an embodiment of the present invention
  • FIG. 2 is a schematic structural diagram of a digital currency transaction device based on blockchain disclosed in an embodiment of the present invention
  • FIG. 3 is a schematic structural diagram of a digital currency transaction system based on a blockchain disclosed in an embodiment of the present invention.
  • the Account model is suitable for smart contracts, sharding, and cross-chain. Due to changes in the world state, it is easy to reveal the privacy of the party to which the state belongs. This makes it difficult for the Account model to protect the privacy of the transaction sender, receiver, and transaction amount. Larger.
  • the UTXO model is suitable for privacy protection. Since the state of the UTXO model may be scattered on every transaction in the history of the blockchain, there is no aggregate collective. Therefore, when the legality of the state needs to be judged, it is necessary to traverse all historical blocks, resulting in Resource loss makes it difficult for the UTXO model to implement smart contracts, sharding, and cross-chain. Therefore, whether it is the UTXO model or the Account model, it is difficult to simultaneously support the features of smart contracts, sharding, and cross-chain.
  • the present invention discloses a blockchain-based digital currency transaction method, device and system to achieve the purpose of supporting smart contracts, sharding and cross-chain at the same time.
  • the present invention proposes a blockchain-based digital currency transaction method, device and system in which both UTXO module and Account model exist.
  • the UTXO model is a data structure containing transaction data and execution code. It is the earliest account model adopted by Bitcoin.
  • the UTXO model is a stateless model. Every transaction on the blockchain is UXTO. The transfer of each UTXO model that has not been spent is only related to the previous UTXO model, and has no relationship to other UTXOs.
  • the Account model is the account balance model of Ethereum.
  • the Account model is a stateful model.
  • a global world state is maintained on each block in the blockchain. This state is global, corresponding to the balance of all accounts on the chain, and every transaction or smart contract call will cause the change of the account balance to update the global state of the world.
  • FIG. 1 it is a schematic flow diagram of a blockchain-based digital currency transaction method disclosed in an embodiment of the present invention, which specifically includes the following steps:
  • Step S101 Receive a contract deployment transaction request initiated by the first user based on the first UTXO.
  • contract deployment is a user initiates a contract deployment transaction using the UTXO model.
  • the contract deployment transaction takes the user's UTXO as input and outputs a digital currency transaction contract.
  • the address of the digital currency transaction contract is automatically generated during deployment.
  • the method of contract deployment can use tools to generate bytecode from the contract code, and generate contracts through instructions or tools.
  • Step S102 In response to the contract deployment transaction request, a corresponding digital currency transaction contract is generated, and the first UTXO is consumed as gas for the deployment contract.
  • the UTXO model is used to calculate the gas value of the first UTXO consumed as the deployment contract according to the complexity of contract deployment and execution, and the gas value of the first UTXO consumed as the deployment contract can also be set to a fixed value.
  • the specific consumption of the first UTXO as the gas value of the deployment contract depends on the operation strategy of the blockchain.
  • the address "SC" is identified as a reserved field of the smart contract. Smart contracts are equivalent to digital currency trading contracts.
  • a smart contract is a computer protocol that is used to spread, verify or execute the contract in an information-based way. It allows a credible transaction without a third party, and the transaction is traceable and irreversible.
  • the contract address starting with "SC” is the smart contract address, and the contract address starting with “SC” is the ordinary UTXO address.
  • nonce is a random number, the identifier of the transaction, to prevent the transaction from being replayed.
  • Balance is the contract account balance.
  • Contract_code is the contract code.
  • Storage is the data stored in the contract.
  • Step S103 If the first UTXO has not been consumed, store the balance in the first account of the first user in the digital currency transaction contract.
  • the first UTXO is the deployment cost of contract deployment, which may be consumed during the deployment process. If the first UTXO is not consumed, the remaining first UTXO is saved in the first user’s digital currency transaction In the first account in the contract.
  • the first user can request to transfer out the first UTXO remaining in the first account stored in the digital currency transaction contract.
  • This solution combines the UTXO model and the Account model to give full play to the advantages of the two models, enabling blockchain-based digital currency transactions to support a high level of privacy protection and support smart contracts to satisfy Turing completeness.
  • the code execution can support sharding and cross-chain, and realize the efficient expansion of the performance of the blockchain system.
  • the digital currency transaction contract is executed through the Account model.
  • the digital currency transaction contract can be publicly calculated and execute the contract code.
  • the input and output information needs to be isolated from the user's real identity through the temporary storage address.
  • An embodiment of the present invention discloses a blockchain-based digital currency transaction method that receives a contract deployment transaction request initiated by a first user based on the first UTXO, responds to the contract deployment transaction request, generates a corresponding digital currency transaction contract, and consumes the first UTXO.
  • a UTXO is used as the gas of the deployment contract. If the first UTXO is not used up, the balance is stored in the first account of the first user in the digital currency transaction contract.
  • a request from a second user to call a digital currency transaction contract based on a second UTXO is received, the digital currency transaction contract is executed in response to the request to call the digital currency transaction contract, and the second UTXO is consumed as the call.
  • the gas of the contract, if the second UTXO has not been consumed, the balance is stored in the second account of the second user in the digital currency transaction contract.
  • the second UTXO is the call cost of the contract call, which may be consumed during the call. If the second UTXO is not consumed, the remaining second UTXO will be stored in the second user’s digital currency transaction contract. In the second account, for the remaining second UTXO, the second user can request to transfer out the second account stored in the digital currency transaction contract.
  • the second UTXO consumed as the gas value of the calling contract is calculated according to the complexity of the contract call and execution, and the second UTXO consumed as the gas value of the calling contract can also be set to a fixed value.
  • the specific consumption of the second UTXO is used as the gas value of the calling contract.
  • the setting of the gas value depends on the operation strategy of the blockchain.
  • the digital currency transaction contract is executed based on the UTXO model in response to the request to call the digital currency transaction contract, and the second UTXO is consumed as gas for calling the contract.
  • the second UTXO as the gas of the calling contract is the resource consumed by the execution of the digital currency transaction contract, that is, the cost of the execution of the digital currency transaction contract. Its role is to provide the power to execute the contract on the one hand, and on the other hand to prevent attackers from performing the digital currency transaction contract Infinite call attack.
  • a request from a second user to call a digital currency transaction contract based on a second UTXO is received, the digital currency transaction contract is executed in response to the request to call the digital currency transaction contract, and the second UTXO is consumed as gas for calling the contract, if The second UTXO has not been consumed, and the balance is stored in the second account of the second user in the digital currency transaction contract.
  • the function in the contract code is called through the additional script to consume the corresponding amount of the second UTXO gas, to achieve the purpose of storing the unconsumed balance of the second UTXO in the second account of the second user in the digital currency transaction contract.
  • a balance transfer request initiated by a third user is received, and the balance transfer request is used to request that the balance of the third user in the third account be transferred to the third user’s account.
  • UTXO transfer the balance in the third account account to the UTXO of the third user.
  • the balance transfer request initiated by the third user based on the third UTXO is received, and the balance transfer request includes the designated UTXO address.
  • first user, second user, and third user may be the same user or different users.
  • the transaction transferred out of the contract to UTXO is signed by the private key of the block proposer, the corresponding balance is subtracted from the third account, and sent to the corresponding UTXO model.
  • All block verification nodes can execute digital currency transaction contracts to determine the legitimacy of the block node's implementation of digital currency transaction contracts to transfer out transactions.
  • the third account account is a private account. Therefore, the account amount and account address of the third account account are subject to privacy protection. Privacy protection methods can be Ring Signature (RS), Ring Signature Confidential Transaction (RingCT), zero-knowledge proof, etc.
  • RS Ring Signature
  • RingCT Ring Signature Confidential Transaction
  • the specific privacy protection method used can be selected by those skilled in the art according to the situation. The method is not specifically limited here.
  • the value of the ring size of the ring signature is 1, it is an ordinary digital currency transaction, and when the value of the ring size of the ring signature is not 1, it is a private digital currency transaction.
  • the maximum value of the ring size of the ring signature is the total number of accounts in the entire network, and the value range of the value of the ring size of the ring signature is a positive integer greater than or equal to 1.
  • the balance in the third account is transferred out to the designated UTXO address, and the privacy protection in the third account can be ring signature, ring signature confidential transaction or zero-knowledge proof, to achieve the third account
  • the privacy protection in the third account can be ring signature, ring signature confidential transaction or zero-knowledge proof, to achieve the third account The purpose of account privacy protection.
  • a blinding operation is performed on the designated UTXO address, where the blinding operation is used to hide the designated UTXO address.
  • the blinding method takes the public UTXO address as input to initiate a privacy protection transaction, and the output is a ring composed of multiple designated UTXO addresses.
  • HEADER is the block header
  • UTXOa ⁇ SC123456, SC123456 ⁇ UTXOb, SC123456 ⁇ UTXOc and SC123456 ⁇ UTXOd are transactions in the block body, where UTXOa ⁇ SC123456 represents the transaction of calling the contract (UTXOa can be consumed by calling the contract The gas), SC123456 ⁇ UTXOb, SC123456 ⁇ UTXOc and SC123456 ⁇ UTXOd can represent the transaction of transferring the account balance in the contract to the specified UTXO address.
  • the transaction of invoking the digital currency transaction contract and the transaction of transferring the balance in the third account to the designated UTXO address are packaged in the same block.
  • the transaction of invoking the digital currency transaction and transferring the balance in the third account account to the designated UTXO address is packaged in the same block through the block packaging node to ensure the transactional nature of the entire process.
  • the balance is stored in the third account of the third user in the digital currency transaction contract.
  • the third UTXO if the third UTXO is not consumed, the balance is stored in the third account of the third user in the digital currency transaction contract.
  • the additional script is used to call the contract code in the contract code. Function, consumes the gas corresponding to the third UTXO, and realizes the purpose of storing the unused balance of the third UTXO in the third account of the third user in the digital currency transaction contract.
  • the embodiment of the present invention also provides a blockchain-based digital currency transaction device.
  • the device includes a memory and a processor.
  • the memory stores a blockchain-based digital currency transaction program that can run on the processor.
  • the blockchain-based digital currency transaction program is executed by the processor, a blockchain-based digital currency transaction method is realized.
  • the invention discloses a blockchain-based digital currency transaction device, which receives a contract deployment transaction request initiated by a first user based on a first UTXO, responds to the contract deployment transaction request, generates a corresponding digital currency transaction contract, and consumes the first UTXO As the gas of the deployment contract, if the first UTXO has not been consumed, the balance is stored in the first account of the first user in the digital currency transaction contract.
  • the purpose of storing the unconsumed balance of the first UTXO in the first account of the first user in the digital currency transaction contract is realized, and the scheme supports the characteristics of smart contract, sharding and cross-chain at the same time .
  • the blockchain-based digital currency transaction device 2 may be a PC (Personal Computer, personal computer), or a smart phone, a tablet computer, a palmtop computer, a portable computer, or a terminal device.
  • PC Personal Computer
  • smart phone a tablet computer, a palmtop computer, a portable computer, or a terminal device.
  • the blockchain-based digital currency transaction device 2 may include a memory 11, a processor 12, and a bus 13.
  • the memory 11 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, and the like.
  • the memory 11 may be an internal storage unit of the blockchain-based digital currency transaction device 2 in some embodiments, for example, the hard disk of the blockchain-based digital currency transaction device 2.
  • the memory 11 may also be an external storage device of the blockchain-based digital currency transaction device 2, such as a plug-in hard disk equipped on the blockchain-based digital currency transaction device 2, and a smart memory card (Smart Memory Card).
  • Media Card SMC, Secure Digital (SD) card, Flash Card, etc.
  • the memory 11 may also include both an internal storage unit of the blockchain-based digital currency transaction device 2 and an external storage device.
  • the memory 11 can be used not only to store application software and various data installed on the blockchain-based digital currency transaction device 2, such as the code of a blockchain-based digital currency transaction program, etc., but also to temporarily store the output that has been output. Or the data to be output.
  • the processor 12 may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other data processing chip in some embodiments, and is used to run the program code or processing stored in the memory 11 Data, such as execution of blockchain-based digital currency transaction program 01, etc.
  • CPU central processing unit
  • controller microcontroller
  • microprocessor or other data processing chip in some embodiments, and is used to run the program code or processing stored in the memory 11 Data, such as execution of blockchain-based digital currency transaction program 01, etc.
  • the bus 13 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus.
  • PCI peripheral component interconnect
  • EISA extended industry standard architecture
  • the bus can be divided into address bus, data bus, control bus and so on. For ease of representation, only one thick line is used in FIG. 2, but it does not mean that there is only one bus or one type of bus.
  • the blockchain-based digital currency transaction device 2 may also include a network interface 14.
  • the network interface 14 may optionally include a wired interface and/or a wireless interface (such as a Wi-Fi interface, a Bluetooth interface, etc.), and is generally used for A communication connection is established between the blockchain-based digital currency transaction device 2 and other electronic devices.
  • the blockchain-based digital currency transaction device 2 may also include a user interface
  • the user interface may include a display (Display), an input unit such as a keyboard (Keyboard), and the optional user interface may also include a standard wired interface , Wireless interface.
  • the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, etc.
  • the display can also be appropriately called a display screen or a display unit, which is used to display the information processed in the blockchain-based digital currency transaction device 2 and to display a visualized user interface.
  • the embodiment of the present invention also correspondingly discloses a blockchain-based digital currency transaction system.
  • the blockchain-based digital currency The trading system 300 mainly includes:
  • the first receiving unit 301 is configured to receive a contract deployment transaction request initiated by the first user based on the first UTXO.
  • the generation and consumption unit 302 is used to respond to the contract deployment transaction request, generate a corresponding digital currency transaction contract, and consume the first UTXO as the gas of the deployment contract.
  • the first storage unit 303 is configured to store the balance in the first account of the first user in the digital currency transaction contract if the first UTXO has not been consumed.
  • it also includes:
  • the second receiving unit is configured to receive a request from the second user to call the digital currency transaction contract based on the second UTXO.
  • the execution consumption unit is used to execute the digital currency transaction contract in response to the request for invoking the digital currency transaction contract, and consume the second UTXO as gas for the invoking contract.
  • the second storage unit is used for storing the balance in the second account of the second user in the digital currency transaction contract if the second UTXO has not been consumed.
  • it also includes:
  • the third receiving unit is configured to receive a balance transfer request initiated by a third user, and the balance transfer request is used to request that the balance of the third user in the third account be transferred to the UTXO of the third user.
  • the third receiving unit that receives the balance transfer request initiated by the third user includes: a receiving module.
  • the receiving module is configured to receive a balance transfer request initiated by a third user based on the third UTXO, and the balance transfer request includes the designated UTXO address.
  • the transfer-out unit is used to transfer the balance in the third account to the UTXO of the third user.
  • the transfer-out unit includes: a calling module and a transfer-out module.
  • the calling module is used to call the digital currency transaction contract, where the third UTXO is used as the gas consumed by the calling contract.
  • the transfer-out module is used to transfer the balance in the third account account to the designated UTXO address.
  • it also includes:
  • the packaging unit is used to package the transaction for invoking the digital currency transaction contract and the transaction for transferring the balance in the third account to the designated UTXO address in the same block.
  • the storage module is used for storing the balance in the third account of the third user in the digital currency transaction contract if the third UTXO has not been consumed.
  • the embodiment of the present invention discloses a blockchain-based digital currency transaction system, which receives a contract deployment transaction request initiated by a first user based on the first UTXO, responds to the contract deployment transaction request, generates a corresponding digital currency transaction contract, and consumes the first UTXO.
  • a UTXO is used as the gas of the deployment contract. If the first UTXO is not used up, the balance is stored in the first account of the first user in the digital currency transaction contract.
  • the embodiment of the present invention also provides a computer-readable storage medium, the computer-readable storage medium stores a blockchain-based digital currency transaction program, and the blockchain-based digital currency transaction program can be processed by one or more The device executes to realize the digital currency transaction method based on the blockchain.
  • the embodiment of the present invention also provides a computer program product, including computer instructions, which when run on a computer, enable the computer to execute a blockchain-based digital currency transaction method.
  • the computer program product includes one or more computer instructions.
  • the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
  • the computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium.
  • the computer instructions may be transmitted from a website, computer, server, or data center. Transmission to another website, computer, server or data center via wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.).
  • wired such as coaxial cable, optical fiber, digital subscriber line (DSL)
  • wireless such as infrared, wireless, microwave, etc.
  • the computer-readable storage medium may be any available medium that can be stored by a computer or a data storage device such as a server or a data center integrated with one or more available media.
  • the usable medium may be a magnetic medium (for example, a floppy disk, a hard disk, and a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid state disk (SSD)).
  • the disclosed system, device, and method can be implemented in other ways.
  • the device embodiments described above are merely illustrative.
  • the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components may be combined It can be integrated into another system, or some features can be ignored or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated unit can be implemented in the form of hardware or software functional unit.
  • the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium.
  • the technical solution of this application essentially or the part that contributes to the existing technology or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium.
  • a computer device which may be a personal computer, a server, or a network device, etc.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disks or optical disks and other media that can store program codes. .
  • sequence numbers of the above-mentioned embodiments of the present invention are only for description, and do not represent the superiority or inferiority of the embodiments.
  • the terms “include”, “include” or any other variants thereof in this article are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements not only includes those elements, but also includes The other elements listed may also include elements inherent to the process, device, article, or method. If there are no more restrictions, the element defined by the sentence "including a" does not exclude the existence of other identical elements in the process, device, article, or method that includes the element.

Landscapes

  • Business, Economics & Management (AREA)
  • Engineering & Computer Science (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Physics & Mathematics (AREA)
  • Strategic Management (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Technology Law (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

一种基于区块链的数字货币交易方法、装置及系统,接收第一用户基于第一UTXO发起的合约部署交易请求(S101),响应合约部署交易请求,生成相应的数字货币交易合约,并消耗第一UTXO作为部署合约的gas(S102),若第一UTXO未被消耗完,将余额存储在第一用户在数字货币交易合约中的第一account账户中(S103)。上述方法、装置及系统通过将UTXO模型和Account模型结合在一起,实现同时支持智能合约、分片和跨链的特性的目的。

Description

一种基于区块链的数字货币交易方法、装置及系统 技术领域
本发明涉及区块链技术领域,更具体地说,涉及一种基于区块链的数字货币交易方法、装置及系统。
背景技术
随着区块链技术的进步与数字货币的发展,使用数字货币作为网络上交易的凭证,已广泛地应用于网络上的交易、消费等活动。数字货币是一种基于节点网络和数字加密算法的虚拟货币,通常由开发者发行和管理,被特定的虚拟社区的成员所接受和使用。
现有的区块链技术中,通常分为以比特币为代表的未花费的交易输出模型(Unspent Transaction Output,UTXO)和以以太坊为代表的Account模型两种。UTXO模型是一种无状态模型,在区块链上的每一笔交易都是UXTO的转移。每一个未被花费的UTXO模型只和上一个UTXO模型有关,而与其他的UTXO都没有任何关联,由于不需要全局状态,UTXO模型上的隐私保护相对容易实现。因此为了实现数字货币交易的隐私性,通常采用UTXO模型。Account模型是一种有状态模型,在区块链中的每一个区块上都有一个全局的世界状态,这个状态是全局的,对应着区块链上所以的账户余额,每一笔交易或只能合约的调用对账户余额的改变都会导致这个全局世界状态的更新。因此,为了让区块链更好的支持智能合约,提示区块链的可拓展性,通常采用Account模型。
但是,Account模型适合智能合约、分片和跨链,由于世界状态的变化很容易泄露状态所属方的隐私,从而使得Account模型实现交易发送方、接收方以及交易金额的隐私保护的难度较大。UTXO模型适合隐私保护,由于UTXO模型的状态可能散落在区块链历史的每一笔交易上,没有一个聚合的集体,因此当需要作出状态合法性的判断时就需要遍历所以历史区块,造成资源损耗,从而使得UTXO模型实现智能合约、分片和跨链的困难较大。因此,无论是UTXO模型还是Account模型,都难以同时支持智能合约、分片和跨链的特性。
发明内容
有鉴于此,本发明提供了一种基于区块链的数字货币交易方法、装置及系统,通过将UTXO模型和Account模型结合在一起,执行数字货币交易合约, 实现同时支持智能合约、分片和跨链的目的。
为了实现上述目的,现提出的方案如下:
本发明第一方面公开了一种基于区块链的数字货币交易方法,所述方法包括:
接收第一用户基于第一UTXO发起的合约部署交易请求;
响应所述合约部署交易请求,生成相应的数字货币交易合约,并消耗所述第一UTXO作为部署合约的gas;
若所述第一UTXO未被消耗完,将余额存储在所述第一用户在所述数字货币交易合约中的所述第一account账户中。
优选的,所述方法还包括:
接收第二用户基于第二UTXO调用所述数字货币交易合约的请求;
执行所述数字货币交易合约以响应所述调用所述数字货币交易合约的请求,并消耗所述第二UTXO作为调用合约的gas;
若所述第二UTXO未被消耗完,将余额存储在所述第二用户在所述数字货币交易合约中的第二account账户中。
优选的,所述方法还包括:
接收所述第三用户发起的余额转出请求,所述余额转出请求用于请求将所述第三用户在第三account账户中的余额转出至所述第三用户的UTXO;
将所述第三account账户中的余额转出至所述第三用户的UTXO。
优选的,所述接收所述第三用户发起的余额转出请求,包括:
接收所述第三用户基于第三UTXO发起的余额转出请求,所述余额转出请求中包括指定的UTXO地址;
所述将所述第三account账户中的余额转出至所述第三用户的UTXO包括:
调用所述数字货币交易合约,其中所述第三UTXO作为调用合约消耗的gas;
将所述第三account账户中的余额转出至所述指定的UTXO地址。
优选的,所述调用所述数字货币交易合约的交易与所述将所述第三account账户中的余额转出至所述指定的UTXO地址的交易打包在同一个区块 中。
优选的,所述方法还包括:若所述第三UTXO未被消耗完,将余额存储在所述第三用户在所述数字货币交易合约中的第三account账户中。
本发明第二方面公开了一种基于区块链的数字货币交易装置,所述装置包括存储器和处理器,所述存储器上存储有可在所述处理器上运行的基于区块链的数字货币交易程序,所述数字货币交易程序被所述处理器执行时实现如第一方面公开的任一项所述基于区块链的数字货币交易方法。
本发明第三方面公开了一种基于区块链的数字货币交易系统,所述系统包括:
接收单元,用于接收第一用户基于第一UTXO发起的合约部署交易请求;
生成消耗单元,用于响应所述合约部署交易请求,生成相应的数字货币交易合约,并消耗所述第一UTXO作为部署合约的gas;
第一存储单元,用于若所述第一UTXO未被消耗完,将余额存储在所述第一用户在所述数字货币交易合约中的所述第一account账户中。
本发明第四方面公开了一种计算机可读存储介质,所述计算机可读存储介质上存储有数字货币交易程序,所述数字货币交易程序可被一个或者多个处理器执行,以实现如第一方面公开的任一项所述基于区块链的数字货币交易方法。
本发明第五方面公开了一种计算机程序产品,包括计算机指令,当其在计算机上运行时,使得计算机可以执行上述第一方面公开的任一项所述基于区块链的数字货币交易方法。
经由上述技术方案可知,接收第一用户基于第一UTXO发起的合约部署交易请求,响应合约部署交易请求,生成相应的数字货币交易合约,并消耗第一UTXO作为部署合约的gas,若第一UTXO未被消耗完,将余额存储在第一用户在数字货币交易合约中的第一account账户中。通过上述方案,通过将UTXO模型和Account模型结合在一起,实现同时支持智能合约、分片和跨链的目的。
上述说明仅是本申请技术方案的概述,为了能够更清楚了解本申请的技术手段,而可依照说明书的内容予以实施,并且为了让本申请的上述和其它目的、 特征和优点能够更明显易懂,以下特举本申请的具体实施方式。
附图说明
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本发明实施例公开的一种基于区块链的数字货币交易方法的流程示意图;
图2为本发明实施例公开的一种基于区块链的数字货币交易装置的结构示意图;
图3为本发明实施例公开的一种基于区块链的数字货币交易系统的结构示意图。
具体实施方式
为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本发明,并不用于限定本发明。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”、“第四”等(如果存在)是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的实施例能够以除了在这里图示或描述的内容以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。
需要说明的是,在本发明中涉及“第一”、“第二”等的描述仅用于描述目的,而不能理解为指示或暗示其相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括至少一个该 特征。另外,各个实施例之间的技术方案可以相互结合,但是必须是以本领域普通技术人员能够实现为基础,当技术方案的结合出现相互矛盾或无法实现时应当认为这种技术方案的结合不存在,也不在本发明要求的保护范围之内。
现有技术中,Account模型适合智能合约、分片和跨链,由于世界状态的变化很容易泄露状态所属方的隐私,从而使得Account模型实现交易发送方、接收方以及交易金额的隐私保护的难度较大。UTXO模型适合隐私保护,由于UTXO模型的状态可能散落在区块链历史的每一笔交易上,没有一个聚合的集体,因此当需要作出状态合法性的判断时就需要遍历所以历史区块,造成资源损耗,从而使得UTXO模型实现智能合约、分片和跨链的困难较大。因此,无论是UTXO模型还是Account模型,都难以同时支持智能合约、分片和跨链的特性。
因此,本发明公开了一种基于区块链的数字货币交易方法、装置及系统,实现同时支持智能合约、分片和跨链的目的。
为了同时支持智能合约、分片/跨链和隐私保护的特性,本发明提出了同时存在UTXO模块和Account模型的基于区块链的数字货币交易方法、装置及系统。
需要说明的是,UTXO模型是一个包含交易数据和执行代码的数据结构,是比特币最早采用的账户模型,UTXO模型是一种无状态模型,在区块链上的每一笔交易都是UXTO的转移,每一个未被花费的UTXO模型只和上一个UTXO模型有关,而与其他的UTXO都没有任何关联。
Account模型是以太坊的账户余额模型,Account模型是一种有状态模型,在区块链中的每一个区块上都维护有一个全局的世界状态。这个状态是全局的,对应着链上所有的账户的余额,其中每一笔交易或智能合约的调用对账户余额的改变都会导致这个全局世界状态的更新。
如图1所示,为本发明实施例公开的一种基于区块链的数字货币交易方法的流程示意图,具体包括如下步骤:
步骤S101:接收第一用户基于第一UTXO发起的合约部署交易请求。
需要说明的是,合约部署是用户利用UTXO模型发起一笔合约部署交易,该合约部署交易以用户的UTXO作为输入,输出一个数字货币交易合约。该 数字货币交易合约的地址在部署时自动生成。
合约部署的方式可以利用工具将合约代码生成字节码,通过指令或工具生成合约。
步骤S102:响应合约部署交易请求,生成相应的数字货币交易合约,并消耗第一UTXO作为部署合约的gas。
在具体实现步骤S102的过程中,通过UTXO模型根据合约部署和执行的复杂程度计算消耗第一UTXO作为部署合约的gas值,消耗第一UTXO作为部署合约的gas值也可以设定为固定值,具体消耗第一UTXO作为部署合约的gas值的设定取决于区块链的运营策略。
需要说明的是,为了区分合约地址和UTXO地址,数字货币交易合约的合约地址以SC(表示Smart Contract,即智能合约)开头。
地址“SC”标识为智能合约的保留字段。智能合约相当于数字货币交易合约。
智能合约是一种皆在以信息化方式传播、验证或执行合同的计算机协议,允许在没有第三方的情况下进行可信交易,该交易可追踪且不可逆转。
以“SC”开头的合约地址为智能合约地址,以非“SC”开头的合约地址为普通UTXO地址。
智能合约的数据结构,如表1所示。
表1
nonce
balance
Contract_code
storage
需要说明的是,nonce为随机数,交易的标识,防止交易受到重放攻击。
Balance为合约账户余额。
Contract_code为合约代码。
Storage为合约中存储的数据。
步骤S103:若第一UTXO未被消耗完,将余额存储在第一用户在数字货币交易合约中的第一account账户中。
在具体实现步骤S103的过程中,第一UTXO是合约部署的部署成本,在部署过程中可能被消耗,若第一UTXO没有消耗完,将剩余的第一UTXO保存在第一用户在数字货币交易合约中的第一account账户中。
第一用户可以请求转出保存在数字货币交易合约中的第一account账户中剩余的第一UTXO。
本方案通过将UTXO模型和Account模型结合在一起,发挥两种模型的优势,可以使基于区块链的数字货币交易在支持高水平的隐私保护能力的前提下,能够支持智能合约满足图灵完备的代码执行,同时可以支持分片、跨链,实现区块链系统性能的高效扩展。
通过Account模型执行数字货币交易合约,该数字货币交易合约可以进行公开计算,执行合约代码,输入输出的信息需要通过暂存地址与用户的真实身份隔离。
通过Account模型基于智能合约实现去中心化的数字货币交易,保证了数字货币交易的自动化、公平和公正。
本发明实施例公开的一种基于区块链的数字货币交易方法,接收第一用户基于第一UTXO发起的合约部署交易请求,响应合约部署交易请求,生成相应的数字货币交易合约,并消耗第一UTXO作为部署合约的gas,若第一UTXO未被消耗完,将余额存储在第一用户在数字货币交易合约中的第一account账户中。通过上述方案,实现将未消耗完的第一UTXO的余额存储在第一用户在数字货币交易合约中的第一account账户中的目的,并且该方案同时支持智能合约、分片和跨链的特性。
在本发明实施例的一种应用场景中,接收第二用户基于第二UTXO调用数字货币交易合约的请求,执行数字货币交易合约以响应调用数字货币交易合约的请求,并消耗第二UTXO作为调用合约的gas,若第二UTXO未被消耗完,将余额存储在第二用户在数字货币交易合约中的第二account账户中。
需要说明的是,第二UTXO是合约调用的调用成本,在调用过程中可能 被消耗,若第二UTXO没有消耗完,将剩余的第二UTXO保存在第二用户在数字货币交易合约中的第二account账户中,对于剩余的第二UTXO,第二用户可以请求转出保存在数字货币交易合约中的第二account账户。
通过UTXO模型根据合约调用和执行的复杂程度计算消耗第二UTXO作为调用合约的gas值,消耗第二UTXO作为调用合约的gas值也可以设定为固定值,具体消耗第二UTXO作为调用合约的gas值的设定取决于区块链的运营策略。
通过接收第二用户基于第二UTXO调用数字货币交易合约的请求,基于UTXO模型执行数字货币交易合约以响应调用数字货币交易合约的请求,消耗第二UTXO作为调用合约的gas。
第二UTXO作为调用合约的gas是数字货币交易合约执行所消耗的资源,即数字货币交易合约执行的成本,其作用一方面提供执行合约的动力,另一方面防止攻击者对数字货币交易合约进行无限调用的攻击。
在本发明实施例中,接收第二用户基于第二UTXO调用数字货币交易合约的请求,执行数字货币交易合约以响应调用数字货币交易合约的请求,并消耗第二UTXO作为调用合约的gas,若第二UTXO未被消耗完,将余额存储在第二用户在数字货币交易合约中的第二account账户中,在调用合约过程中,通过附加脚本调用合约代码中的函数,消耗第二UTXO相应的gas,实现将未消耗完的第二UTXO的余额存储在第二用户在数字货币交易合约中的第二account账户中的目的。
在本发明实施例的另一种应用场景中,接收第三用户发起的余额转出请求,余额转出请求用于请求将第三用户在第三account账户中的余额转出至第三用户的UTXO,将第三account账户中的余额转出至第三用户的UTXO。
其中,接收第三用户基于第三UTXO发起的余额转出请求,余额转出请求中包括指定的UTXO地址。
需要说明的是,上述第一用户、第二用户和第三用户可以是同一用户,也可以是不同用户。
基于上述涉及到将第三account账户中的余额转出至第三用户的UTXO的过程如下:
调用数字货币交易合约,其中第三UTXO作为调用合约消耗的gas,将第三account账户中的余额转出至指定的UTXO地址。
其中,合约转出至UTXO的交易由区块提议者的私钥签名,在第三account账户中减去相应的余额,发送给相应的UTXO模型上。所有的区块验证节点都可以执行数字货币交易合约来判断区块节点执行数字货币交易合约转出交易的合法性。
需要说明的是,第三account账户为隐私账户,因此,第三account账户的账户数额和账户地址,都受到隐私保护。隐私保护的方式可以是环签名(Ring Signature,RS)、环状签名保密交易(Ring Signature Confidential Transaction,RingCT)、零知识证明等,具体采用的隐私保护方式,本领域技术人员可以根据情况选择合适的方式,在此不做具体限定。
将第三account账户中的余额转出至指定的UTXO地址,为第三account账户中的余额添加环签名,基于环签名对第三account账户中的余额进行加密。
需要说明的是,当环签名的环size的数值为1时,为普通数字货币交易,当环签名的环size的数值不为1时,为隐私数字货币交易。
环签名的环size的最大值为全网账户总数,该环签名的环size的数值的取值范围为大于等于1的正整数。
将第三account账户中的余额转出至指定的UTXO地址,为第三account账户中的余额添加RingCT,基于RingCT对第三UTXO进行加密。
或,
将第三account账户中的余额转出至指定的UTXO地址,为第三account账户中的余额添加零知识证明,基于零知识证明对第三UTXO进行加密。
相应地,将第三account账户中的余额转出至指定的UTXO地址,为第三account账户中的余额添加环size的数值不为1的环签名,基于环签名对第三UTXO进行加密。
在本发明实施例中,第三account账户中的余额转出至指定的UTXO地址,第三account账户中的隐私保护可以是环签名、环状签名保密交易或零知识证明,实现对第三account账户进行隐私保护的目的。
在本发明的另一种应用场景中,在执行数字货币交易合约之前,对指定的 UTXO地址执行盲化操作,其中,盲化操作用于隐藏指定的UTXO地址。
盲化的方法以公开的UTXO地址作为输入,发起一笔隐私保护交易,输出为由多个指定的UTXO地址组成的环。
其他用户区块或区块节点无法判断真实指定的UTXO地址是环中的哪一个成员,以此实现对数字交易合约的合约账户金额和合约账户地址的隐私保护。为了实现更好的难以追踪性质,可以采用更大规模的环,或增加盲化操作的轮数。
本发明的应用场景中,通过对指定的UTXO地址执行盲化操作,实现对数字交易合约的第三account账户的数额和地址的隐私保护的目的。
在上述中涉及到区块中数字货币交易合约的交易过程,如表2所示。
表2
HEADER
UTXOa→SC123456
SC123456→UTXOb
SC123456→UTXOc
SC123456→UTXOd
......
需要说明的是,HEADER为区块头,UTXOa→SC123456、SC123456→UTXOb、SC123456→UTXOc和SC123456→UTXOd为区块体中的交易,其中UTXOa→SC123456表示调用合约的交易(UTXOa可以为调用合约所消耗的gas),SC123456→UTXOb、SC123456→UTXOc和SC123456→UTXOd可表示将合约中账户余额转出至指定UTXO地址的交易。
在本发明实施例的另一种应用场景中,调用数字货币交易合约的交易与将第三account账户中的余额转出至指定的UTXO地址的交易打包在同一个区块中。
在本发明实施例中,通过区块打包节点将调用数字货币交易和将第三 account账户中的余额转出至指定的UTXO地址的交易打包在同一个区块中,确保整个过程的事务性。
在本发明实施例的另一种应用场景中,若第三UTXO未被消耗完,将余额存储在第三用户在数字货币交易合约中的第三account账户中。
在本发明实施例中,若第三UTXO未被消耗完,将余额存储在第三用户在数字货币交易合约中的第三account账户中,在调用合约过程中,通过附加脚本调用合约代码中的函数,消耗第三UTXO相应的gas,实现将未消耗完的第三UTXO的余额存储在第三用户在数字货币交易合约中的第三account账户中的目的。
本发明实施例还提供了一种基于区块链的数字货币交易装置,该装置包括存储器和处理器,该存储器上存储有可在该处理器上运行的基于区块链的数字货币交易程序,该基于区块链的数字货币交易程序被该处理器执行时实现基于区块链的数字货币交易方法。
本发明公开了一种基于区块链的数字货币交易装置,接收第一用户基于第一UTXO发起的合约部署交易请求,响应合约部署交易请求,生成相应的数字货币交易合约,并消耗第一UTXO作为部署合约的gas,若第一UTXO未被消耗完,将余额存储在第一用户在数字货币交易合约中的第一account账户中。通过上述方案,实现将未消耗完的第一UTXO的余额存储在第一用户在数字货币交易合约中的第一account账户中的目的,并且该方案同时支持智能合约、分片和跨链的特性。
在本实施例中,基于区块链的数字货币交易装置2可以是PC(Personal Computer,个人电脑),也可以是智能手机、平板电脑、掌上电脑、便携计算机、终端设备。
基于区块链的数字货币交易装置2可以包括存储器11、处理器12和总线13。
其中,存储器11至少包括一种类型的可读存储介质,所述可读存储介质包括闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、磁性存储器、磁盘、光盘等。存储器11在一些实施例中可以是基于区块链的数字货币交易装置2的内部存储单元,例如该基于区块链的数字货币交易装置2 的硬盘。存储器11在另一些实施例中也可以是基于区块链的数字货币交易装置2的外部存储设备,例如基于区块链的数字货币交易装置2上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,存储器11还可以既包括基于区块链的数字货币交易装置2的内部存储单元也包括外部存储设备。存储器11不仅可以用于存储安装于基于区块链的数字货币交易装置2的应用软件及各类数据,例如基于区块链的数字货币交易程序的代码等,还可以用于暂时地存储已经输出或者将要输出的数据。
处理器12在一些实施例中可以是一中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器或其他数据处理芯片,用于运行存储器11中存储的程序代码或处理数据,例如执行基于区块链的数字货币交易程序01等。
该总线13可以是外设部件互连标准(peripheral component interconnect,简称PCI)总线或扩展工业标准结构(extended industry standard architecture,简称EISA)总线等。该总线可以分为地址总线、数据总线、控制总线等。为便于表示,图2中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。
进一步地,基于区块链的数字货币交易装置2还可以包括网络接口14,网络接口14可选的可以包括有线接口和/或无线接口(如WI-FI接口、蓝牙接口等),通常用于在该基于区块链的数字货币交易装置2与其他电子设备之间建立通信连接。
可选地,该基于区块链的数字货币交易装置2还可以包括用户接口,用户接口可以包括显示器(Display)、输入单元比如键盘(Keyboard),可选的用户接口还可以包括标准的有线接口、无线接口。可选地,在一些实施例中,显示器可以是LED显示器、液晶显示器、触控式液晶显示器以及OLED(Organic Light-Emitting Diode,有机发光二极管)触摸器等。其中,显示器也可以适当的称为显示屏或显示单元,用于显示在基于区块链的数字货币交易装置2中处理的信息以及用于显示可视化的用户界面。
基于上述本发明实施例公开的基于区块链的数字货币交易方法,本发明实施例还对应公开了基于区块链的数字货币交易系统,如图3所示,该基于区块 链的数字货币交易系统300主要包括:
第一接收单元301,用于接收第一用户基于第一UTXO发起的合约部署交易请求。
生成消耗单元302,用于响应合约部署交易请求,生成相应的数字货币交易合约,并消耗第一UTXO作为部署合约的gas。
第一存储单元303,用于若第一UTXO未被消耗完,将余额存储在第一用户在数字货币交易合约中的第一account账户中。
可选的,还包括:
第二接收单元,用于接收第二用户基于第二UTXO调用数字货币交易合约的请求。
执行消耗单元,用于执行数字货币交易合约以响应调用数字货币交易合约的请求,并消耗所述第二UTXO作为调用合约的gas。
第二存储单元,用于若第二UTXO未被消耗完,将余额存储在第二用户在数字货币交易合约中的第二account账户中。
可选的,还包括:
第三接收单元,用于接收第三用户发起的余额转出请求,余额转出请求用于请求将第三用户在第三account账户中的余额转出至第三用户的UTXO。
进一步的,接收第三用户发起的余额转出请求的第三接收单元,包括:接收模块。
接收模块,用于接收第三用户基于第三UTXO发起的余额转出请求,余额转出请求中包括指定的UTXO地址。
转出单元,用于将第三account账户中的余额转出至第三用户的UTXO。
进一步的,转出单元,包括:调用模块和转出模块。
调用模块,用于调用数字货币交易合约,其中第三UTXO作为调用合约消耗的gas。
转出模块,用于将第三account账户中的余额转出至指定的UTXO地址。
可选的,还包括:
打包单元,用于调用数字货币交易合约的交易与将第三account账户中的余额转出至指定的UTXO地址的交易打包在同一个区块中。
进一步的,还包括:
存储模块,用于若第三UTXO未被消耗完,将余额存储在第三用户在数字货币交易合约中的第三account账户中。
本发明实施例公开了一种基于区块链的数字货币交易系统,接收第一用户基于第一UTXO发起的合约部署交易请求,响应合约部署交易请求,生成相应的数字货币交易合约,并消耗第一UTXO作为部署合约的gas,若第一UTXO未被消耗完,将余额存储在第一用户在数字货币交易合约中的第一account账户中。通过上述方案,实现将未消耗完的第一UTXO的余额存储在第一用户在数字货币交易合约中的第一account账户中的目的,并且该方案同时支持智能合约、分片和跨链的特性。
本发明实施例还提供了一种计算机可读存储介质,该计算机可读存储介质上存储有基于区块链的数字货币交易程序,基于区块链的数字货币交易程序可被一个或者多个处理器执行,以实现基于区块链的数字货币交易方法。
本发明实施例还提供了一种计算机程序产品,包括计算机指令,当其在计算机上运行时,使得计算机可以执行基于区块链的数字货币交易方法。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。
所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本发明实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存储的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘Solid State  Disk(SSD))等。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。
需要说明的是,上述本发明实施例序号仅仅为了描述,不代表实施例的优 劣。并且本文中的术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、装置、物品或者方法不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、装置、物品或者方法所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、装置、物品或者方法中还存在另外的相同要素。
以上仅为本发明的优选实施例,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本发明的专利保护范围内。

Claims (10)

  1. 一种基于区块链的数字货币交易方法,其特征在于,所述方法包括:
    接收第一用户基于第一UTXO发起的合约部署交易请求;
    响应所述合约部署交易请求,生成相应的数字货币交易合约,并消耗所述第一UTXO作为部署合约的gas;
    若所述第一UTXO未被消耗完,将余额存储在所述第一用户在所述数字货币交易合约中的所述第一account账户中。
  2. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    接收第二用户基于第二UTXO调用所述数字货币交易合约的请求;
    执行所述数字货币交易合约以响应所述调用所述数字货币交易合约的请求,并消耗所述第二UTXO作为调用合约的gas;
    若所述第二UTXO未被消耗完,将余额存储在所述第二用户在所述数字货币交易合约中的第二account账户中。
  3. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    接收所述第三用户发起的余额转出请求,所述余额转出请求用于请求将所述第三用户在第三account账户中的余额转出至所述第三用户的UTXO;
    将所述第三account账户中的余额转出至所述第三用户的UTXO。
  4. 根据权利要求3所述的方法,其特征在于,所述接收所述第三用户发起的余额转出请求,包括:
    接收所述第三用户基于第三UTXO发起的余额转出请求,所述余额转出请求中包括指定的UTXO地址;
    所述将所述第三account账户中的余额转出至所述第三用户的UTXO包括:
    调用所述数字货币交易合约,其中所述第三UTXO作为调用合约消耗的gas;
    将所述第三account账户中的余额转出至所述指定的UTXO地址。
  5. 根据权利要求4所述的方法,其特征在于,所述调用所述数字货币交易合约的交易与所述将所述第三account账户中的余额转出至所述指定的UTXO地址的交易打包在同一个区块中。
  6. 根据权利要求4所述的方法,其特征在于,所述方法还包括:若所述第三UTXO未被消耗完,将余额存储在所述第三用户在所述数字货币交易合约中的第三account账户中。
  7. 一种基于区块链的数字货币交易装置,其特征在于,所述装置包括存储器和处理器,所述存储器上存储有可在所述处理器上运行的基于区块链的数字货币交易程序,所述数字货币交易程序被所述处理器执行时实现如权利要求1-6任一项所述基于区块链的数字货币交易方法。
  8. 一种基于区块链的数字货币交易系统,其特征在于,所述系统包括:
    接收单元,用于接收第一用户基于第一UTXO发起的合约部署交易请求;
    生成消耗单元,用于响应所述合约部署交易请求,生成相应的数字货币交易合约,并消耗所述第一UTXO作为部署合约的gas;
    第一存储单元,用于若所述第一UTXO未被消耗完,将余额存储在所述第一用户在所述数字货币交易合约中的所述第一account账户中。
  9. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有数字货币交易程序,所述数字货币交易程序可被一个或者多个处理器执行,以实现如权利要求1至6中任一项所述基于区块链的数字货币交易方法。
  10. 一种计算机程序产品,其特征在于,包括计算机指令,当其在计算机上运行时,使得计算机可以执行上述权利要求1至6中任一项所述基于区块链的数字货币交易方法。
PCT/CN2019/130382 2019-12-31 2019-12-31 一种基于区块链的数字货币交易方法、装置及系统 WO2021134426A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201980059594.4A CN112740251A (zh) 2019-12-31 2019-12-31 一种基于区块链的数字货币交易方法、装置及系统
PCT/CN2019/130382 WO2021134426A1 (zh) 2019-12-31 2019-12-31 一种基于区块链的数字货币交易方法、装置及系统

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/130382 WO2021134426A1 (zh) 2019-12-31 2019-12-31 一种基于区块链的数字货币交易方法、装置及系统

Publications (1)

Publication Number Publication Date
WO2021134426A1 true WO2021134426A1 (zh) 2021-07-08

Family

ID=75589495

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/130382 WO2021134426A1 (zh) 2019-12-31 2019-12-31 一种基于区块链的数字货币交易方法、装置及系统

Country Status (2)

Country Link
CN (1) CN112740251A (zh)
WO (1) WO2021134426A1 (zh)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170249606A1 (en) * 2014-09-10 2017-08-31 Robert Parviz PIROOZ System and method for electronic currency mining
CN109559227A (zh) * 2018-11-29 2019-04-02 咪咕文化科技有限公司 一种跨区块链网络的交易方法、装置及存储介质
CN110135993A (zh) * 2019-05-17 2019-08-16 深圳银链科技有限公司 Utxo模型适配智能合约账户模型的方法、设备及存储介质
CN110472957A (zh) * 2019-08-20 2019-11-19 深圳市网心科技有限公司 一种区块链交易验证方法及相关设备
CN110517138A (zh) * 2019-08-20 2019-11-29 深圳市网心科技有限公司 智能合约处理方法、装置、计算机设备及存储介质

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106940854A (zh) * 2017-03-06 2017-07-11 钱德君 一种utxo模型与合约之间的搭桥方法
US20190303892A1 (en) * 2018-03-30 2019-10-03 Exposition Park Holdings SEZC Digital asset exchange
CN109034814B (zh) * 2018-09-14 2020-10-16 百度在线网络技术(北京)有限公司 基于以太坊虚拟机的智能合约处理方法和装置
CN109886661A (zh) * 2019-01-16 2019-06-14 深圳壹账通智能科技有限公司 跨链数字货币兑换方法、装置、计算机系统及存储介质
CN110472977B (zh) * 2019-08-20 2023-09-19 深圳市迅雷网络技术有限公司 一种区块链的交易记录生成方法及相关设备

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170249606A1 (en) * 2014-09-10 2017-08-31 Robert Parviz PIROOZ System and method for electronic currency mining
CN109559227A (zh) * 2018-11-29 2019-04-02 咪咕文化科技有限公司 一种跨区块链网络的交易方法、装置及存储介质
CN110135993A (zh) * 2019-05-17 2019-08-16 深圳银链科技有限公司 Utxo模型适配智能合约账户模型的方法、设备及存储介质
CN110472957A (zh) * 2019-08-20 2019-11-19 深圳市网心科技有限公司 一种区块链交易验证方法及相关设备
CN110517138A (zh) * 2019-08-20 2019-11-29 深圳市网心科技有限公司 智能合约处理方法、装置、计算机设备及存储介质

Also Published As

Publication number Publication date
CN112740251A (zh) 2021-04-30

Similar Documents

Publication Publication Date Title
TWI710979B (zh) 跨區塊鏈的互動方法及裝置、系統、電子設備
TWI713855B (zh) 憑證管理方法及系統
CN111461723B (zh) 基于区块链的数据处理系统及方法、装置
WO2021031473A1 (zh) 基于多资产模型的区块链资产处理方法及相关设备
CN110189121B (zh) 数据处理方法、装置、区块链客户端和区块链节点
JP2021521544A (ja) 取引処理
TW201935384A (zh) 資產管理方法及裝置、電子設備
TW201828220A (zh) 業務處理方法及裝置
CN101034991B (zh) 安全引导系统及方法、代码签名构造方法及认证方法
TWI528301B (zh) 操作處理方法和裝置
TW202016787A (zh) 基於區塊鏈的交易處理方法及裝置、電子設備
TWI725709B (zh) 資料儲存方法、裝置及設備
CN110597839A (zh) 交易数据处理方法、装置、设备以及存储介质
US11790119B2 (en) Application integrity attestation
CN106326751B (zh) 一种可信道系统及其实现方法
CN110400217B (zh) 智能合约的规则变更处理方法及装置
CN110517147A (zh) 交易数据处理方法、装置、系统及计算机可读存储介质
WO2021057168A1 (zh) 基于fpga实现虚拟机运算的方法及装置
WO2022161182A1 (zh) 基于数据流的可信计算的方法及装置
CN111770112B (zh) 一种信息共享方法、装置及设备
CN110597916A (zh) 基于区块链的数据处理方法、装置、存储介质及终端
US20240143202A1 (en) Customer-specific activation of functionality in a semiconductor device
WO2021057167A1 (zh) 基于fpga的安全智能合约处理器的交易处理方法及装置
WO2021134424A1 (zh) 一种基于区块链的数字货币交易方法、装置及系统
US20230259930A1 (en) Cross-chain transaction processing method and apparatus, electronic device, and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19958351

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19958351

Country of ref document: EP

Kind code of ref document: A1