Transaction system and method based on digital currency and electronic equipment
By deploying the same digital currency smart contracts on the business chain and the digital currency chain, the problems of settlement consistency and fund security between different blockchain systems are solved, and fast and efficient digital currency settlement and fund management are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- THE PEOPLES BANK OF CHINA DIGITAL CURRENCY INST
- Filing Date
- 2024-10-25
- Publication Date
- 2026-04-28
AI Technical Summary
When settling digital currencies between different blockchain systems, ensuring settlement consistency and fund security is a challenge, especially when the business chain and the digital currency chain belong to different blockchains and are operated by different service providers. Existing technologies struggle to achieve fast and efficient settlement.
By deploying the same digital currency smart contract on both the business chain and the digital currency chain, and having the digital currency server responsible for listening to and transmitting the execution results, consistency of execution results on both chains is ensured, enabling the deposit and withdrawal of digital currency.
It achieves consistency and security of digital currency settlements across different blockchain systems, reduces the operational costs of digital currency service providers, and enables real-time monitoring and management of fund usage.
Smart Images

Figure CN121937211A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to digital currency-based transaction systems, methods, electronic devices, and readable media. Background Technology
[0002] With the increasing prevalence of blockchain technology, more and more business processes are being executed on business blockchains (i.e., business chains), leading to a growing demand for blockchain-based settlement services. To meet this demand, cryptocurrency service providers are also migrating cryptocurrency settlements to the blockchain, completing settlements through cryptocurrency chains. However, because business chains and cryptocurrency chains belong to different blockchains, and there can be many business chains (e.g., online shopping, utility bill payments, etc.), involving different service types and operated by different service providers, while cryptocurrency chains are provided by cryptocurrency service providers, ensuring consistency in cryptocurrency settlements across different chains presents a challenge. Simultaneously, ensuring fund security and achieving fast and efficient settlements are also urgent issues that need to be addressed. Summary of the Invention
[0003] This disclosure provides a digital currency-based transaction system, method, electronic device, and readable medium that enables depositing and withdrawing funds from a business chain within a digital currency blockchain, thereby achieving digital currency settlement within the business chain.
[0004] To achieve the above technical objectives, the embodiments of this disclosure adopt the following technical solutions:
[0005] In a first aspect, embodiments of this disclosure provide a digital currency-based trading system, which includes a digital currency chain, a digital currency server, and a business chain. The digital currency chain and the business chain deploy the same digital currency smart contracts, wherein:
[0006] The nodes of the digital currency chain are configured to receive recharge information sent by user wallets, where the recharge information includes the recharge amount and the contract address; and execute the digital currency smart contract deployed on the digital currency chain according to the contract address to generate an execution result, where the execution result includes deducting the recharge amount from the user wallet balance and adding the recharge amount to the user account balance on the digital currency chain, where the user wallet and the user account have the same public key and private key;
[0007] The digital currency server is configured to respond to the execution result by sending the execution result to the nodes in the business chain based on the contract address.
[0008] The nodes in the business chain are configured to update the contract status of the digital currency smart contracts deployed on the business chain based on the execution results, and to add the recharge amount to the balance of the business chain user account corresponding to the user account.
[0009] In some possible implementations, the recharge amount is added to the balance of the business chain user account corresponding to the user account, including:
[0010] Generate a business chain user account corresponding to the user account, and add the recharge amount to the balance of the business chain user account.
[0011] In some possible implementations, the nodes of the digital currency chain are further configured as follows:
[0012] Verify the recharge information, and if the verification is successful, generate the execution result of the digital currency smart contract.
[0013] In some possible implementations, the digital currency server stores the correspondence between the RPC interface and the contract address of the business chain;
[0014] The digital currency server is further configured to: obtain the RPC interface of the business chain based on the contract address, and send recharge information to the business chain nodes through the RPC interface.
[0015] In some possible implementations, the execution result may also include a digital currency chain endorsement strategy;
[0016] The digital currency server is further configured to: verify the digital currency chain endorsement strategy, and send recharge information to the nodes of the business chain according to the contract address if the verification is successful.
[0017] Secondly, embodiments of this disclosure provide a digital currency-based trading system, which includes a digital currency chain, a digital currency server, and a business chain. The digital currency chain and the business chain deploy the same digital currency smart contracts, wherein:
[0018] The nodes of the digital currency chain are configured to receive withdrawal information sent by user wallets, where the withdrawal information includes the withdrawal amount and the contract address; and execute the digital currency smart contract deployed on the digital currency chain according to the contract address to generate an execution result, where the execution result includes adding the withdrawal amount to the user wallet balance and deducting the withdrawal amount from the user account balance on the digital currency chain, where the user wallet and the user account have the same public key and private key;
[0019] The digital currency server is configured to respond to the execution result by sending the execution result to the nodes in the business chain based on the contract address.
[0020] The nodes in the business chain are configured to update the contract status of the digital currency smart contracts deployed on the business chain based on the execution results, and deduct the withdrawal amount from the balance of the business chain user account corresponding to the user account.
[0021] In some possible implementations, the nodes of the digital currency chain are further configured as follows:
[0022] Verify the withdrawal information, and if the verification is successful, generate the execution result of the digital currency smart contract.
[0023] In some possible implementations, the digital currency server stores the correspondence between the RPC interface and the contract address of the business chain;
[0024] The digital currency server is further configured to: obtain the RPC interface of the business chain based on the contract address, and send withdrawal information to the business chain nodes through the RPC interface.
[0025] In some possible implementations, the execution result may also include a digital currency chain endorsement strategy;
[0026] The digital currency server is further configured to: verify the digital currency chain endorsement strategy, and, if the verification is successful, send withdrawal information to the nodes of the business chain based on the contract address.
[0027] Thirdly, this disclosure provides a digital currency-based transaction method applied to a digital currency-based transaction system. The system includes a digital currency chain, a digital currency server, and a business chain. The digital currency chain and the business chain deploy the same digital currency smart contract, wherein:
[0028] The nodes of the digital currency chain receive recharge information sent by the user's wallet, which includes the recharge amount and the contract address; and execute the digital currency smart contract deployed on the digital currency chain according to the contract address to generate an execution result, which includes deducting the recharge amount from the user's wallet balance and adding the recharge amount to the user's account balance on the digital currency chain, wherein the user's wallet and user account have the same public key and private key;
[0029] The cryptocurrency server responds by listening to the execution result and sending the execution result to the nodes in the business chain according to the contract address;
[0030] The nodes in the business chain update the contract status of the digital currency smart contracts deployed on the business chain based on the execution results, and add the recharge amount to the balance of the business chain user account corresponding to the user account.
[0031] Fourthly, this disclosure provides a digital currency-based transaction method applied to a digital currency-based transaction system. The system includes a digital currency chain, a digital currency server, and a business chain. The digital currency chain and the business chain deploy the same digital currency smart contract, wherein:
[0032] The nodes of the digital currency chain receive withdrawal information sent by the user's wallet, which includes the withdrawal amount and the contract address; and execute the digital currency smart contract deployed on the digital currency chain according to the contract address to generate an execution result, which includes adding the withdrawal amount to the user's wallet balance and deducting the withdrawal amount from the user's account balance on the digital currency chain, wherein the user's wallet and user account have the same public key and private key;
[0033] The cryptocurrency server responds by listening to the execution result and sending the execution result to the nodes in the business chain according to the contract address;
[0034] The nodes in the business chain update the contract status of the digital currency smart contracts deployed on the business chain based on the execution results, and deduct the withdrawal amount from the balance of the business chain user account corresponding to the user account.
[0035] Fifthly, embodiments of this application provide an electronic device, including: one or more processors; and a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the digital currency-based transaction methods as described in the third and fourth aspects.
[0036] Sixthly, embodiments of this application provide a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the digital currency-based transaction methods as described in the third and fourth aspects.
[0037] The first aspect of the technical solution provided by the embodiments of this disclosure brings at least the following beneficial effects: A digital currency-based trading system includes a digital currency chain, a digital currency server, and a business chain. The digital currency chain and the business chain deploy the same digital currency smart contract. Nodes in the digital currency chain receive recharge information sent by user wallets; the digital currency smart contract deployed on the digital currency chain is executed according to the contract address to generate an execution result; the digital currency server, in response to detecting the execution result, sends the execution result to the nodes in the business chain according to the contract address; the nodes in the business chain update the contract status of the digital currency smart contract deployed on the business chain according to the execution result, and add the recharge amount to the balance of the user account in the business chain corresponding to the user account. The embodiments of this disclosure, through the digital currency server, can deploy the same digital currency smart contract on both the business chain and the digital currency chain, and the execution result of digital currency-related transactions is based on the digital currency chain. This enables recharge and withdrawal from the business chain on the digital currency chain, thereby realizing digital currency settlement in the business chain.
[0038] It should be noted that the technical effects of any of the implementation methods in aspects two through six can be found in the technical effects of the corresponding implementation methods in aspect one, and will not be repeated here.
[0039] The further effects of the aforementioned unconventional alternative methods will be explained below in conjunction with specific implementation methods. Attached Figure Description
[0040] To more clearly illustrate the technical solutions of the embodiments of this disclosure, the accompanying drawings of the embodiments of this disclosure will be briefly described below. Clearly, the drawings described below only relate to some embodiments of this disclosure and are not intended to limit the scope of this disclosure.
[0041] Figure 1 A schematic diagram of the system configuration of a digital currency smart contract according to at least one embodiment of the present disclosure is shown;
[0042] Figure 2 An interactive flowchart illustrating a method for deploying a digital currency smart contract according to at least one embodiment of the present disclosure is shown;
[0043] Figure 3 A flowchart illustrating the recharge process of a transaction method for a digital currency smart contract according to at least one embodiment of the present disclosure is shown.
[0044] Figure 4 A flowchart illustrating the withdrawal process of a transaction method for a digital currency smart contract according to at least one embodiment of the present disclosure is shown.
[0045] Figure 5 A transaction process interaction flowchart of a digital currency smart contract transaction method according to at least one embodiment of the present disclosure is shown;
[0046] Figure 6 A flowchart illustrating the return process of a transaction method for a digital currency smart contract according to at least one embodiment of the present disclosure is shown.
[0047] Figure 7 A schematic diagram illustrating the main steps of a digital currency server in a method for deploying a digital currency smart contract according to at least one embodiment of the present disclosure is shown.
[0048] Figure 8 A schematic diagram illustrating the main steps of a digital currency chain node in a method for deploying a digital currency smart contract according to at least one embodiment of the present disclosure;
[0049] Figure 9 A schematic diagram illustrating the main steps of the recharge process in a transaction method of a digital currency smart contract according to at least one embodiment of the present disclosure is shown.
[0050] Figure 10 A schematic diagram illustrating the main steps of the withdrawal process in a digital currency smart contract transaction method according to at least one embodiment of the present disclosure is shown.
[0051] Figure 11A schematic diagram illustrating the main steps of the transaction process business chain node of a transaction method for a digital currency smart contract according to at least one embodiment of the present disclosure is shown.
[0052] Figure 12 The diagram illustrates the main steps of a transaction process on a digital currency server side in a transaction method based on at least one embodiment of the present disclosure using a digital currency smart contract.
[0053] Figure 13 The diagram illustrates the main steps of the transaction method of a digital currency smart contract according to at least one embodiment of the present disclosure, including the return process of the digital currency server.
[0054] Figure 14 A schematic diagram of the main modules of a digital currency server according to at least one embodiment of the present disclosure is shown;
[0055] Figure 15 A schematic diagram of the main modules of a digital currency chain node according to at least one embodiment of the present disclosure is shown;
[0056] Figure 16 A schematic diagram of the main modules of a business chain node according to at least one embodiment of the present disclosure is shown;
[0057] Figure 17 A schematic diagram of an electronic device according to at least one embodiment of the present disclosure is shown;
[0058] Figure 18 A schematic diagram of a readable storage medium according to at least one embodiment of the present disclosure is shown. Detailed Implementation
[0059] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this disclosure. All other embodiments obtained by those skilled in the art based on the described embodiments of this disclosure without creative effort are within the scope of protection of this disclosure.
[0060] In the following text, any methods, apparatus, examples, and contents that do not fully correspond to the scope of the claims are not derived from the present invention. Such methods, apparatus, examples, and contents, as well as all subsequent descriptions, are for illustrative purposes only, or to highlight specific aspects or features of the claims.
[0061] Note that the examples described below are merely specific examples and are not intended to limit the embodiments of this disclosure to the specific shapes, hardware, connections, operations, values, conditions, data, sequences, etc., shown and described. Those skilled in the art can utilize the concepts of this disclosure to construct further embodiments not mentioned herein by reading this specification.
[0062] The terminology used in this disclosure is that which is currently widely used in the art in consideration of the functionality of this disclosure; however, these terms may vary depending on the intent, precedent, or new technology of those skilled in the art. Furthermore, specific terms may be chosen by the applicant, and in such cases, their detailed meanings will be described in the detailed description of this disclosure. Therefore, the terminology used in this specification should not be construed as simple names, but rather based on the meaning of the terms and the overall description of this disclosure.
[0063] To better understand the embodiments of this disclosure, the relevant terms involved in this disclosure will first be defined and explained.
[0064] Blockchain: refers to a chain-like data structure that combines data blocks sequentially in chronological order, and is a distributed ledger that is cryptographically guaranteed to be immutable and unforgeable. Essentially, it is a decentralized database. In this disclosure, both the business chain and the digital currency chain are blockchains, and can be various types of blockchains such as public chains, consortium chains, and private chains.
[0065] A smart contract is a self-executing computer program that automatically executes its terms when preset conditions are met. Typically, it is stored in a distributed ledger system, and the results of its execution are recorded on the distributed ledger, enabling automated contract execution without third-party intervention. It offers advantages such as decentralization, automated execution, immutability, and reduced transaction costs. Smart contracts generally contain a set of predefined rules, according to which the parties agree to interact. Deploying a smart contract involves placing the compiled contract code onto a blockchain network. This usually requires using specific tools or interfaces to send transactions to the blockchain network to create a contract instance. Once deployed, the smart contract can be executed on the blockchain and automatically processes transactions according to preset rules and conditions.
[0066] It should be noted that the technical solutions in this disclosure, including the collection, updating, analysis, processing, use, transmission, and storage of user personal information, all comply with relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken to prevent unauthorized access to user personal information data and to safeguard user personal information security, network security, and national security.
[0067] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0068] With the widespread application of blockchain technology, more and more business operations are migrating to the business blockchain. This trend has led to a continuous increase in demand for blockchain settlement services. Currently, there are generally two ways to achieve business blockchain settlement using digital currency: 1. Digital currency service providers directly map digital currency onto the business blockchain, meaning that settlement during digital currency transactions is completed by the business blockchain, with consensus nodes packaging transactions for consensus; 2. Digital currency service providers build digital currency blockchains and achieve business blockchain transaction settlement through cross-chain technology.
[0069] In Method 1, digital currency data and business data on the business chain are stored in the same ledger. For digital currency service providers to ensure security, they need to participate in the consensus process when users settle transactions using digital currency, and they must control a majority of the consensus nodes. Otherwise, abnormal usage can only be detected through post-event auditing. Therefore, this method has the following problems: 1. If digital currency service providers participate in the consensus process, they need to create and maintain a large number of consensus nodes. This maintenance cost increases exponentially when the number of business chains a digital currency service provider participates in increases significantly. 2. If digital currency service providers do not participate in the consensus process, they cannot detect abnormal usage in a timely manner, thus failing to guarantee digital currency security. 3. If business changes or the bankruptcy of a business data provider cause the business blockchain to cease operation, it will be difficult to directly transfer the digital currency off-chain or migrate it to other business chains.
[0070] In Method 2 above, cross-chain technology is used to realize the interaction between the digital currency chain and the business chain. However, it still requires mapping the digital currency onto the business chain and having the business chain handle the settlement of the digital currency. The digital currency data on the business chain and the business data are stored in the same ledger. Therefore, it also suffers from the same problem as Method 1.
[0071] The embodiments of this disclosure, through a digital currency server, can deploy the same digital currency smart contracts on both the business chain and the digital currency chain. The execution results of digital currency-related transactions are based on the digital currency chain, ensuring that the same transaction achieves the same contract execution result on both the business chain and the digital currency chain, thereby enabling digital currency settlement on the business chain. It can be seen that, unlike methods 1 and 2 above, the business chain is only used for bookkeeping and not as a basis for settlement. Therefore, the embodiments of this disclosure no longer require the digital currency service provider to specifically participate in the operation and consensus process of each business chain. The security of digital currency funds on the business chain can be guaranteed through the same digital currency smart contract; the digital currency service provider can monitor the usage of digital currency in real time and effectively supervise funds; the business chain no longer runs digital currency smart contracts independently, but is equivalent to providing a copy of the digital currency ledger, which is maintained by the digital currency service provider and can be easily withdrawn or used in other business chains.
[0072] Figure 1 A schematic diagram of a system 100 for a digital currency smart contract according to at least one embodiment of the present disclosure is shown. The system 100 includes a digital currency chain 120 and a business chain 110, wherein there can be one or more business chains 110 for carrying out different businesses.
[0073] The digital currency chain 120 is jointly built by one or more digital currency service providers. Each service provider operates at least one digital currency chain node 160 and a digital currency server 130. The digital currency chain node 160 is connected to other digital currency chain nodes 160, and the digital currency server 130 is connected to the digital currency chain node 160.
[0074] The digital currency server 130 can be one or more, and the digital currency chain 120 includes multiple digital currency chain nodes 160. The digital currency server 130 can send transactions to the digital currency chain nodes 160. The digital currency chain 120 is jointly maintained by one or more digital currency service providers. Each digital currency service provider can configure its own digital currency server 130, or, as needed, some digital currency service providers can share the digital currency server 130. For example, the digital currency chain 120 can be jointly maintained by multiple banks. Taking Bank A as an example, Bank A has one digital currency server 130. Bank A's business customers B, such as power grid companies or water companies, can use the business chain 110 to send transactions to the digital currency chain 120 through Bank A's digital currency server 130. The business chain, for example, is a business chain 110 that provides water and electricity payment services. Business settlements can be performed on the business chain 110. If a synchronous digital currency settlement is required, it is sent to the digital currency chain 120 through the digital currency server 130 for settlement.
[0075] The primary function of the digital currency chain 120 is to achieve consensus on digital currency-related transactions. A registration contract 141 runs on the digital currency chain 120. Registration contract 141 primarily provides registration functionality for business chain 110. The digital currency server 130 sends registration information from business chain 110 to registration contract 141, which then stores the registration information. A digital currency smart contract (specifically, digital currency contract A 142) also runs on the digital currency chain 120. This digital currency contract A 142 is used to verify and process various digital currency transactions.
[0076] The main functions of the digital currency server 130 include: 1. Receiving registration requests from business chain 110, sending the registration requests to digital currency chain 120, deploying the same digital currency smart contracts (i.e., digital currency contract A 142 and digital currency contract B 142') on both digital currency chain 120 and business chain 110, and returning the contract addresses of the digital currency contracts to business chain 110; 2. Transferring transactions sent by business chain 110 to digital currency chain 120; 3. Sending blocks or transactions after consensus on digital currency chain 120 to the corresponding business chain 110 according to the contract addresses (the form sent after consensus can be either blocks or a list of transactions). Different business chains 110 can be distinguished by their contract addresses.
[0077] One or more business participants or service providers jointly build a business chain 110, on which business contracts 143 applicable to each participant run. Each participant runs at least one business chain node 150, and the business chain 110 includes multiple business chain nodes 150, which are connected to other business chain nodes 150. The business chain 110 is configured to reach consensus on business transactions that do not involve cryptocurrency transactions, and to execute blocks or transactions from a cryptocurrency server 130.
[0078] Figure 2 An interactive flowchart of a method 200 for deploying a digital currency smart contract according to at least one embodiment of the present disclosure is shown; Figure 7 This diagram illustrates the main steps of a digital currency server in a digital currency smart contract deployment method 700 according to at least one embodiment of this disclosure. The deployment process of the digital currency smart contract is also the registration process of the business chain 110 on the digital currency chain 120. The specific steps are as follows:
[0079] In step S701, the digital currency server 130 receives the registration information of the business chain 110 sent by the business chain user. The registration information includes the business chain identifier and transaction endorsement policy.
[0080] like Figure 2As shown, business chain user 180 submits a registration request to digital currency server 130 (step S201). This registration request includes registration information, including a business chain identifier and a transaction endorsement strategy. The business chain identifier identifies the registered business chain 110, facilitating subsequent queries of relevant information about the business chain 110 (e.g., after registration, the user can obtain the contract address, contract identifier, etc.), and allowing statistics on which business chains 110 are registered on digital currency chain 120. The transaction endorsement strategy is used in subsequent transaction processes to ensure that digital currency transaction instructions are recognized by the business chain 110, for example, by including the signature of business chain node 150. Specifically, the transaction endorsement strategy can be verified during registration to determine if the format is correct. If verification is successful, digital currency chain node 160 stores the transaction endorsement strategy. When business chain 110 sends digital currency transactions subsequently, the pre-stored transaction endorsement strategy is used to verify whether the transaction has been recognized by business chain 110.
[0081] Optionally, the registration information may also include the RPC (Remote Procedure Call) interface of the business chain 110, which is used by the digital currency server 130 to forward transactions to the business chain node 150, such as sending deployment instructions of digital currency smart contracts to the business chain node through the RPC interface, or the execution result of digital currency contract A 142, which may be in the form of blocks or transaction lists.
[0082] Business chain user 180 can send a registration request in various ways. For example, business chain user 180 can fill in relevant information and initiate a registration request through the front-end interface of a payment application on a mobile terminal. Specifically, for example, a digital currency wallet user can do so through their digital currency user wallet 170. Figure 3 You can initiate a registration request; alternatively, you can use other methods supported by the digital currency server 130 to send the registration information.
[0083] The digital currency server 130 receives registration information from the business chain 110 sent by the business chain user 180. It can directly convert the registration request, including this registration information, into a chain transaction and send the registration information to the digital currency chain node 160; alternatively, it can first verify the registration information, and if the verification is successful, then send the registration information to the digital currency chain node 160 as a chain transaction (step S202). If the registration request is initiated by a digital currency wallet user through their user wallet 170, the digital currency server 130 generally trusts the wallet user and only needs to verify the accuracy of the registration request format and the completeness of the registration information; after successful verification, it converts the request into a chain transaction. If the verification fails, it can provide feedback to the business chain user 180 indicating a failed registration (step S202').
[0084] In step S702, the digital currency server 130 sends registration information to the digital currency chain node 160. The digital currency chain node 160 executes the registration contract 141 deployed on the digital currency chain 120 according to the registration information, verifies the transaction endorsement strategy, and generates a contract identifier of the digital currency smart contract corresponding to the business chain identifier when the verification is successful.
[0085] Specifically, the digital currency server 130 forwards the registration information to the digital currency chain node 160 via a chain transaction. The digital currency chain node 160 executes the registration contract 141 deployed on the digital currency chain 120, first verifying the transaction endorsement strategy and checking whether the format of the transaction endorsement strategy is correct and whether the information is complete (step S203); when the verification is successful, a contract identifier for the digital currency smart contract corresponding to the business chain identifier is generated, and the digital currency smart contract can be deployed on the business chain 110 and the digital currency chain 120 subsequently.
[0086] Understandably, the cryptocurrency server 130 deploys a cryptocurrency contract A 142 and a cryptocurrency contract B 142' on the cryptocurrency chain 120 and the business chain 110 respectively, for business parties to use cryptocurrency for settlement. The two cryptocurrency contracts are completely identical, and their execution results are the same. This requires that the two cryptocurrency contracts be deployed based on the same contract generation algorithm. Generally speaking, if the algorithm is the same, the generated contract address will be the same. The identical cryptocurrency smart contracts deployed on the business chain 110 and the cryptocurrency chain 120 include the same contract address, the same contract identifier, and the same contract code, etc. Therefore, the execution results of transaction information on the two chains are consistent.
[0087] Optionally, when generating the contract identifier upon successful verification, the digital currency chain node 160 can also generate a digital currency chain endorsement strategy. This endorsement strategy indicates that the registration result has been recognized by the digital currency chain 120, and could be, for example, a signature from the digital currency chain node 160. The digital currency server 130, the business chain user 180, and / or the business chain node 150 can verify this endorsement strategy to confirm that the business chain 110 has completed registration on the digital currency chain 120, and that the registration result has been confirmed by the signature of the digital currency chain node 160.
[0088] An endorsement strategy can be understood as a verification condition for the legality of a transaction. Specifically, it refers to the process by which different nodes endorse a blockchain transaction, i.e., the nodes verify the blockchain transaction. Taking a cryptocurrency blockchain endorsement strategy as an example, it could involve 160 nodes executing the transaction, verifying the execution result, and signing it after successful verification. If only verification from some nodes is required, the cryptocurrency blockchain endorsement strategy would involve the relevant nodes verifying and signing the transaction; once the required number of signatures is reached, the verification condition is met. Both the cryptocurrency blockchain endorsement strategy and the transaction endorsement strategy can be flexibly configured.
[0089] Optionally, the contract identifier generated after verification by the registration contract 141 is stored in the registration contract 141 in correspondence with the registration information, that is, a correspondence between the registration information and the contract address is established in the registration contract 141. It can be understood that the contract identifier and the registration information can be stored in the registration contract in correspondence after the contract identifier is generated; or the contract identifier and the registration information can be stored in the registration contract 141 in correspondence at the same time as the contract identifier is generated (step S204).
[0090] If the verification of the transaction endorsement strategy of the registration contract fails, the digital currency server 130 responds by listening to the execution result of the verification failure generated by the registration contract (step S204') and sending the registration failure result to the business chain user 180 (step S205').
[0091] In step S703, the digital currency server 130 responds to the contract identifier generated by the registered contract 141 by generating and sending deployment instructions for the digital currency smart contract to the business chain node 150 and the digital currency chain node 160 respectively to complete the deployment of the digital currency smart contract.
[0092] The digital currency server 130 continuously monitors the block production status of the digital currency chain 120. When the digital currency chain 120 completes registration, the digital currency server 130 can obtain the registration result (step S205), which includes the contract identifier. In response to detecting the generated contract identifier, the digital currency server 130 generates a deployment instruction for the digital currency smart contract (step S206) and sends the deployment instruction to the business chain node and the digital currency chain node respectively (steps S207 and S207') to complete the deployment of the digital currency smart contract.
[0093] It is understood that the deployment instruction is a blockchain transaction, the main content of which is contract code. When the blockchain executes this transaction, it can generate a contract address and associate the contract address with the contract code. The deployment of the smart contract in this step can adopt a common smart contract deployment method in the art, and this disclosure does not limit it. Through the smart contract deployment method of this disclosure embodiment, the same digital currency contract B142' and digital currency contract A142 can be deployed on both the business chain 110 and the digital currency chain 120. The execution result obtained by the digital currency chain 120 executing digital currency contract A142 is consistent with the execution result obtained by the business chain 110 executing digital currency contract B142'.
[0094] When the registration information includes the RPC interface of the business chain, the deployment instruction of the digital currency smart contract is sent to the corresponding business chain node 150 through the RPC interface.
[0095] The digital currency chain node 160 and the business chain node 150 execute the same contract generation algorithm to generate the digital currency chain contract address and the business chain contract address (steps S208 and S208'). Optionally, the digital currency chain node 160 updates the digital currency chain contract address generated after the deployment of the digital currency smart contract to the registration contract 141 and binds it with the contract identifier and registration information for easy subsequent querying.
[0096] The digital currency server 130 listens to the digital currency chain contract address generated by the digital currency chain node 160 (step S209) and receives the business chain contract address returned by the business chain node 150 (step S209'), verifying whether the digital currency chain contract address and the business chain contract address are consistent (step S210). When the digital currency chain contract address and the business chain contract address are consistent, optionally, the digital currency server 130 saves the registration information and contract address accordingly; alternatively, it can further send the contract address to the business chain user 180 so that the business chain user 180 can add the contract address to their user wallet, that is, add the digital currency contract to the digital currency wallet, and then deposit, withdraw and trade (step S211).
[0097] It is understood that the operation of the digital currency in this embodiment is carried out through the wallet provided by the digital currency, not through the business party, thus ensuring the security of funds. Optionally, the registration result generated by executing the registration contract 141 also includes the digital currency chain endorsement strategy, which can also be returned to the business chain user 180 to facilitate the business chain user 180 in verifying the registration result. The digital currency chain endorsement strategy can be sent together with the contract address, or it can be sent separately as needed.
[0098] Optionally, the digital currency server 130 can save the contract address and establish a correspondence between the contract address and the registration information. If the digital currency server 130 does not save the contract address and registration information, the digital currency server 130 needs to query the digital currency chain 120 each time it is used.
[0099] Figure 14 A schematic diagram of the main modules of a digital currency server according to at least one embodiment of the present disclosure is shown. The digital currency server 130 includes a receiving module 131, a sending module 132, and a listening processing module 133.
[0100] The receiving module 131 is configured to receive the registration information of the business chain 110 sent by the business chain user 180. The registration information includes the business chain identifier and the transaction endorsement policy.
[0101] The sending module 132 is configured to send registration information to the digital currency chain node 160 so that the digital currency chain node 160 executes the registration contract 141 deployed on the digital currency chain 120, verifies the transaction endorsement strategy, and generates a contract identifier of the digital currency smart contract corresponding to the business chain identifier when the verification is successful.
[0102] The listening and processing module 133 is configured to generate and send deployment instructions for the digital currency smart contract to the business chain node 150 and the digital currency chain node 160 respectively in response to the detection of the contract identifier generated by the registered contract, so as to complete the deployment of the digital currency smart contract.
[0103] Figure 8 A schematic diagram illustrating the main steps of a digital currency chain node in a method 800 for deploying a digital currency smart contract according to at least one embodiment of the present disclosure is shown. Figure 15 A schematic diagram of the main modules of a digital currency chain node 160 according to at least one embodiment of the present disclosure is shown. The digital currency chain node 160 mainly includes an information acquisition module 161, a contract execution module 162, and a contract deployment module 163. The deployment method includes the following main steps S801-S803, and the detailed process of this deployment method 800 is as follows: Figure 7 The deployment method for digital currency server 130 corresponds to 700, and will not be repeated here.
[0104] In step S801, the information acquisition module 161 of the digital currency chain node 160 receives the business chain registration information sent by the business chain user 180 via the digital currency server 130. The registration information includes the business chain identifier and transaction endorsement policy.
[0105] In step S802, the contract execution module 162 executes the registration contract deployed on the digital currency chain 120, verifies the transaction endorsement strategy, and generates a contract identifier for the digital currency smart contract corresponding to the business chain identifier when the verification is successful.
[0106] In step S803, the contract deployment module 163 receives the deployment instruction of the digital currency smart contract generated and sent by the digital currency server 130 in response to the listening contract identifier, and completes the deployment of the digital currency smart contract.
[0107] Figure 3 A flowchart illustrating the recharge process of a transaction method 300 for a digital currency smart contract according to at least one embodiment of the present disclosure is shown. Figure 9 A schematic diagram illustrating the main steps of a deposit process in a digital currency smart contract transaction method 900 according to at least one embodiment of the present disclosure is shown. This transaction method is applied to a digital currency trading system, i.e., as... Figure 1 The system 100 shown is a digital currency smart contract system. This system includes: a digital currency chain 120, a digital currency server 130, and a business chain 110. The digital currency chain 120 and the business chain 110 are configured according to... Figure 2 , Figure 7 and Figure 8 The smart contract deployment method deployed the same digital currency smart contract, and the specific steps are as follows:
[0108] In step S901, node 160 of the digital currency chain 120 receives recharge information sent by user wallet 170. The recharge information includes the recharge amount and contract address. Based on the contract address, the node executes the digital currency smart contract deployed on the digital currency chain 120 to generate an execution result. The execution result includes deducting the recharge amount from the user wallet balance and adding the recharge amount to the user account balance on the digital currency chain 120. The user wallet and the user account have the same public key and private key.
[0109] Through the aforementioned deployment method, the digital currency contract has been added to the user wallet 170, and the user wallet 170 provided by the digital currency service provider supports deposit and withdrawal operations to the digital currency contract A 142. Deposit information is sent from the user wallet 170 to the digital currency chain node 160 (step S301). The digital currency chain node 160 receives the deposit information, which includes the deposit amount and contract address. Based on the contract address, it executes the corresponding digital currency contract A 142. The deposit amount identifies the amount of digital currency transferred from the user wallet 170 to the user's account on the digital currency chain 120 through this deposit. It is understood that a contract address represents a digital currency smart contract, and a contract address can include one or more different user accounts. In this embodiment, to facilitate user signing and verification, the user wallet and user account are set to be the same, i.e., they have the same public and private keys. Specifically, when the contract is subsequently invoked, if the user signs the transaction using their private key, the wallet can verify the transaction, and the digital currency chain node 160 can also verify it. The same digital currency smart contracts in this disclosure include the same contract address, the same contract identifier, and the same contract code.
[0110] Optionally, the digital currency chain node 160 first verifies the recharge information. The verification includes checking the format of the recharge information, its completeness, the user's signature, the existence of the contract address, and whether the user's wallet balance is greater than or equal to the recharge amount (step S302). If the verification passes, the execution result of the digital currency contract A 142 is generated. Specifically, this execution result includes two parts: deducting the recharge amount from the user's wallet balance (step S304), and adding the recharge amount to the user's account balance on the digital currency chain 120 (step S303). It is understood that the steps of deducting and adding the recharge amount can be performed simultaneously or as needed. To ensure fund security, the deduction step can be performed first, followed by the addition of the recharge amount. If the verification fails, a verification failure result is returned to the user's wallet 170 (step S303').
[0111] Optionally, the execution result of the digital currency smart contract also includes a digital currency chain endorsement strategy. This strategy identifies that the execution result has been recognized by the digital currency chain 120, for example, by including the signature of the digital currency chain node 160. This digital currency chain endorsement strategy can be verified by the digital currency server 130. If verification is successful, the execution result is sent to the business chain node 150 based on the contract address; alternatively, it can be verified by the business chain node 150, and if verification is successful, a balance adjustment is performed.
[0112] In step S902, the digital currency server 130, upon receiving the execution result, sends the execution result to the node of the business chain 110 according to the contract address.
[0113] The digital currency server 130 continuously monitors the block production status of the digital currency chain node 160 (step S305). Optionally, the digital currency server 130 can obtain the contract address based on the execution result, and through the correspondence between the RPC interface of the business chain (which may be included in the registration information) and the contract address stored locally, obtain the RPC interface of the business chain 110 (step S306), and send the execution result to the business chain node 150 through the RPC interface (step S307).
[0114] In step S903, the business chain node 150 updates the contract status of the digital currency contract B 142' deployed on the business chain according to the execution result, and adds the recharge amount to the balance of the business chain user account corresponding to the user account.
[0115] Specifically, business chain node 150 obtains the contract address of digital currency contract A 142 based on the execution result, and verifies the execution result (step S308). For example, it verifies the digital currency chain endorsement strategy to confirm that the execution result is recognized by the digital currency chain 120; or it verifies whether the execution result includes the signature of the digital currency server 130 to confirm the reliability of the execution result. If the verification is successful, the contract status of digital currency contract B 142' is updated based on the execution result, and the recharge amount is added to the balance of the business chain user account corresponding to the digital currency chain user account.
[0116] Since the digital currency chain 120 and the business chain 110 deploy the same digital currency contract A 142 and digital currency contract B 142', it can be understood that a copy of the digital currency ledger is maintained on the business chain 110. The contract address of the business chain 110 includes one or more user accounts, which correspond to the user accounts of the digital currency chain 120. The execution result of the digital currency chain 120 is sent to the business chain 110 through the digital currency server 130 to ensure that the amount changes of the user accounts and the business chain user accounts are synchronized (step S309). When the verification fails, the recharge result is returned (step S309').
[0117] It is understood that during the recharge process in this embodiment of the disclosure, since the amount does not exist on the business chain 110, the digital contract B 142' directly updates its status based on the execution result of the digital contract A 142, without actually executing it (directly executing the digital contract B 142' will fail to pass verification).
[0118] When making the first deposit for a user account, since no business chain user account has been opened on business chain 110, the balance cannot be increased. Therefore, it is necessary to first generate a business chain user account corresponding to the user account on digital currency chain 120, and then further increase the deposit amount in the balance of the generated business chain user account.
[0119] Figure 4 A flowchart illustrating the withdrawal process of a transaction method 400 for a digital currency smart contract according to at least one embodiment of the present disclosure is shown. Figure 10 This diagram illustrates the main steps of the withdrawal process in a digital currency smart contract transaction method 1000 according to at least one embodiment of the present disclosure. This transaction method is also applied to digital currency trading systems, i.e., as... Figure 1 The system 100 of the digital currency smart contract shown here, its specific system composition and other identical or corresponding steps will not be described in detail; its steps are similar to... Figure 3 , Figure 9 Correspondingly, including:
[0120] In step S1001, node 160 of the digital currency chain 120 receives withdrawal information sent by user wallet 170. The withdrawal information includes the withdrawal amount and contract address. The node executes the digital currency smart contract deployed on the digital currency chain 120 to generate an execution result. The execution result includes adding the withdrawal amount to the balance of the user wallet and deducting the withdrawal amount from the balance of the user account on the digital currency chain 120. The user wallet and the user account have the same public key and private key.
[0121] Using the aforementioned deployment method, the digital currency contract has been added to the user wallet 170, and the user wallet 170 provided by the digital currency service provider supports deposit and withdrawal operations to the digital currency contract A 142. Withdrawal information is sent to the digital currency chain node 160 through the user wallet 170 (step S401). The digital currency chain node 160 executes the corresponding digital currency contract A 142 based on the contract address in the withdrawal information.
[0122] Optionally, the digital currency chain node 160 first verifies the withdrawal information. The verification includes checking the format of the withdrawal information, its completeness, and whether the user's account balance exceeds the withdrawal amount (step S402). If the verification passes, the execution result of the digital currency contract A 142 is generated. Specifically, this execution result includes two parts: adding the withdrawal amount to the user's wallet balance (step S404), and deducting the withdrawal amount from the user's account balance on the digital currency chain 120 (step S403). It is understood that the order of deducting and adding the withdrawal amount can be flexibly set, with step S403 being completed first, i.e., successfully deducting the user's account balance before adding the balance to the user's wallet 170. If the verification fails, a verification failure result is returned to the user's wallet 170 (step S403').
[0123] Optionally, the execution result of the digital currency smart contract also includes a digital currency chain endorsement strategy. This strategy identifies that the execution result has been recognized by the digital currency chain 120, for example, by including the signature of the digital currency chain node 160. This digital currency chain endorsement strategy can be verified by the digital currency server 130. If verification is successful, the execution result is sent to the nodes of the business chain based on the contract address; alternatively, it can be verified by the business chain node 150. If verification is successful, the balance is adjusted.
[0124] In step S1002, the digital currency server 130, upon receiving the execution result, sends the execution result to the node of the business chain 110 according to the contract address.
[0125] The digital currency server 130 continuously monitors the block production status of the digital currency chain node 160 (step S405). Optionally, the digital currency server 130 can obtain the contract address based on the execution result, and through the correspondence between the RPC interface of the business chain (which may be included in the registration information) and the contract address stored locally, obtain the RPC interface of the business chain 110 (step S406), and send the execution result to the business chain node 150 through the RPC interface (step S407).
[0126] In step S1003, the business chain node 150 updates the contract status of the digital currency contract B142' deployed on the business chain 110 according to the execution result, and deducts the withdrawal amount from the balance of the business chain user account.
[0127] Specifically, business chain node 150 calls digital currency contract B 142' based on the contract address in the execution result, and verifies the execution result (step S408). For example, it verifies the digital currency chain endorsement strategy to confirm that the withdrawal information is recognized by digital currency chain 120; or it verifies whether the execution result includes the signature of digital currency server 130 to confirm the reliability of the execution result. If the verification is successful, the contract status of digital currency contract B 142' is updated based on the execution result, and the withdrawal amount is deducted from the balance of the business chain user account corresponding to the digital currency chain user account. The execution result of digital currency chain 120 is sent to business chain 110 through digital currency server 130 to ensure that the amount changes of the user account and the business chain user account are synchronized (step S409). If the verification fails, the withdrawal result is returned (step S409').
[0128] Figure 5 A transaction process interaction flowchart of a digital currency smart contract transaction method 500 according to at least one embodiment of the present disclosure is shown; Figure 11 This diagram illustrates the main steps of the business chain nodes in a transaction process of a digital currency smart contract transaction method 1100 according to at least one embodiment of the present disclosure. This transaction method 500 is also applied to a digital currency trading system, i.e., as... Figure 1 The system 100 shown is a digital currency smart contract; its specific system structure will not be detailed here. The specific steps are as follows:
[0129] In step S1101, the business chain node 150 responds to the business transaction request initiated by the business chain user 180 by determining whether the business transaction request includes digital currency settlement information; if the determination result is that it includes digital currency settlement information, a digital currency transaction instruction is generated, wherein the digital currency transaction instruction includes the transaction amount, contract address, payee user account, payer user account, and business transaction information.
[0130] Business chain user 180 initiates a business transaction request (step S501), which may include both a business transaction and a digital currency transaction. Specifically, an application example of this disclosure embodiment is provided. Business chain 110 may include one or more merchants and users. For example, business chain 110 provides mobile phone top-up services for mobile operators. When business chain user 180 initiates a top-up transaction, the transaction may include two types of information: one is settlement information related to digital currency, and the other is business-related information. In the scenario of topping up mobile phone credit, user A tops up 100 yuan. The settlement information related to digital currency is that 100 yuan is deducted from the user's account (i.e., the payer's user account) and 100 yuan is added to the operator's account (i.e., the payee's user account). The business-related information is that 100 yuan is added to user A's phone credit account. Understandably, all the above-mentioned cryptocurrency-related settlement and business-related information is integrated into a single transaction, which is verified and executed by cryptocurrency contract A 142, cryptocurrency contract B 142', and business contract 143, as missing information may prevent the transaction from being verified. Therefore, when processing transactions, cryptocurrency chain 120 can receive business-related information, but it can choose to store this business information or not, and only save the cryptocurrency settlement transaction information.
[0131] In the aforementioned scenario of topping up phone credit, user A initiates a transaction that includes two actions: topping up phone credit and transferring digital currency. Therefore, business chain node 150 first parses the business transaction request and uses the consensus algorithm of business chain 110 to determine whether the business transaction request includes digital currency settlement information (step S502). If the determination result indicates that digital currency settlement information is included, a digital currency transaction instruction is generated and sent to the digital currency server 130 (step S504). The digital currency transaction instruction includes the transaction amount, contract address, payee user account, payer user account, and business transaction information. Taking the phone credit topping-up scenario as an example, the contract address is used to determine the invoked digital currency contract A 142, the transaction amount indicates the topping-up amount, the payee user account indicates the operator's account, the payer user account indicates user A's account, and the business transaction information indicates the topping-up information for user A's phone credit account.
[0132] Optionally, the sent digital currency transaction instruction may also include a transaction endorsement strategy (step S503) to enable the digital currency chain node 160 to verify the transaction endorsement strategy, determine that the digital currency transaction instruction has been recognized by the business chain 110, and generate a transaction instruction execution result if the verification is successful.
[0133] It is understandable that if the judgment result is that digital currency settlement information is not included, the business transaction request will be executed by calling business contract 143 to complete the transaction; that is, business transaction requests that do not include digital currency settlement information will not be sent to digital currency server 130 and digital currency chain 120.
[0134] In step S1102, the business chain node 150 sends a digital currency transaction instruction to the digital currency server 130, so that the digital currency server 130 forwards the digital currency transaction instruction to the digital currency chain node 160, and listens for the digital currency chain node 160's response to receiving the digital currency transaction instruction. Based on the contract address, the business chain node 160 executes the transaction instruction generated by the digital currency contract A 142 deployed on the digital currency chain 120. The digital currency chain 120 and the business chain 110 deploy the same digital currency contract A 142 and digital currency contract B 142'.
[0135] Specifically, the digital currency server 130 receives a digital currency transaction instruction sent by the business chain node 150, verifies whether the instruction's format and parameters meet the requirements, whether the information is complete, whether the payer's signature is correct, whether the payer's user account balance is sufficient, and optionally, whether the transaction endorsement policy is met. When the verification is successful, the digital currency transaction instruction is sent to the digital currency chain node 160 (step S505). It is understood that the digital currency transaction instruction sent by the business chain node 150 may not use the chain transaction method of the digital currency chain 120; therefore, the digital currency transaction instruction forwarded by the digital currency server 130 can undergo necessary format conversion.
[0136] The digital currency chain node 160 receives the digital currency transaction instruction and, based on the contract address in the instruction, invokes and executes digital currency contract A 142 (step S506). Digital currency contract A 142 verifies the digital currency transaction instruction, including verifying the legality of the digital currency transaction and whether the payer's user account balance exceeds the transaction amount. Optionally, if the registration contract 141 of the digital currency chain 120 correspondingly stores the contract address and registration information, the transaction endorsement policy provided during registration can be obtained through the contract address and compared with the transaction endorsement policy in the digital currency transaction instruction to complete the verification.
[0137] The execution result of the transaction instruction of digital currency contract A 142 is as follows: according to the contract address in the digital currency transaction instruction, digital currency contract A 142 is executed, the transaction amount is added to the payee user account, and the transaction amount is deducted from the payer user account (step S507). It is understandable that in this step, each node of the digital currency chain 120 can determine whether an anomaly has occurred by checking the total transaction balance and whether the total balance in digital currency contract A 142 has changed.
[0138] When verification fails, the digital currency server 130 returns the execution result to the business chain node 150 based on the failed verification result (step S507') (step S508').
[0139] In step S1103, in response to receiving the transaction instruction execution result sent by the digital currency server 130, the business chain node 150 executes the digital currency contract B 142' and business contract 143 deployed on the business chain 110 to complete the transaction based on the digital currency transaction instruction.
[0140] The digital currency server 130 monitors the block production status of the digital currency chain 120, obtains the execution result of the transaction instruction (step S508), and after obtaining the result, returns the execution result to the business chain node 150 (step S509).
[0141] Optionally, the transaction instruction execution result also includes a digital currency chain endorsement strategy (step S507). Business chain node 150 verifies the digital currency chain endorsement strategy (step S510) to determine that the transaction instruction execution result is recognized by the digital currency chain 120. If the verification is successful, digital currency contract B 142' and business contract 143 are executed. Specifically, executing digital currency contract B 142' and business contract 143 to complete the transaction includes: adding the transaction amount to the payee's business chain user account corresponding to the payee's user account, and deducting the transaction amount from the payer's business chain user account corresponding to the payer's user account (step S511). After the transaction is completed, business chain node 150 returns the transaction result to business chain user 180 (step S512).
[0142] Figure 16 A schematic diagram of the main modules of a business chain node 150 according to at least one embodiment of the present disclosure is shown. The business chain node includes a transaction processing module 151, a business chain sending module 152, and a business chain execution module 153.
[0143] The transaction processing module 151 is configured to respond to a business transaction request initiated by a business chain user 180, determine whether the business transaction request includes digital currency settlement information; if the determination result is that digital currency settlement information is included, generate a digital currency transaction instruction, wherein the digital currency transaction instruction includes the transaction amount, contract address, payee user account, payer user account, and business transaction information;
[0144] The business chain sending module 152 is configured to send a digital currency transaction instruction to the digital currency server 130, so that the digital currency server 130 forwards the digital currency transaction instruction to the digital currency chain node 160, and listens for the digital currency chain node 160's response to receiving the digital currency transaction instruction, and executes the transaction instruction generated by digital currency contract A 142 according to the contract address. The digital currency chain 120 and the business chain 110 deploy the same digital currency contract A 142 and digital currency contract B 142'.
[0145] The business chain execution module 153 is configured to, in response to receiving the transaction instruction execution result sent by the digital currency server 130, execute the digital currency contract B 142' and the business contract 143 to complete the transaction based on the digital currency transaction instruction.
[0146] Figure 12 The diagram illustrates the main steps of a digital currency server in a transaction process of a digital currency smart contract transaction method 1200 according to at least one embodiment of the present disclosure. Figure 14 A schematic diagram of the main modules of a digital currency server according to at least one embodiment of the present disclosure is shown. The digital currency server 130 includes a receiving module 131, a sending module 132, and a listening and processing module 133. The transaction method includes the following main steps S1201-S1203, and the detailed process of the deployment method 1200 is as follows: Figure 11 The transaction process of business chain node 150 corresponds to 1100, which will not be repeated here.
[0147] In step S1201, the receiving module 131 of the digital currency server 130 receives a digital currency transaction instruction generated based on a business transaction request initiated by the business chain user 180, sent by the business chain node 150. The digital currency transaction instruction includes the transaction amount, contract address, payee user account, payer user account, and business transaction information.
[0148] In step S1201, the sending module 132 of the digital currency server 130 sends a digital currency transaction instruction to the digital currency chain node 160, so that the digital currency chain node 160 responds to the receipt of the digital currency transaction instruction and executes the digital currency contract A 142 according to the contract address to generate the transaction instruction execution result. The digital currency chain 120 and the business chain 110 deploy the same digital currency contract A 142 and digital currency contract B 142'.
[0149] In step S1203, the listening and processing module 133 of the digital currency server 130 listens to the execution result of the transaction instruction and sends the execution result of the transaction instruction to the business chain node 150 so that the business chain node 150 executes the digital currency contract B 142' and the business contract 143 based on the digital currency transaction instruction to complete the transaction.
[0150] The digital currency smart contract trading system of this disclosure, due to the separation of digital currency settlement information and business-related information, carries the risk of inconsistency between the two types of transaction results. Since transactions related to digital currency require consensus on the digital currency chain 120, and the digital currency contract B 142' of the business chain 110 is consistent with the digital currency contract A142 of the digital currency chain 120, in the aforementioned deposit and withdrawal process, as long as consensus is successful on the digital currency chain 120, consensus can also be successfully achieved on the business chain 110.
[0151] However, when business transactions occur, if an anomaly occurs in the digital currency settlement, such as insufficient balance, the digital currency chain 120 will determine the transaction to have failed. Similarly, the business chain 110 will also determine failure due to the failure of the digital currency chain 120. This situation will not cause consistency issues. Another scenario is that the digital currency settlement is successful, but the business processing fails. That is, the digital currency chain 120 successfully performs the digital currency settlement, but the business chain 110 cannot complete the digital currency settlement due to business failure. For example, a customer has paid but the merchant has no stock, or a user has paid for their phone bill, but the phone account top-up ultimately fails. This causes an inconsistency in the state of the digital currency contracts (digital currency contract A 142 and digital currency contract B 142') between the digital currency chain 120 and the business chain 110. In this case, the business participants need to negotiate to re-initiate the business processing without digital currency settlement or to refund the transaction amount. This disclosure will not elaborate on the business processing without digital currency settlement; however, the following solution is provided only for the scenario of initiating a transaction amount refund.
[0152] Figure 6 A flowchart illustrating the return process of a transaction method 600 for a digital currency smart contract according to at least one embodiment of the present disclosure is shown. Figure 13 The diagram illustrates the main steps of the transaction method 1300 of a digital currency smart contract according to at least one embodiment of the present disclosure, specifically the return process of the digital currency server. Figure 14 A schematic diagram of the main modules of a digital currency server according to at least one embodiment of the present disclosure is shown.
[0153] In step S1301, the receiving module 131 of the digital currency server 130 receives the digital currency return instruction generated by the business server 190 based on the transaction return request initiated by the business chain user 180. The digital currency return instruction includes the transaction amount, contract address, refund party user account, and return party user account.
[0154] Specifically, the user 180 in the business chain sends a transaction refund request to the business server 190 (step S601). The business server 190, for example in a mobile phone top-up scenario, could be the operator's server, used to verify whether a business transaction has been completed (step S602). If the verification shows that the digital currency settlement has been completed but the business transaction has not been successfully completed, the digital currency settlement can be refunded. In this case, the business server 190 generates and sends a digital currency refund instruction (step S603).
[0155] Optionally, the digital currency server 130 can verify the digital currency return instruction and forward it to the digital currency chain node 160 if the verification is successful. During forwarding, the format can be converted according to the chain transaction requirements of the digital currency chain 120 (step S604). If the verification fails in the above steps, a failure result can be returned directly.
[0156] In step S1302, the sending module 132 of the digital currency server 130 sends a digital currency return instruction to the digital currency chain node 160, so that the digital currency chain node 160 responds to the receipt of the digital currency return instruction and executes the digital currency contract A 142 according to the contract address to generate the return instruction execution result. The digital currency chain 120 and the business chain 110 deploy the same digital currency contract A 142 and digital currency contract B 142'.
[0157] The result of the return instruction execution is the execution of digital currency contract A142 according to the contract address in the digital currency return instruction, which increases the transaction amount in the returner's user account and deducts the transaction amount from the refunder's user account (step S606).
[0158] Optionally, the return instruction execution result may also include the digital currency chain endorsement strategy, sending the return instruction execution result to the business chain node 150 so that the business chain node 150 can verify the digital currency chain endorsement strategy. If the verification is successful, the digital currency contract B 142' will be executed.
[0159] Optionally, the digital currency return instruction also includes a transaction endorsement strategy, which enables the digital currency chain node 160 to verify the transaction endorsement strategy and generate a return instruction execution result if the verification is successful (step S605); if the verification fails, the digital currency server 130 listens to the verification result of the digital currency contract A 142 (step S606') and returns the result to the business chain user 180 through the business chain node 150 (step S607'); or it can also be sent to the business server 190 through the digital currency server 130. The specific failure result return path can be set as needed, and this disclosure does not limit it.
[0160] In step S1303, the listening and processing module 133 of the digital currency server 130 listens to the execution result of the return instruction and sends the execution result of the return instruction to the business chain node 150 so that the business chain node 150 executes the digital currency contract B 142' based on the digital currency return instruction to complete the transaction return.
[0161] The digital currency server 130 listens for the execution result of the rollback instruction (step S607) and sends the rollback instruction execution result to the business chain node 150 (step S608). Optionally, the digital currency server 130 stores the correspondence between the RPC interface and the contract address of the business chain 110; it obtains the RPC interface of the business chain 110 based on the contract address and sends the rollback instruction execution result to the business chain node 150 through the RPC interface.
[0162] Execute digital currency contract B 142', including: adding the transaction amount to the returner's business chain user account corresponding to the returner's user account, and deducting the transaction amount from the refunder's business chain user account corresponding to the refunder's user account (step S610); and returning the refund result to business chain user 180 (step S611).
[0163] Optionally, before adjusting the balance of a user's account in the business chain, the digital currency chain endorsement strategy can be verified (step S609) to ensure that the execution result of the return instruction is recognized by the digital currency chain 120.
[0164] It is important to note that, in addition to the scenario of only refunding the transaction amount, there are also situations where both the transaction amount refund and the business refund are processed simultaneously. Taking online shopping as an example, there may be situations where a refund is processed separately or where a return and refund are processed. For instance, a customer may have already paid, the merchant may have completed the shipment, but both parties may agree to a return and refund. This could be a full refund or a partial refund based on the amount agreed upon by both parties; this disclosure does not limit the specifics. In this case, the business participants need to negotiate and initiate a transaction refund request. The transaction refund request, and the digital currency refund instruction generated based on it, also include business refund information. After the digital currency chain node 160 executes digital currency contract A 142 to generate the refund instruction execution result, the digital currency server 130 listens to the refund instruction execution result and sends it to the business chain node 150. Based on the digital currency refund instruction, the business chain node 150 executes digital currency contract B 142' and business contract 143 to complete the transaction refund, meaning that both the return and refund can be completed simultaneously.
[0165] It is understood that, in each step of the above methods, in order to ensure data security, the validity of parameters and identity of requests and responses can be verified. The verification method can adopt conventional implementation methods in this field, and this disclosure does not limit it.
[0166] It should be noted that the above application scenarios are merely exemplary, intended to describe one or more aspects of this disclosure in specific scenarios. However, these aspects are not essential, and various modifications can be made to the application scenario. It is readily understood that the specific application scenarios described in this disclosure are not limited.
[0167] At least some embodiments of this disclosure also provide an electronic device. Figure 17 A schematic diagram of an electronic device 1700 according to at least one embodiment of the present disclosure is shown.
[0168] like Figure 17 As shown, the electronic device 1700 includes one or more processors 1710 and a memory 1720. The memory 1720 includes one or more computer program modules 1721. The one or more computer program modules 1721 are stored in the memory 1720 and are executed by the processor 1710. These computer program modules 1721 include instructions for executing a digital currency-based transaction method and its additional aspects according to at least one embodiment of the present disclosure. When executed by the processor 1710, they can perform one or more steps of the digital currency-based transaction method and its additional aspects according to at least one embodiment of the present disclosure. The memory 1720 and the processor 1710 can be interconnected via a bus system and / or other forms of connection mechanisms (not shown). For example, the bus can be a Peripheral Component Interconnect Standard (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc.
[0169] For example, processor 1710 may be a central processing unit (CPU), a digital signal processor (DSP), or other processing unit with data processing and / or program execution capabilities, such as a field-programmable gate array (FPGA). Processor 1710 may be a general-purpose processor or a special-purpose processor that can control other components in electronic device 1700 to perform desired functions.
[0170] Exemplarily, memory 1720 may include any combination of one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, erasable programmable read-only memory (EPROM), portable compact disc read-only memory (CD-ROM), USB memory, flash memory, etc. One or more computer program modules 1721 may be stored on the computer-readable storage medium, and processor 1710 may run one or more computer program modules 1721 to implement various functions of electronic device 1700. The computer program modules include multiple computer-executable instructions. Various application programs and various data, as well as various data used and / or generated by the application programs, may also be stored in the computer-readable storage medium.
[0171] For example, electronic device 1700 may also include input devices such as touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, and gyroscopes; output devices such as liquid crystal displays, speakers, and vibrators; storage devices such as magnetic tapes and hard disks (HDDs or SDDs); and communication devices such as network interface cards such as LAN cards and modems. The communication devices allow electronic device 1700 to communicate wirelessly or wiredly with other devices to exchange data and perform communication processing via networks such as the Internet. A drive is connected to the I / O interface as needed. Removable storage media, such as disks, optical disks, magneto-optical disks, and semiconductor memories, are installed on the drive as needed so that computer programs read from them can be installed into the storage device as required.
[0172] For example, the electronic device 1700 may further include a peripheral interface (not shown in the figure). This peripheral interface can be of various types, such as a USB interface, a Lightning interface, etc. The communication device can communicate wirelessly with networks and other devices, such as the Internet, intranets and / or wireless networks such as cellular telephone networks, wireless local area networks (LANs) and / or metropolitan area networks (MANs). Wireless communication can use any of a variety of communication standards, protocols, and technologies, including but not limited to Global System for Mobile Communications (GSM), Enhanced Data GSM Environment (EDGE), Wideband Code Division Multiple Access (W-CDMA), Code Division Multiple Access (CDMA), Time Division Multiple Access (TDMA), Bluetooth, Wi-Fi (e.g., based on IEEE 802.11a, IEEE 802.11b, IEEE 802.11g, and / or IEEE 802.11n standards), Voice over Internet Protocol (VoIP), Wi-MAX, protocols for email, instant messaging, and / or Short Message Service (SMS), or any other suitable communication protocol.
[0173] The electronic device 1700 may be, for example, a system-on-a-chip (SoC) or a device including the SoC. For instance, it can be any device such as a mobile phone, tablet, laptop, e-reader, game console, television, digital photo frame, navigator, home appliance, communication base station, industrial controller, server, etc., or any combination of data processing devices and hardware. The embodiments of this disclosure do not limit this. The specific functions and technical effects of the electronic device 1700 can be found in the foregoing description of the digital currency-based transaction method and its additional aspects according to at least one embodiment of this disclosure, and will not be repeated here.
[0174] Figure 18 A schematic diagram of a readable storage medium 1800 according to at least one embodiment of the present disclosure is shown.
[0175] like Figure 18 As shown, a computer program 1810 is stored on a readable storage medium 1800, which is a computer-readable storage medium. When the computer program 1810 is executed by a processor, it performs one or more steps of the above-described digital currency-based transaction method and its additional aspects.
[0176] For example, when the program code is read by a computer, the computer can execute the program code stored in the computer storage medium to perform one or more steps to implement, for example, a digital currency-based transaction method and its additional aspects according to at least one embodiment of the present disclosure.
[0177] For example, the readable storage medium may include a memory card of a smartphone, a storage component of a tablet computer, a hard disk of a personal computer, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), portable compact disc read-only memory (CD-ROM), flash memory, and other readable storage media or any combination thereof. The readable storage medium 1800 may be a non-transitory readable storage medium.
[0178] At least some of the embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other.
[0179] It should be noted that, in this disclosure, relational terms such as "first," "second," etc., are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. The terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes the element.
[0180] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, or they may sometimes be executed in reverse order, depending on the functions involved; that is, the preceding or following operations are not necessarily executed precisely in sequence. Instead, various steps may be processed in reverse order or simultaneously as needed. Furthermore, other operations may be added to these processes, or one or more operations may be removed from these processes.
[0181] The units described in the embodiments of this disclosure can be implemented in software or hardware. The described units can also be located in a processor. The names of these units do not, in some cases, constitute a limitation on the unit itself.
[0182] The following points should be noted regarding this disclosure:
[0183] (1) The accompanying drawings of the embodiments of this disclosure only involve the structures involved in the embodiments of this disclosure. Other structures can be referred to the general design.
[0184] (2) Where there is no conflict, the embodiments of this disclosure and the features in the embodiments can be combined with each other to obtain new embodiments.
[0185] The above are merely exemplary embodiments of this disclosure and are not intended to limit the scope of protection of this disclosure, which is determined by the appended claims.
Claims
1. A digital currency-based transaction system, characterized in that, The system includes a digital currency chain, a digital currency server, and a business chain. The digital currency chain and the business chain deploy the same digital currency smart contracts, wherein: The nodes of the digital currency chain are configured to receive recharge information sent by a user's wallet, wherein the recharge information includes a recharge amount and a contract address; and to execute the digital currency smart contract deployed on the digital currency chain according to the contract address to generate an execution result, wherein the execution result includes deducting the recharge amount from the user's wallet balance and adding the recharge amount to the user's account balance on the digital currency chain, wherein the user's wallet and the user's account have the same public key and private key; The digital currency server is configured to send the execution result to the node of the business chain according to the contract address in response to listening to the execution result; The nodes of the business chain are configured to update the contract status of the digital currency smart contract deployed on the business chain according to the execution result, and to add the recharge amount to the balance of the business chain user account corresponding to the user account.
2. The system according to claim 1, characterized in that, The step of adding the recharge amount to the balance of the business chain user account corresponding to the user account includes: Generate a business chain user account corresponding to the user account, and add the recharge amount to the balance of the business chain user account.
3. The system according to claim 1, characterized in that, The nodes of the digital currency chain are further configured as follows: Verify the recharge information, and if the verification is successful, generate the execution result of the digital currency smart contract.
4. The system according to claim 1, characterized in that, The digital currency server stores the correspondence between the RPC interface of the business chain and the contract address; The digital currency server is further configured to: obtain the RPC interface of the business chain based on the contract address, and send the recharge information to the business chain node through the RPC interface.
5. The system according to claim 1 or 4, characterized in that, The execution results also include the digital currency chain endorsement strategy; The digital currency server is further configured to: verify the digital currency chain endorsement strategy, and if the verification is successful, send the recharge information to the nodes of the business chain according to the contract address.
6. A transaction system based on digital currency, characterized in that, The system includes a digital currency chain, a digital currency server, and a business chain. The digital currency chain and the business chain deploy the same digital currency smart contracts, wherein: The nodes of the digital currency chain are configured to receive withdrawal information sent by a user's wallet, wherein the withdrawal information includes the withdrawal amount and a contract address; and to execute the digital currency smart contract deployed on the digital currency chain according to the contract address to generate an execution result, wherein the execution result includes adding the withdrawal amount to the user's wallet balance and deducting the withdrawal amount from the user's account balance on the digital currency chain, wherein the user's wallet and the user's account have the same public and private keys; The digital currency server is configured to send the execution result to the node of the business chain according to the contract address in response to listening to the execution result; The nodes of the business chain are configured to update the contract status of the digital currency smart contract deployed on the business chain according to the execution result, and deduct the withdrawal amount from the balance of the business chain user account corresponding to the user account.
7. The system according to claim 6, characterized in that, The nodes of the digital currency chain are further configured as follows: Verify the withdrawal information, and if the verification is successful, generate the execution result of the digital currency smart contract.
8. The system according to claim 6, characterized in that, The digital currency server stores the correspondence between the RPC interface of the business chain and the contract address; The digital currency server is further configured to: obtain the RPC interface of the business chain based on the contract address, and send the withdrawal information to the business chain node through the RPC interface.
9. The system according to claim 6 or 8, characterized in that, The execution results also include the digital currency chain endorsement strategy; The digital currency server is further configured to: verify the digital currency chain endorsement strategy, and if the verification is successful, send the withdrawal information to the node of the business chain according to the contract address.
10. A transaction method based on digital currency, characterized in that, This is applied to a cryptocurrency-based trading system, which includes a cryptocurrency blockchain, a cryptocurrency server, and a business chain. The cryptocurrency blockchain and the business chain deploy the same cryptocurrency smart contracts, wherein: The nodes of the digital currency chain receive recharge information sent by the user's wallet, wherein the recharge information includes the recharge amount and the contract address; and execute the digital currency smart contract deployed on the digital currency chain according to the contract address to generate an execution result, wherein the execution result includes deducting the recharge amount from the user's wallet balance and adding the recharge amount to the user's account balance on the digital currency chain, wherein the user's wallet and the user's account have the same public key and private key; In response to receiving the execution result, the digital currency server sends the execution result to the node of the business chain according to the contract address; The nodes of the business chain update the contract status of the digital currency smart contract deployed on the business chain according to the execution result, and add the recharge amount to the balance of the business chain user account corresponding to the user account.
11. A transaction method based on digital currency, characterized in that, This is applied to a cryptocurrency-based trading system, which includes a cryptocurrency blockchain, a cryptocurrency server, and a business chain. The cryptocurrency blockchain and the business chain deploy the same cryptocurrency smart contracts, wherein: The nodes of the digital currency chain receive withdrawal information sent by the user's wallet, wherein the withdrawal information includes the withdrawal amount and the contract address; and execute the digital currency smart contract deployed on the digital currency chain according to the contract address to generate an execution result, wherein the execution result includes adding the withdrawal amount to the user's wallet balance and deducting the withdrawal amount from the user's account balance on the digital currency chain, wherein the user's wallet and the user's account have the same public key and private key; In response to receiving the execution result, the digital currency server sends the execution result to the node of the business chain according to the contract address; The nodes of the business chain update the contract status of the digital currency smart contract deployed on the business chain according to the execution result, and deduct the withdrawal amount from the balance of the business chain user account corresponding to the user account.
12. An electronic device, characterized in that, include: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the method as claimed in claim 10 or 11.
13. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as claimed in claim 10 or 11.