WO2020037927A1 - Negotiable block chain transaction method, apparatus, device, and storage medium - Google Patents

Negotiable block chain transaction method, apparatus, device, and storage medium Download PDF

Info

Publication number
WO2020037927A1
WO2020037927A1 PCT/CN2018/124439 CN2018124439W WO2020037927A1 WO 2020037927 A1 WO2020037927 A1 WO 2020037927A1 CN 2018124439 W CN2018124439 W CN 2018124439W WO 2020037927 A1 WO2020037927 A1 WO 2020037927A1
Authority
WO
WIPO (PCT)
Prior art keywords
request
transaction
ledger
formal
balance
Prior art date
Application number
PCT/CN2018/124439
Other languages
French (fr)
Chinese (zh)
Inventor
谢丹力
贾牧
陆陈一帆
Original Assignee
深圳壹账通智能科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳壹账通智能科技有限公司 filed Critical 深圳壹账通智能科技有限公司
Publication of WO2020037927A1 publication Critical patent/WO2020037927A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/40Authorisation, e.g. identification of payer or payee, verification of customer or shop credentials; Review and approval of payers, e.g. check credit lines or negative lists
    • G06Q20/401Transaction verification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3829Payment protocols; Details thereof insuring higher security of transaction involving key management

Definitions

  • the present application relates to the field of blockchain technology, and relates to a negotiable blockchain transaction method, device, device, and storage medium.
  • the blockchain is essentially a distributed database. The entire data storage process is initiated by the application in the form of a transaction. On the blockchain, after being signed and endorsed by all parties, the transaction is accepted and the result of the transaction is written back to the blockchain. Once the transaction is written Blockchain is irrevocable.
  • the technical problem to be solved in this application is to overcome the problem that the transactions on the blockchain cannot be changed or revoked in the prior art.
  • a negotiable blockchain transaction method, device, device and storage medium are proposed.
  • Transaction buffer used to buffer all unconfirmed transaction messages.
  • a negotiable blockchain transaction method A temporary ledger block and a formal ledger block with a mapping relationship are established on the blockchain.
  • the transaction includes the following steps:
  • the temporary ledger block has a mapping relationship in the formal ledger block
  • the temporary ledger balance and formal ledger balance of both parties to the transaction are added to the transaction amount included in the latest request, respectively.
  • the electronic device stores a negotiable blockchain transaction system.
  • the negotiable blockchain transaction system includes:
  • the request receiving module is used to receive a transaction request initiated by the blockchain in the transfer of funds out of the transaction, and a feedback request initiated by the blockchain opposite to the originating request;
  • a verification module for verifying the zero-knowledge certificate of the current temporary ledger balance, the zero-knowledge certificate of the current formal ledger balance, and the signature included in the received request, and after all the verifications are passed, all The content is written into the temporary ledger block corresponding to the transaction request;
  • a feedback request identification module configured to identify the type of the feedback request, and jump to the verification module when the feedback request is a transaction modification request, and further identify the end of the transaction when the feedback request is a transaction end request.
  • a formal ledger modification module is configured to: when the transaction end request is a consent transaction request, the formal ledger balance included in the consent transaction request and the formal request included in the last request initiated by the counterparty of the consent request sender The ledger balance is written into a formal ledger block having a mapping relationship with the temporary ledger block;
  • the transaction termination module is configured to: when the transaction end request is a transaction refusal request, in the temporary ledger block, add the temporary ledger balance and formal ledger balance of both parties to the transaction to the transaction amount included in the latest request, respectively.
  • This application also discloses a computer device including a memory and a processor.
  • the memory stores a negotiable blockchain transaction system that can be executed by the processor, and the system is implemented when the system is executed by the processor. The following steps:
  • the temporary ledger block has a mapping relationship in the formal ledger block
  • the temporary ledger balance and formal ledger balance of both parties to the transaction are added to the transaction amount included in the latest request, respectively.
  • the present application also discloses a computer-readable storage medium.
  • the computer-readable storage medium stores computer program instructions, and the computer program instructions can be executed by at least one processor to enable the at least one processor to execute. The following steps:
  • the temporary ledger block has a mapping relationship in the formal ledger block
  • the temporary ledger balance and formal ledger balance of both parties to the transaction are added to the transaction amount included in the latest request, respectively.
  • This application breaks the deadlock that cannot be negotiated online in the traditional blockchain transaction model
  • This application divides the ledger into a temporary ledger and a formal ledger, so that the negotiation process will not affect the formal ledger.
  • FIG. 1 shows a flowchart of Embodiment 1 of a negotiable blockchain transaction method
  • FIG. 2 shows a flowchart of a second embodiment of a negotiable blockchain transaction method
  • FIG. 3 shows a schematic diagram of a program module of a first embodiment of a negotiable blockchain transaction system in an electronic device of the present application
  • FIG. 4 shows a schematic diagram of a program module of a second embodiment of a negotiable blockchain transaction system in an electronic device of the present application
  • FIG. 5 shows a schematic diagram of a hardware architecture of an embodiment of a computer device of the present application.
  • this application proposes a negotiable blockchain transaction method.
  • This method requires the establishment of a temporary ledger block and a formal ledger block with a mapping relationship on the blockchain. That is, two sets of ledgers are established on the blockchain with a mapping relationship between the two sets of ledgers (between the two sets of ledgers).
  • the mapping relationship can be regarded as two states of a ledger, and they have the same AccountId (account ID), that is, the mapping relationship is determined by AccountId). All transaction records before confirmation are only recorded in the temporary ledger block. Only the transaction that is finally confirmed will be recorded in both the temporary ledger block and the formal ledger block.
  • the negotiable blockchain transaction includes the following steps:
  • Step 01 Receive a transaction request initiated by the transfer of funds in the transaction to the blockchain.
  • the fund transfer party is from the perspective of the ledger, and refers to the party whose funds are reduced.
  • the content of the transaction request includes a ledger ID, a current transaction ID, a transaction requester ID, a transaction counterparty ID, a transaction amount, a current temporary ledger balance of the transaction requester, a current formal ledger balance of the transaction requester, and the current formal ledger Zero-knowledge proof of the balance, zero-knowledge proof of the current temporary ledger balance, and the signature of the requester of the transaction.
  • the ledger ID is used to distinguish the creator of the ledger. For example, WeChat's ledger is recorded by the blockchain created by Tencent. Alipay's ledger is recorded by the blockchain created by Facebook. Since anyone can create a blockchain ledger, In order to distinguish ledgers, each ledger is assigned an ID for unique identification, which is the ledger ID.
  • the current transaction ID, transaction requester ID, and transaction counterparty ID are IDs used to uniquely distinguish the transaction, the transaction requester, and the transaction counterparty, respectively.
  • the current formal ledger balance of the transaction requester refers to the real balance of the transaction requester recorded in the formal ledger block; the current temporary ledger balance of the transaction requester refers to the transaction requester (specifically in this step: The official account balance (real balance) of the fund transfer party that initiated the transaction request minus all its pending transactions (because the transaction requester is allowed to initiate multiple transaction requests at the same time, and these transaction requests are (Before confirmation, all are in the state of confirmation) The difference after the sum of the amounts.
  • the transaction requester initiated two pending transactions, specifically to deliver two transactions totaling 100 yuan to its counterparty. Since neither transaction has been confirmed by the counterparty of the transaction, the transaction The claimant's account book also has the 100 yuan, that is, the 100 yuan has not been deducted from its real balance, but the 100 yuan has been deducted from its temporary account book balance. Are inconsistent.
  • the zero-knowledge proof refers to a method in which the demonstrator does not disclose any information when proving his identity, and the verifier cannot obtain any private information of the demonstrator, but can effectively prove the identity of the other party.
  • ZCASH the name of an electronic currency
  • the digital currency uses zero-knowledge proof and is completely anonymous during the entire transaction process.
  • A transfers to B and creates a UTXO (Unspent Transaction Output).
  • the original will be sent to a void list, but this list records the previous serial number or code, which proves the previous UTXO Failure. In this process, B cannot see the information before A, but the transaction does occur.
  • Zero-knowledge proofs are used to ensure that there is no “double spending” on the transfer side.
  • the signing used uses asymmetric encryption technology and digital digest technology to ensure the integrity of the data during transmission and the authenticity of the sender's identity cannot be counterfeited.
  • Asymmetric encryption technology will generate a public key and a private key. The public key and the private key are a pair. The private key is kept in the owner's hands. It needs to be kept secret from outsiders. Other information recipients are public. If the private key is used to encrypt the data, only the corresponding public key can be decrypted. Conversely, the data encrypted by the public key can only be decrypted by the corresponding private key.
  • a digital digest uses a hash function to transform information of any length into fixed-length information. The hash function is a one-way generation system, and the input value is generated irreversibly by the generated hash value.
  • the transaction amount described here and the current temporary ledger balance of the transaction requester and the current formal ledger balance of the transaction requester are encrypted.
  • Step 02 Verify the zero-knowledge certificate of the current temporary ledger balance, the zero-knowledge certificate of the current formal ledger balance, and the signature included in the received request. If the verification is passed, write all the content contained in the request To the temporary ledger block corresponding to the transaction request.
  • the verification means that the current temporary ledger balance and the current official ledger balance are both greater than zero, and that the transaction request is indeed initiated by the transaction requester in the transaction (ie, signature verification).
  • the counterparty of the requesting party that sent the request uses the public key to decrypt the current temporary ledger balance, current formal ledger balance, and transaction amount contained in the request. Only the content encrypted with the private key corresponding to the public key can be decrypted by the public key. In this way, the identity verification of the requesting party (that is, the transaction requesting party) that sends the request is implemented. Once the decryption fails, the signature verification fails.
  • the zero-knowledge proof of the current temporary ledger balance and the zero-knowledge proof of the current formal ledger balance are further verified to determine whether the balances of both ledgers are greater than zero.
  • Step 03 Receive a feedback request initiated by the blockchain in the opposite direction of the request, and determine the type of the feedback request. If the feedback request is a transaction modification request, step 02 is performed; if the feedback request is a transaction end request, Then go to step 04.
  • the content of the transaction modification request includes the current transaction ID, the transaction requester ID, the transaction counterparty ID, the new transaction amount, the current temporary ledger balance of the feedback requesting party, the formal ledger balance of the feedback requesting party, and the current temporary ledger balance Zero-knowledge proof of, the zero-knowledge proof of the current formal ledger balance, and the signature of the requester of feedback.
  • the transaction end request includes a transaction approval request and a transaction rejection request.
  • the counterparty of the transaction When the counterparty of the transaction receives the transaction request sent by the counterparty, it needs to respond to the request. If the amount needs to be modified, it directly sends a transaction modification request. If it agrees with the transaction or rejects the transaction, it sends a transaction end request.
  • the transaction modification request here is equivalent to a new transaction, and the counterparty of the request is required to provide feedback on the transaction modification request.
  • a transaction can be modified for several rounds, unlimited times, and a transaction can only be formally concluded when a transaction end request is received.
  • the formal ledger balance needs to be included in the request, so that once the transaction is completed, the formal ledger balance will be written into the formal ledger block.
  • the counterparty here is relative to the originator of the request.
  • the counterparty is the transferee;
  • the counterparty is the transferee;
  • the modification of the transaction can be made back and forth multiple times, so this counterparty depends on who initiated the transaction modification request.
  • the originator of the transaction modification request is the fund transfer-in party, then the counterparty is the fund transfer-out party.
  • the initiator is the transferer of funds, and the counterparty is the transferer of funds.
  • Step 04 Determine whether the transaction end request agrees with the transaction request or rejects the transaction request. If the transaction request is agreed, step 05 is performed, and if the transaction request is rejected, step 06 is performed.
  • the content of the consent transaction request includes the current transaction ID, the originating requester ID, the requesting counterparty ID, the consent instruction, the consent requester's temporary ledger balance after consent, the consent requestor's formal ledger balance, and the zero of the formal ledger balance. Proof of knowledge; the content of the rejected transaction request includes the current transaction ID, the requesting party ID, the requesting counterparty ID, the rejection instruction, and the temporary account balance of the rejecting requester after rejection.
  • the specific type of the request is identified by identifying whether the transaction end request includes an consent instruction or a rejection instruction.
  • Step 05 Write the formal ledger balance included in the consent transaction request and the formal ledger balance included in the last request initiated by the counterparty of the consent request sender to the temporary ledger block that has a mapping relationship with the temporary ledger block. In the official ledger block.
  • the bookkeeping action in the formal ledger block is triggered by a request to agree to a transaction. As long as one party in the transaction sends a request to agree to the transaction, it means that it has agreed to the transaction amount in the request sent by the other party.
  • Step 06 In the temporary ledger block, the temporary ledger balance and official ledger balance of both parties to the transaction are added to the transaction amount included in the latest request, respectively.
  • the account balance involves the temporary account balance and the official account balance.
  • the formal ledger balance mentioned here refers to the formal ledger balance recorded on the temporary ledger block, but the formal ledger balance on the actual formal ledger block has not changed in any way.
  • the negotiable blockchain transaction method includes the following steps:
  • Steps 01 to 04 are the same as those in the first embodiment, and details are not described herein again.
  • Step 051 Reconfirm the transaction pointed to by the agreed transaction request according to a preset reconfirmation strategy. If the reconfirmation is passed, go to step 05, otherwise go to step 06.
  • the reconfirmation strategy may be any one of a third party confirmation, a counterparty confirmation of the transaction request, and a delayed automatic confirmation.
  • the re-confirmation strategy adopts third-party confirmation
  • the third party may be a regulatory agency, for example.
  • the transaction request in step 01 also includes a third-party ID and contains Additional information for all content in this transaction request, said additional information is only accessible to third parties.
  • the additional information can be encrypted by ECDH, and only the third party has the corresponding decryption key.
  • the steps of the third party confirmation are as follows:
  • Step 0511 Receive an approved transaction request sent by a third party.
  • the content of the approved transaction request includes a current transaction ID, a transaction requester ID, a transaction counterparty ID, a signature of a third party, and a consent instruction or a rejection instruction.
  • Step 0512 Determine whether the approved transaction includes a consent instruction or a rejection instruction. If a consent instruction is included, step 05 is performed, and if a rejection instruction is included, step 06 is performed.
  • the reconfirmation strategy uses the counterparty confirmation of the transaction request, and the confirmation steps are the same as in the previous embodiment, and only the confirming party is different.
  • the third party confirmation adopts a delayed automatic confirmation.
  • the step of delaying automatic confirmation includes:
  • step 05 It is determined whether a request for canceling a transaction sent by any of the two parties to the transaction is received within a preset time; if a request for canceling a transaction is not received, step 05 is performed; if a request for canceling a transaction is received, step 06 is performed.
  • Steps 05 to 06 are the same as those in the first embodiment, and details are not described herein again.
  • this application proposes an electronic device.
  • the electronic device stores a negotiable blockchain transaction system 20, and the system 20 can be divided into one or more program modules.
  • FIG. 3 shows a schematic diagram of a program module of the first embodiment of the negotiable blockchain transaction system 20.
  • the system 20 can be divided into a request receiving module 201, a verification module 202, and a feedback
  • the request identification module 203, the formal ledger modification module 204, and the transaction termination module 205 are included in the program module referred to in the present application.
  • the program module referred to in the present application refers to a series of computer program instruction segments capable of performing specific functions. The following description will specifically introduce the specific functions of the program modules 201-205.
  • the request receiving module 201 is configured to receive a transaction request initiated by a block of funds in a transaction and a feedback request initiated by a block chain opposite to the originating request.
  • the verification module 202 is configured to verify the zero-knowledge certificate of the current temporary ledger balance, the zero-knowledge certificate of the current formal ledger balance, and the signature included in the received request, and after the verification is passed, the request includes All the contents of are written into the temporary ledger block corresponding to the transaction request.
  • the feedback request identification module 203 is configured to identify the type of the feedback request, and jump to the verification module when the feedback request is a transaction modification request, and further identify the feedback request when the feedback request is a transaction end request. The type of transaction end request.
  • the formal ledger modification module 204 is configured to include the formal ledger balance included in the consent transaction request and the last request initiated by the counterparty of the consent request sender when the transaction end request is a consent transaction request.
  • the formal ledger balance is written into a formal ledger block having a mapping relationship with the temporary ledger block.
  • the transaction termination module 205 is configured to add, in the temporary ledger block, the temporary ledger balance and formal ledger balance of both parties to the transaction in the temporary ledger block, together with the transactions included in the latest request. Amount.
  • FIG. 4 shows a schematic diagram of a program module of the second embodiment of the negotiable blockchain transaction system 20.
  • the negotiable blockchain transaction system 20 can also be divided into requests The receiving module 201, the verification module 202, the feedback request identification module 203, the formal ledger modification module 204, the transaction termination module 205, and the reconfirmation module 206.
  • the program modules 201-205 are the same as those in the first embodiment, and will not be repeated here.
  • the reconfirmation module 206 is configured to reconfirm the transaction pointed to by the agreed transaction request according to a preset reconfirmation strategy when the transaction end request is an agreed transaction request, and if the reconfirmation is passed, skip again Go to the official ledger modification module.
  • this application also proposes a computer device.
  • FIG. 5 is a schematic diagram of a hardware architecture of a computer device according to an embodiment of the present application.
  • the computer device 2 is a device capable of automatically performing numerical calculation and / or information processing according to an instruction set or stored in advance.
  • it can be a smart phone, a tablet computer, a notebook computer, a desktop computer, a rack server, a blade server, a tower server, or a rack server (including an independent server or a server cluster composed of multiple servers).
  • the computer device 2 includes at least, but is not limited to, a memory 21, a processor 22, a network interface 23, and a negotiable blockchain transaction system 20 that can communicate with each other through a system bus. among them:
  • the memory 21 includes at least one type of computer-readable storage medium, and the readable storage medium includes a flash memory, a hard disk, a multimedia card, a card-type memory (for example, SD or DX memory, etc.), a random access memory (RAM), Static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disks, optical disks, etc.
  • the memory 21 may be an internal storage unit of the computer device 2, such as a hard disk or a memory of the computer device 2.
  • the memory 21 may also be an external storage device of the computer device 2, such as a plug-in hard disk, a smart memory card (SMC), and a secure digital device. (Secure Digital, SD) card, Flash card, etc.
  • the memory 21 may also include both an internal storage unit of the computer device 2 and an external storage device thereof.
  • the memory 21 is generally used to store an operating system and various application software installed on the computer device 2, such as program codes of the negotiable blockchain transaction system 20.
  • the memory 21 may also be used to temporarily store various types of data that have been output or are to be output.
  • the processor 22 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or another data processing chip.
  • the processor 22 is generally used to control the overall operation of the computer device 2, for example, to perform control and processing related to data interaction or communication with the computer device 2.
  • the processor 22 is configured to run program code or process data stored in the memory 21, for example, to run the negotiable blockchain transaction system 20 and the like.
  • the network interface 23 may include a wireless network interface or a wired network interface.
  • the network interface 23 is generally used to establish a communication connection between the computer device 2 and other computer devices.
  • the network interface 23 is configured to connect the computer device 2 and an external terminal through a network, and establish a data transmission channel and a communication connection between the computer device 2 and the external terminal.
  • the network may be an intranet, the Internet, a Global System for Mobile Communication (GSM), a Wideband Code Division Multiple Access (WCDMA), a 4G network, 5G Wireless, wired or other networks such as Internet, Bluetooth, Wi-Fi.
  • GSM Global System for Mobile Communication
  • WCDMA Wideband Code Division Multiple Access
  • FIG. 5 only shows the computer device 2 with components 21-23, but it should be understood that it is not required to implement all the illustrated components, and more or fewer components may be implemented instead.
  • the negotiable blockchain transaction system 20 stored in the memory 21 may be executed by one or more processors (processor 22 in this embodiment) to complete the negotiable area.
  • processors processor 22 in this embodiment
  • the present application provides a computer-readable storage medium.
  • the computer-readable storage medium is a non-volatile readable storage medium that stores therein computer program instructions that can be executed by at least one processor.

Abstract

A negotiable block chain transaction method, belonging to the field of block chain technology. The transaction in said method comprises: receiving a transaction request, in a transaction, initiated from a fund transfer-out party to a block chain (step 01); verifying the received request (step 02), and if the verification succeeds, writing all the content contained in said request into a temporary account block corresponding to the transaction request; receiving a feedback request initiated from an opposite party of the request initiating party to the block chain (step 03), and if the feedback request is a transaction modification request, repeating the previous step; if the feedback request is a transaction closing request, then identifying the type of the transaction closing request (step 04); if the transaction closing request is a transaction accepting request, writing a formal account balance into a formal account block (step 05); if the transaction closing request is a transaction rejecting request, adding, in the temporary account block, a transaction amount contained in the latest request onto a temporary account balance and the formal account balance of both transacting parties (step 06). The present solution solves the problem that negotiation cannot be performed online in the traditional block chain transaction mode.

Description

可协商的区块链交易方法、装置、设备及存储介质Negotiable blockchain transaction method, device, device and storage medium
本申请申明享有2018年8月24日递交的申请号为201810972002.5、名称为“可协商的区块链交易方法、装置、设备及存储介质”的中国专利申请的优先权,该中国专利申请的整体内容以参考的方式结合在本申请中。This application affirms the priority of the Chinese patent application filed on August 24, 2018 with the application number 201810972002.5 and the name "negotiable blockchain transaction method, device, device and storage medium", the entirety of the Chinese patent application The contents are incorporated herein by reference.
技术领域Technical field
本申请涉及区块链技术领域,涉及一种可协商的区块链交易方法、装置、设备及存储介质。The present application relates to the field of blockchain technology, and relates to a negotiable blockchain transaction method, device, device, and storage medium.
背景技术Background technique
区块链本质上是一个分布式数据库。整个数据存储的过程,以交易的形式由应用程序发起,在区块链上,由所有参与方签名背书后,接受这笔交易,并将交易的结果回写到块链中,交易一旦写入区块链即不可撤销。The blockchain is essentially a distributed database. The entire data storage process is initiated by the application in the form of a transaction. On the blockchain, after being signed and endorsed by all parties, the transaction is accepted and the result of the transaction is written back to the blockchain. Once the transaction is written Blockchain is irrevocable.
然而,实际的商业环境有着巨大的复杂性,如果一笔交易涉及到非法交易,一旦交易发生并生效,可能造成不可挽回的损失;亦或者由于交易的发起方出现操作失误,而产生了一笔本不该发生的交易,亦是很严重的损失。However, the actual business environment has huge complexity. If a transaction involves an illegal transaction, once the transaction occurs and takes effect, it may cause irreparable losses; or it may result in a transaction error caused by the originator of the transaction. Transactions that should not have occurred are also serious losses.
此外,在实际的商业业务场景中,常常涉及到交易双方需要多次协商的情况,当交易发起方发起一笔交易后,交易接收方认为这笔交易的金额不合理,此时接收方只能拒绝这笔交易,然后通过其他方式,比如线下的方式和交易发起方进行协商,然后由交易发起方重新发起一笔新的交易,这个过程是低效而不便利的。In addition, in actual commercial business scenarios, it often involves the two parties of the transaction needing to negotiate multiple times. When the transaction initiator initiates a transaction, the transaction receiver considers that the amount of the transaction is unreasonable. At this time, the receiver can only Rejecting this transaction, and then negotiating with the transaction initiator through other methods, such as offline, and then re-initiating a new transaction by the transaction initiator, this process is inefficient and inconvenient.
发明内容Summary of the Invention
本申请要解决的技术问题是为了克服现有技术中区块链上的交易无法更改、撤销的问题,提出了一种可协商的区块链交易方法、装置、设备及存储介质,通过提供一个交易缓冲区,用于缓冲所有未确认的交易消息。The technical problem to be solved in this application is to overcome the problem that the transactions on the blockchain cannot be changed or revoked in the prior art. A negotiable blockchain transaction method, device, device and storage medium are proposed. Transaction buffer, used to buffer all unconfirmed transaction messages.
本申请是通过下述技术方案来解决上述技术问题:This application solves the above technical problems through the following technical solutions:
一种可协商的区块链交易方法,在区块链上建立具有映射关系的临时账本区块和正式账本区块,所述交易包括以下步骤:A negotiable blockchain transaction method. A temporary ledger block and a formal ledger block with a mapping relationship are established on the blockchain. The transaction includes the following steps:
接收交易中资金转出方向区块链发起的交易请求;Receive a transaction request initiated by the transfer of funds in the transaction to the blockchain;
对接收到的请求中包含的当前临时账本余额的零知识证明、当前正式账本余额的零知 识证明以及签名进行验证,若验证均通过,则将所述请求中包含的所有内容写入到该交易请求对应的临时账本区块中;Verify the zero-knowledge certificate of the current temporary ledger balance, the zero-knowledge certificate of the current official ledger balance, and the signature included in the received request. If the verification is passed, write all the content contained in the request to the transaction Request the corresponding temporary ledger block;
接收发起请求的相对方向区块链发起的反馈请求,若所述反馈请求是交易修改请求,则重复上一步;若所述反馈请求是交易结束请求,则进一步识别所述交易结束请求的类型;Receiving a feedback request initiated by the blockchain in the opposite direction of the request, if the feedback request is a transaction modification request, repeating the previous step; if the feedback request is a transaction end request, further identifying the type of the transaction end request;
若所述交易结束请求为同意交易请求,则将所述同意交易请求中包含的正式账本余额和所述同意请求发送方的相对方最后一次发起的请求中包含的正式账本余额,写入与所述临时账本区块具有映射关系的正式账本区块中;If the transaction end request is a consent transaction request, write the formal ledger balance included in the consent transaction request and the formal ledger balance included in the last request initiated by the counterparty of the consent request sender to the The temporary ledger block has a mapping relationship in the formal ledger block;
若所述交易结束请求为拒绝交易请求,则在所述临时账本区块中,将交易双方的临时账本余额和正式账本余额分别加上最近一次请求中包含的交易金额。If the transaction end request is a transaction rejection request, in the temporary ledger block, the temporary ledger balance and formal ledger balance of both parties to the transaction are added to the transaction amount included in the latest request, respectively.
本申请还公开了一种电子装置,所述电子装置上存储有可协商的区块链交易系统,所述可协商的区块链交易系统包括:This application also discloses an electronic device. The electronic device stores a negotiable blockchain transaction system. The negotiable blockchain transaction system includes:
请求接收模块,用于接收交易中资金转出方向区块链发起的交易请求,以及接收发起请求的相对方向区块链发起的反馈请求;The request receiving module is used to receive a transaction request initiated by the blockchain in the transfer of funds out of the transaction, and a feedback request initiated by the blockchain opposite to the originating request;
验证模块,用于对接收到的请求中包含的当前临时账本余额的零知识证明、当前正式账本余额的零知识证明以及签名进行验证,并在验证均通过后,将所述请求中包含的所有内容写入到该交易请求对应的临时账本区块中;A verification module for verifying the zero-knowledge certificate of the current temporary ledger balance, the zero-knowledge certificate of the current formal ledger balance, and the signature included in the received request, and after all the verifications are passed, all The content is written into the temporary ledger block corresponding to the transaction request;
反馈请求识别模块,用于识别所述反馈请求的类型,当所述反馈请求是交易修改请求时跳转到所述验证模块,当所述反馈请求为交易结束请求时,进一步识别所述交易结束请求的类型;A feedback request identification module, configured to identify the type of the feedback request, and jump to the verification module when the feedback request is a transaction modification request, and further identify the end of the transaction when the feedback request is a transaction end request The type of request
正式账本修改模块,用于当所述交易结束请求为同意交易请求时,将所述同意交易请求中包含的正式账本余额和所述同意请求发送方的相对方最后一次发起的请求中包含的正式账本余额,写入与所述临时账本区块具有映射关系的正式账本区块中;A formal ledger modification module is configured to: when the transaction end request is a consent transaction request, the formal ledger balance included in the consent transaction request and the formal request included in the last request initiated by the counterparty of the consent request sender The ledger balance is written into a formal ledger block having a mapping relationship with the temporary ledger block;
交易终止模块,用于当所述交易结束请求为拒绝交易请求时,在所述临时账本区块中,将交易双方的临时账本余额和正式账本余额分别加上最近一次请求中包含的交易金额。The transaction termination module is configured to: when the transaction end request is a transaction refusal request, in the temporary ledger block, add the temporary ledger balance and formal ledger balance of both parties to the transaction to the transaction amount included in the latest request, respectively.
本申请还公开了一种计算机设备,包括存储器和处理器,所述存储器上存储有可被所述处理器执行的可协商的区块链交易系统,所述系统被所述处理器执行时实现以下步骤:This application also discloses a computer device including a memory and a processor. The memory stores a negotiable blockchain transaction system that can be executed by the processor, and the system is implemented when the system is executed by the processor. The following steps:
接收交易中资金转出方向区块链发起的交易请求;Receive a transaction request initiated by the transfer of funds in the transaction to the blockchain;
对接收到的请求中包含的当前临时账本余额的零知识证明、当前正式账本余额的零知识证明以及签名进行验证,若验证均通过,则将所述请求中包含的所有内容写入到该交易 请求对应的临时账本区块中;Verify the zero-knowledge certificate of the current temporary ledger balance, the zero-knowledge certificate of the current official ledger balance, and the signature included in the received request. If the verification is passed, write all the content contained in the request to the transaction Request the corresponding temporary ledger block;
接收发起请求的相对方向区块链发起的反馈请求,若所述反馈请求是交易修改请求,则重复上一步;若所述反馈请求是交易结束请求,则进一步识别所述交易结束请求的类型;Receiving a feedback request initiated by the blockchain in the opposite direction of the request, if the feedback request is a transaction modification request, repeating the previous step; if the feedback request is a transaction end request, further identifying the type of the transaction end request;
若所述交易结束请求为同意交易请求,则将所述同意交易请求中包含的正式账本余额和所述同意请求发送方的相对方最后一次发起的请求中包含的正式账本余额,写入与所述临时账本区块具有映射关系的正式账本区块中;If the transaction end request is a consent transaction request, write the formal ledger balance included in the consent transaction request and the formal ledger balance included in the last request initiated by the counterparty of the consent request sender to the The temporary ledger block has a mapping relationship in the formal ledger block;
若所述交易结束请求为拒绝交易请求,则在所述临时账本区块中,将交易双方的临时账本余额和正式账本余额分别加上最近一次请求中包含的交易金额。If the transaction end request is a transaction rejection request, in the temporary ledger block, the temporary ledger balance and formal ledger balance of both parties to the transaction are added to the transaction amount included in the latest request, respectively.
本申请还公开了一种计算机可读存储介质,所述计算机可读存储介质内存储有计算机程序指令,所述计算机程序指令可被至少一个处理器所执行,以使所述至少一个处理器执行以下步骤:The present application also discloses a computer-readable storage medium. The computer-readable storage medium stores computer program instructions, and the computer program instructions can be executed by at least one processor to enable the at least one processor to execute. The following steps:
接收交易中资金转出方向区块链发起的交易请求;Receive a transaction request initiated by the transfer of funds in the transaction to the blockchain;
对接收到的请求中包含的当前临时账本余额的零知识证明、当前正式账本余额的零知识证明以及签名进行验证,若验证均通过,则将所述请求中包含的所有内容写入到该交易请求对应的临时账本区块中;Verify the zero-knowledge certificate of the current temporary ledger balance, the zero-knowledge certificate of the current official ledger balance, and the signature included in the received request. If the verification is passed, write all the content contained in the request to the transaction Request the corresponding temporary ledger block;
接收发起请求的相对方向区块链发起的反馈请求,若所述反馈请求是交易修改请求,则重复上一步;若所述反馈请求是交易结束请求,则进一步识别所述交易结束请求的类型;Receiving a feedback request initiated by the blockchain in the opposite direction of the request, if the feedback request is a transaction modification request, repeating the previous step; if the feedback request is a transaction end request, further identifying the type of the transaction end request;
若所述交易结束请求为同意交易请求,则将所述同意交易请求中包含的正式账本余额和所述同意请求发送方的相对方最后一次发起的请求中包含的正式账本余额,写入与所述临时账本区块具有映射关系的正式账本区块中;If the transaction end request is a consent transaction request, write the formal ledger balance included in the consent transaction request and the formal ledger balance included in the last request initiated by the counterparty of the consent request sender to the The temporary ledger block has a mapping relationship in the formal ledger block;
若所述交易结束请求为拒绝交易请求,则在所述临时账本区块中,将交易双方的临时账本余额和正式账本余额分别加上最近一次请求中包含的交易金额。If the transaction end request is a transaction rejection request, in the temporary ledger block, the temporary ledger balance and formal ledger balance of both parties to the transaction are added to the transaction amount included in the latest request, respectively.
本申请的积极进步效果在于:The positive progress effect of this application lies in:
1、本申请打破了传统区块链交易模式中无法线上协商的僵局;1. This application breaks the deadlock that cannot be negotiated online in the traditional blockchain transaction model;
2、本申请将账本分成了临时账本和正式账本,使得协商的过程不会影响到正式账本。2. This application divides the ledger into a temporary ledger and a formal ledger, so that the negotiation process will not affect the formal ledger.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1示出了本申请可协商的区块链交易方法实施例一的流程图;FIG. 1 shows a flowchart of Embodiment 1 of a negotiable blockchain transaction method;
图2示出了本申请可协商的区块链交易方法实施例二的流程图;FIG. 2 shows a flowchart of a second embodiment of a negotiable blockchain transaction method;
图3示出了本申请电子装置中可协商的区块链交易系统第一实施例的程序模块示意图;3 shows a schematic diagram of a program module of a first embodiment of a negotiable blockchain transaction system in an electronic device of the present application;
图4示出了本申请电子装置中可协商的区块链交易系统第二实施例的程序模块示意图;4 shows a schematic diagram of a program module of a second embodiment of a negotiable blockchain transaction system in an electronic device of the present application;
图5示出了本申请计算机设备一实施例的硬件架构示意图。FIG. 5 shows a schematic diagram of a hardware architecture of an embodiment of a computer device of the present application.
具体实施方式detailed description
下面通过实施例的方式进一步说明本申请,但并不因此将本申请限制在所述的实施例范围之中。The following further describes the application by way of examples, but the application is not limited to the scope of the examples.
首先,本申请提出一种可协商的区块链交易方法。First, this application proposes a negotiable blockchain transaction method.
该方法需要在区块链上建立具有映射关系的临时账本区块和正式账本区块,即在区块链上建立两套账本,两套账本之间具有映射关系(所述两套账本之间的映射关系可以看做是一个账本的两个状态,它们之间有相同的AccountId(账本ID),即通过AccountId确定映射关系),在确认之前的所有交易记录仅记录在临时账本区块中,只有最终确认的那笔交易会被同时记录到临时账本区块和正式账本区块中。This method requires the establishment of a temporary ledger block and a formal ledger block with a mapping relationship on the blockchain. That is, two sets of ledgers are established on the blockchain with a mapping relationship between the two sets of ledgers (between the two sets of ledgers). The mapping relationship can be regarded as two states of a ledger, and they have the same AccountId (account ID), that is, the mapping relationship is determined by AccountId). All transaction records before confirmation are only recorded in the temporary ledger block. Only the transaction that is finally confirmed will be recorded in both the temporary ledger block and the formal ledger block.
在实施例一中,如图1所示,所述的可协商的区块链交易包括如下步骤:In the first embodiment, as shown in FIG. 1, the negotiable blockchain transaction includes the following steps:
步骤01:接收交易中资金转出方向区块链发起的交易请求。Step 01: Receive a transaction request initiated by the transfer of funds in the transaction to the blockchain.
所述资金转出方是相对于账本的角度来看的,指账户上资金减少的一方。The fund transfer party is from the perspective of the ledger, and refers to the party whose funds are reduced.
所述交易请求的内容包括账本ID、当前交易ID、交易请求方ID、交易相对方ID、交易金额、交易请求方的当前临时账本余额、交易请求方的当前正式账本余额、所述当前正式账本余额的零知识证明、所述当前临时账本余额的零知识证明以及交易请求方的签名。The content of the transaction request includes a ledger ID, a current transaction ID, a transaction requester ID, a transaction counterparty ID, a transaction amount, a current temporary ledger balance of the transaction requester, a current formal ledger balance of the transaction requester, and the current formal ledger Zero-knowledge proof of the balance, zero-knowledge proof of the current temporary ledger balance, and the signature of the requester of the transaction.
所述账本ID用于区分账本的创建者,比如微信的账本由腾讯创建的区块链来记录,支付宝的账本由阿里巴巴创建的区块链来记录,由于谁都可以创造区块链账本,为了区分账本,对每个账本都会分配一个用于唯一识别的ID,即账本ID。The ledger ID is used to distinguish the creator of the ledger. For example, WeChat's ledger is recorded by the blockchain created by Tencent. Alipay's ledger is recorded by the blockchain created by Alibaba. Since anyone can create a blockchain ledger, In order to distinguish ledgers, each ledger is assigned an ID for unique identification, which is the ledger ID.
所述当前交易ID、交易请求方ID、交易相对方ID分别是用于唯一区分交易、交易请求方和交易相对方的ID。The current transaction ID, transaction requester ID, and transaction counterparty ID are IDs used to uniquely distinguish the transaction, the transaction requester, and the transaction counterparty, respectively.
所述交易请求方的当前正式账本余额是指,记录在正式账本区块中的交易请求方的真实余额;所述交易请求方的当前临时账本余额是指,交易请求方(具体本步骤中为发起交易请求的资金转出方)的正式账户余额(真实余额)减去其所有处于待确认状态的交易(因为允许交易请求方可以同时发起多笔交易请求,而这些交易请求在请求相对方未确认之前,都处于待确认状态)金额的总和后的差值。The current formal ledger balance of the transaction requester refers to the real balance of the transaction requester recorded in the formal ledger block; the current temporary ledger balance of the transaction requester refers to the transaction requester (specifically in this step: The official account balance (real balance) of the fund transfer party that initiated the transaction request minus all its pending transactions (because the transaction requester is allowed to initiate multiple transaction requests at the same time, and these transaction requests are (Before confirmation, all are in the state of confirmation) The difference after the sum of the amounts.
举例来说,假设交易请求方发起了两笔待确认的交易,具体为向其交易方交付总额为100元的两笔交易,由于这两笔交易都还未得到交易相对方的确认,因此交易请求方的账 本上还拥有这100元,即其真实余额中还未扣除这100元,但是在其临时账本余额中已经扣除了这100元,因此交易请求方此时的真实余额和临时账本余额是不一致的。For example, suppose the transaction requester initiated two pending transactions, specifically to deliver two transactions totaling 100 yuan to its counterparty. Since neither transaction has been confirmed by the counterparty of the transaction, the transaction The claimant's account book also has the 100 yuan, that is, the 100 yuan has not been deducted from its real balance, but the 100 yuan has been deducted from its temporary account book balance. Are inconsistent.
所述零知识证明,指的是示证者在证明自己身份时不泄露任何信息,验证者得不到示证者的任何私有信息,但又能有效证明对方身份的一种方法。以区块链中的ZCASH(一种电子货币的名称)数字货币为例,该数字货币使用零知识证明,在整个交易过程中,完全匿名。ZCASH交易过程中,A转账给B,新建一个UTXO(Unspent Transaction Output,未花费的交易输出),原先的会发送到一个作废列表,但是这个列表记录的是之前的序号或者代号,证明之前的UTXO失效。在这个过程中B是看不到A之前的信息,但是确实交易还是发生了。使用零知识证明是为了确保资金转出方没有“双花”状况。The zero-knowledge proof refers to a method in which the demonstrator does not disclose any information when proving his identity, and the verifier cannot obtain any private information of the demonstrator, but can effectively prove the identity of the other party. Take ZCASH (the name of an electronic currency) digital currency in the blockchain as an example. The digital currency uses zero-knowledge proof and is completely anonymous during the entire transaction process. During the ZCASH transaction, A transfers to B and creates a UTXO (Unspent Transaction Output). The original will be sent to a void list, but this list records the previous serial number or code, which proves the previous UTXO Failure. In this process, B cannot see the information before A, but the transaction does occur. Zero-knowledge proofs are used to ensure that there is no “double spending” on the transfer side.
在区块链中,采用的签命使用的是非对称加密技术和数字摘要技术,保证了数据在传输过程中的完整性、发送者身份真实不可假冒。非对称加密技术会产生一个公钥(publickey)和一个私钥(privatekey),公钥和私钥是一对,私钥保存在所有者手中,需要对外人保密不可让外人知道,公钥可以向其他信息接收方公开。如果用私钥对数据加密只有对应的公钥才能解密,相反公钥加密过的数据,只有对应的私钥才能解密。数字摘要是利用哈希函数把任意长度的信息变成固定长度的信息,哈希函数是单向生成体制,通过生成的哈希值不可逆向生成输入值。In the blockchain, the signing used uses asymmetric encryption technology and digital digest technology to ensure the integrity of the data during transmission and the authenticity of the sender's identity cannot be counterfeited. Asymmetric encryption technology will generate a public key and a private key. The public key and the private key are a pair. The private key is kept in the owner's hands. It needs to be kept secret from outsiders. Other information recipients are public. If the private key is used to encrypt the data, only the corresponding public key can be decrypted. Conversely, the data encrypted by the public key can only be decrypted by the corresponding private key. A digital digest uses a hash function to transform information of any length into fixed-length information. The hash function is a one-way generation system, and the input value is generated irreversibly by the generated hash value.
这里所述交易金额和交易请求方的当前临时账本余额、交易请求方的当前正式账本余额都是经过加密的。The transaction amount described here and the current temporary ledger balance of the transaction requester and the current formal ledger balance of the transaction requester are encrypted.
步骤02:对接收到的请求中包含的当前临时账本余额的零知识证明、当前正式账本余额的零知识证明以及签名进行验证,若验证均通过,则将所述请求中包含的所有内容写入到该交易请求对应的临时账本区块中。Step 02: Verify the zero-knowledge certificate of the current temporary ledger balance, the zero-knowledge certificate of the current formal ledger balance, and the signature included in the received request. If the verification is passed, write all the content contained in the request To the temporary ledger block corresponding to the transaction request.
所述验证通过是指当前临时账本余额和当前正式账本余额均大于零,以及交易请求确实为交易中交易请求方发起的(即签名验证)。The verification means that the current temporary ledger balance and the current official ledger balance are both greater than zero, and that the transaction request is indeed initiated by the transaction requester in the transaction (ie, signature verification).
发送请求的请求方的相对方使用公钥对所述请求中包含的当前临时账本余额、当前正式账本余额和交易金额,只有使用了公钥对应的私钥加密的内容,才能被公钥进行解密,以此实现对发送请求的请求方(即交易请求方)的身份验证。一旦解密失败,即签名验证失败。The counterparty of the requesting party that sent the request uses the public key to decrypt the current temporary ledger balance, current formal ledger balance, and transaction amount contained in the request. Only the content encrypted with the private key corresponding to the public key can be decrypted by the public key. In this way, the identity verification of the requesting party (that is, the transaction requesting party) that sends the request is implemented. Once the decryption fails, the signature verification fails.
在解密成功之后,再进一步对当前临时账本余额的零知识证明、当前正式账本余额的零知识证明进行验证,以判断两个账本的余额是否都大于零。After the decryption is successful, the zero-knowledge proof of the current temporary ledger balance and the zero-knowledge proof of the current formal ledger balance are further verified to determine whether the balances of both ledgers are greater than zero.
步骤03:接收发起请求的相对方向区块链发起的反馈请求,判断所述反馈请求的类型,若是所述反馈请求为交易修改请求,则执行步骤02;若所述反馈请求是交易结束请求,则执行步骤04。所述交易修改请求的内容包括当前交易ID、交易请求方ID、交易相对方ID、 新的交易金额、反馈请求方的当前临时账本余额,反馈请求方的正式账本余额、所述当前临时账本余额的零知识证明、所述当前正式账本余额的零知识证明以及反馈请求方的签名。Step 03: Receive a feedback request initiated by the blockchain in the opposite direction of the request, and determine the type of the feedback request. If the feedback request is a transaction modification request, step 02 is performed; if the feedback request is a transaction end request, Then go to step 04. The content of the transaction modification request includes the current transaction ID, the transaction requester ID, the transaction counterparty ID, the new transaction amount, the current temporary ledger balance of the feedback requesting party, the formal ledger balance of the feedback requesting party, and the current temporary ledger balance Zero-knowledge proof of, the zero-knowledge proof of the current formal ledger balance, and the signature of the requester of feedback.
所述交易结束请求包括同意交易请求和拒绝交易请求。The transaction end request includes a transaction approval request and a transaction rejection request.
当交易相对方接收到交易方发送的交易请求之后要对该请求进行反馈,如果对金额需要修改,则直接发送交易修改请求,若同意该交易或者拒绝该交易,则发送交易结束请求。这里的交易修改请求相当于一个新的交易,需要该请求的相对方对该交易修改请求进行反馈。When the counterparty of the transaction receives the transaction request sent by the counterparty, it needs to respond to the request. If the amount needs to be modified, it directly sends a transaction modification request. If it agrees with the transaction or rejects the transaction, it sends a transaction end request. The transaction modification request here is equivalent to a new transaction, and the counterparty of the request is required to provide feedback on the transaction modification request.
交易的修改可以来回几个回合,不限次数,只有到收到交易结束请求时,一笔交易才算正式达成。A transaction can be modified for several rounds, unlimited times, and a transaction can only be formally concluded when a transaction end request is received.
无论反馈请求是交易中的资金转出方还资金转入方,都需要在请求中包含正式账本余额,以便交易一旦达成,即将正式账本余额写入正式账本区块中。Regardless of whether the feedback request is the transfer of funds or the transfer of funds in the transaction, the formal ledger balance needs to be included in the request, so that once the transaction is completed, the formal ledger balance will be written into the formal ledger block.
这里的相对方是相对请求的发起方而言的,对于交易请求而言,因为交易请求是资金转出方发起的,那么这个相对方就是指资金转入方;对于交易修改请求而言,由于交易的修改可以多个来回,因而这个相对方要看交易修改请求的发起方是谁,如果交易修改请求的发起方是资金转入方,那么相对方就是指资金转出方,如果交易修改请求的发起方是资金转出方,那么相对方就是指资金转入方。The counterparty here is relative to the originator of the request. For the transaction request, because the transaction request is initiated by the transferee, then the counterparty is the transferee; for the transaction modification request, The modification of the transaction can be made back and forth multiple times, so this counterparty depends on who initiated the transaction modification request. If the originator of the transaction modification request is the fund transfer-in party, then the counterparty is the fund transfer-out party. The initiator is the transferer of funds, and the counterparty is the transferer of funds.
步骤04:判断所述交易结束请求是同意交易请求还是拒绝交易请求,若为同意交易请求则执行步骤05,若为拒绝交易请求则执行步骤06。Step 04: Determine whether the transaction end request agrees with the transaction request or rejects the transaction request. If the transaction request is agreed, step 05 is performed, and if the transaction request is rejected, step 06 is performed.
所述同意交易请求的内容包括当前交易ID、发起请求方ID、请求相对方ID、同意指令、同意请求方在同意后的临时账本余额、同意请求方的正式账本余额和该正式账本余额的零知识证明;所述拒绝交易请求的内容包括当前交易ID、发起请求方ID、请求相对方ID、拒绝指令和拒绝请求方在拒绝后的临时账本余额。The content of the consent transaction request includes the current transaction ID, the originating requester ID, the requesting counterparty ID, the consent instruction, the consent requester's temporary ledger balance after consent, the consent requestor's formal ledger balance, and the zero of the formal ledger balance. Proof of knowledge; the content of the rejected transaction request includes the current transaction ID, the requesting party ID, the requesting counterparty ID, the rejection instruction, and the temporary account balance of the rejecting requester after rejection.
因此,通过识别所述交易结束请求中包含了同意指令还是拒绝指令来识别该请求的具体类型。Therefore, the specific type of the request is identified by identifying whether the transaction end request includes an consent instruction or a rejection instruction.
步骤05:将所述同意交易请求中包含的正式账本余额和所述同意请求发送方的相对方最后一次发起的请求中包含的正式账本余额,写入与所述临时账本区块具有映射关系的正式账本区块中。Step 05: Write the formal ledger balance included in the consent transaction request and the formal ledger balance included in the last request initiated by the counterparty of the consent request sender to the temporary ledger block that has a mapping relationship with the temporary ledger block. In the official ledger block.
正式账本区块的记账动作由同意交易请求触发,只要交易中的一方发送了同意交易请求,就表示其同意了对方最后一次发送的请求中的交易金额。The bookkeeping action in the formal ledger block is triggered by a request to agree to a transaction. As long as one party in the transaction sends a request to agree to the transaction, it means that it has agreed to the transaction amount in the request sent by the other party.
在临时账本中,每次交易的一方发送一个请求,就会对临时账本中的临时账本余额、正式账本余额都做修改,因此在触发正式账本区块的记账动作后,只需直接将交易双方最后发起的请求中包含的各自的正式账本余额写入到正式账本区块即可。In the temporary ledger, each time a party sends a request, the temporary ledger balance and the official ledger balance in the temporary ledger will be modified. Therefore, after triggering the bookkeeping action in the formal ledger block, you only need to directly transfer the transaction The respective formal ledger balances included in the request initiated by the two parties can be written into the formal ledger block.
步骤06:在所述临时账本区块中,将交易双方的临时账本余额和正式账本余额分别加上最近一次请求中包含的交易金额。Step 06: In the temporary ledger block, the temporary ledger balance and official ledger balance of both parties to the transaction are added to the transaction amount included in the latest request, respectively.
若是拒绝交易请求,则表示双方就该笔交易最终没有达成一致,该交易取消,即需要将账本余额恢复至该笔交易没开始前的状态,这里的账本余额涉及到临时账本余额和正式账本余额两个,这里所述正式账本余额是指临时账本区块上记录的正式账本余额,而实际正式账本区块上的正式账本余额没有任何改动。If the transaction request is rejected, it means that the two parties did not reach an agreement on the transaction, and the transaction is cancelled, that is, the account balance needs to be restored to the state before the transaction. The account balance here involves the temporary account balance and the official account balance. Two, the formal ledger balance mentioned here refers to the formal ledger balance recorded on the temporary ledger block, but the formal ledger balance on the actual formal ledger block has not changed in any way.
在实施例二中,基于实施例一的基础上,如图2所示,所述的可协商的区块链交易方法包括还如下步骤:In the second embodiment, based on the first embodiment, as shown in FIG. 2, the negotiable blockchain transaction method includes the following steps:
步骤01-步骤04同实施例一,此处不再赘述。Steps 01 to 04 are the same as those in the first embodiment, and details are not described herein again.
步骤051:根据预设的再确认策略对所述同意交易请求指向的交易进行再确认,若再确认为通过则执行步骤05,否则执行步骤06。Step 051: Reconfirm the transaction pointed to by the agreed transaction request according to a preset reconfirmation strategy. If the reconfirmation is passed, go to step 05, otherwise go to step 06.
所述再确认策略可以是第三方确认、所述交易请求的相对方确认和延时自动确认中任意一种。The reconfirmation strategy may be any one of a third party confirmation, a counterparty confirmation of the transaction request, and a delayed automatic confirmation.
在一实施例中,所述再确认策略采用第三方确认,其中的第三方举例来说可以是监管机构,此时,步骤01中的所述交易请求中还包含有第三方ID和包含有本次交易请求中所有内容的额外信息,所述额外信息仅第三方有权查看。额外信息可通过ECDH方式加密,仅第三方具有相应的解密秘钥。In one embodiment, the re-confirmation strategy adopts third-party confirmation, and the third party may be a regulatory agency, for example. At this time, the transaction request in step 01 also includes a third-party ID and contains Additional information for all content in this transaction request, said additional information is only accessible to third parties. The additional information can be encrypted by ECDH, and only the third party has the corresponding decryption key.
所述第三方确认的步骤具体如下:The steps of the third party confirmation are as follows:
步骤0511:接收第三方发送的核定交易请求。Step 0511: Receive an approved transaction request sent by a third party.
所述核定交易请求的内容包括当前交易ID、交易请求方ID、交易相对方ID、第三方的签名以及同意指令或拒绝指令。The content of the approved transaction request includes a current transaction ID, a transaction requester ID, a transaction counterparty ID, a signature of a third party, and a consent instruction or a rejection instruction.
步骤0512:判断所述核定交易中包含有同意指令还是拒绝指令,若包含有同意指令则执行步骤05,若包含有拒绝指令则执行步骤06。Step 0512: Determine whether the approved transaction includes a consent instruction or a rejection instruction. If a consent instruction is included, step 05 is performed, and if a rejection instruction is included, step 06 is performed.
在另一实施例中,所述再确认策略采用所述交易请求的相对方确认,其确认步骤同上一实施例,仅确认方不同。In another embodiment, the reconfirmation strategy uses the counterparty confirmation of the transaction request, and the confirmation steps are the same as in the previous embodiment, and only the confirming party is different.
在又一实施例中,所述第三方确认采用延时自动确认。In yet another embodiment, the third party confirmation adopts a delayed automatic confirmation.
所述延时自动确认的步骤包括:The step of delaying automatic confirmation includes:
判断在预设的时间内是否接收到交易双方中任意一方发送的撤销交易请求;若没有接收到撤销交易请求,则执行步骤05,若接收到撤销交易请求,则执行步骤06。It is determined whether a request for canceling a transaction sent by any of the two parties to the transaction is received within a preset time; if a request for canceling a transaction is not received, step 05 is performed; if a request for canceling a transaction is received, step 06 is performed.
步骤05-步骤06同实施例一,此处不再赘述。Steps 05 to 06 are the same as those in the first embodiment, and details are not described herein again.
其次,本申请提出了一种电子装置,所述电子装置上存储有可协商的区块链交易系统20,所述系统20可以被分割为一个或者多个程序模块。Secondly, this application proposes an electronic device. The electronic device stores a negotiable blockchain transaction system 20, and the system 20 can be divided into one or more program modules.
例如,图3示出了所述可协商的区块链交易系统20第一实施例的程序模块示意图,该实施例中,所述系统20可以被分割为请求接收模块201、验证模块202、反馈请求识别模块203、正式账本修改模块204和交易终止模块205。其中,本申请所称的程序模块是指能够完成特定功能的一系列计算机程序指令段。以下描述将具体介绍所述程序模块201-205的具体功能。For example, FIG. 3 shows a schematic diagram of a program module of the first embodiment of the negotiable blockchain transaction system 20. In this embodiment, the system 20 can be divided into a request receiving module 201, a verification module 202, and a feedback The request identification module 203, the formal ledger modification module 204, and the transaction termination module 205. Among them, the program module referred to in the present application refers to a series of computer program instruction segments capable of performing specific functions. The following description will specifically introduce the specific functions of the program modules 201-205.
所述请求接收模块201用于接收交易中资金转出方向区块链发起的交易请求,以及接收发起请求的相对方向区块链发起的反馈请求。The request receiving module 201 is configured to receive a transaction request initiated by a block of funds in a transaction and a feedback request initiated by a block chain opposite to the originating request.
所述验证模块202用于对接收到的请求中包含的当前临时账本余额的零知识证明、当前正式账本余额的零知识证明以及签名进行验证,并在验证均通过后,将所述请求中包含的所有内容写入到该交易请求对应的临时账本区块中。The verification module 202 is configured to verify the zero-knowledge certificate of the current temporary ledger balance, the zero-knowledge certificate of the current formal ledger balance, and the signature included in the received request, and after the verification is passed, the request includes All the contents of are written into the temporary ledger block corresponding to the transaction request.
所述反馈请求识别模块203用于识别所述反馈请求的类型,当所述反馈请求是交易修改请求时跳转到所述验证模块,当所述反馈请求为交易结束请求时,进一步识别所述交易结束请求的类型。The feedback request identification module 203 is configured to identify the type of the feedback request, and jump to the verification module when the feedback request is a transaction modification request, and further identify the feedback request when the feedback request is a transaction end request. The type of transaction end request.
所述正式账本修改模块204用于当所述交易结束请求为同意交易请求时,将所述同意交易请求中包含的正式账本余额和所述同意请求发送方的相对方最后一次发起的请求中包含的正式账本余额,写入与所述临时账本区块具有映射关系的正式账本区块中。The formal ledger modification module 204 is configured to include the formal ledger balance included in the consent transaction request and the last request initiated by the counterparty of the consent request sender when the transaction end request is a consent transaction request. The formal ledger balance is written into a formal ledger block having a mapping relationship with the temporary ledger block.
所述交易终止模块205用于当所述交易结束请求为拒绝交易请求时,在所述临时账本区块中,将交易双方的临时账本余额和正式账本余额分别加上最近一次请求中包含的交易金额。The transaction termination module 205 is configured to add, in the temporary ledger block, the temporary ledger balance and formal ledger balance of both parties to the transaction in the temporary ledger block, together with the transactions included in the latest request. Amount.
又例如,图4示出了所述可协商的区块链交易系统20第二实施例的程序模块示意图,该实施例中,所述可协商的区块链交易系统20还可以被分割为请求接收模块201、验证模块202、反馈请求识别模块203、正式账本修改模块204、交易终止模块205和再确认模块206。As another example, FIG. 4 shows a schematic diagram of a program module of the second embodiment of the negotiable blockchain transaction system 20. In this embodiment, the negotiable blockchain transaction system 20 can also be divided into requests The receiving module 201, the verification module 202, the feedback request identification module 203, the formal ledger modification module 204, the transaction termination module 205, and the reconfirmation module 206.
其中,程序模块201-205同第一实施例,此处不再赘述。The program modules 201-205 are the same as those in the first embodiment, and will not be repeated here.
所述再确认模块206用于在所述交易结束请求为同意交易请求时,先根据预设的再确认策略对所述同意交易请求指向的交易进行再确认,若再确认为通过,则再跳转到正式账本修改模块。The reconfirmation module 206 is configured to reconfirm the transaction pointed to by the agreed transaction request according to a preset reconfirmation strategy when the transaction end request is an agreed transaction request, and if the reconfirmation is passed, skip again Go to the official ledger modification module.
再次,本申请还提出来一种计算机设备。Again, this application also proposes a computer device.
参阅图5所示,是本申请计算机设备一实施例的硬件架构示意图。本实施例中,所述计算机设备2是一种能够按照事先设定或者存储的指令,自动进行数值计算和/或信息处理的设备。例如,可以是智能手机、平板电脑、笔记本电脑、台式计算机、机架式服务器、刀片式服务器、塔式服务器或机柜式服务器(包括独立的服务器,或者多个服务器所组成的服务器集群)等。如图所示,所述计算机设备2至少包括,但不限于,可通过系统总线相互通信连接存储器21、处理器22、网络接口23、以及可协商的区块链交易系统20。其中:FIG. 5 is a schematic diagram of a hardware architecture of a computer device according to an embodiment of the present application. In this embodiment, the computer device 2 is a device capable of automatically performing numerical calculation and / or information processing according to an instruction set or stored in advance. For example, it can be a smart phone, a tablet computer, a notebook computer, a desktop computer, a rack server, a blade server, a tower server, or a rack server (including an independent server or a server cluster composed of multiple servers). As shown in the figure, the computer device 2 includes at least, but is not limited to, a memory 21, a processor 22, a network interface 23, and a negotiable blockchain transaction system 20 that can communicate with each other through a system bus. among them:
所述存储器21至少包括一种类型的计算机可读存储介质,所述可读存储介质包括闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、随机访问存储器(RAM)、静态随机访问存储器(SRAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、可编程只读存储器(PROM)、磁性存储器、磁盘、光盘等。在一些实施例中,所述存储器21可以是所述计算机设备2的内部存储单元,例如该计算机设备2的硬盘或内存。在另一些实施例中,所述存储器21也可以是所述计算机设备2的外部存储设备,例如该计算机设备2上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。当然,所述存储器21还可以既包括所述计算机设备2的内部存储单元也包括其外部存储设备。本实施例中,所述存储器21通常用于存储安装于所述计算机设备2的操作系统和各类应用软件,例如所述可协商的区块链交易系统20的程序代码等。此外,所述存储器21还可以用于暂时地存储已经输出或者将要输出的各类数据。The memory 21 includes at least one type of computer-readable storage medium, and the readable storage medium includes a flash memory, a hard disk, a multimedia card, a card-type memory (for example, SD or DX memory, etc.), a random access memory (RAM), Static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disks, optical disks, etc. In some embodiments, the memory 21 may be an internal storage unit of the computer device 2, such as a hard disk or a memory of the computer device 2. In other embodiments, the memory 21 may also be an external storage device of the computer device 2, such as a plug-in hard disk, a smart memory card (SMC), and a secure digital device. (Secure Digital, SD) card, Flash card, etc. Of course, the memory 21 may also include both an internal storage unit of the computer device 2 and an external storage device thereof. In this embodiment, the memory 21 is generally used to store an operating system and various application software installed on the computer device 2, such as program codes of the negotiable blockchain transaction system 20. In addition, the memory 21 may also be used to temporarily store various types of data that have been output or are to be output.
所述处理器22在一些实施例中可以是中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器、或其他数据处理芯片。该处理器22通常用于控制所述计算机设备2的总体操作,例如执行与所述计算机设备2进行数据交互或者通信相关的控制和处理等。本实施例中,所述处理器22用于运行所述存储器21中存储的程序代码或者处理数据,例如运行所述的可协商的区块链交易系统20等。In some embodiments, the processor 22 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or another data processing chip. The processor 22 is generally used to control the overall operation of the computer device 2, for example, to perform control and processing related to data interaction or communication with the computer device 2. In this embodiment, the processor 22 is configured to run program code or process data stored in the memory 21, for example, to run the negotiable blockchain transaction system 20 and the like.
所述网络接口23可包括无线网络接口或有线网络接口,该网络接口23通常用于在所述计算机设备2与其他计算机设备之间建立通信连接。例如,所述网络接口23用于通过网络将所述计算机设备2与外部终端相连,在所述计算机设备2与外部终端之间的建立数据传输通道和通信连接等。所述网络可以是企业内部网(Intranet)、互联网(Internet)、全球移动通讯系统(Global System of Mobile communication,GSM)、宽带码分多址(Wideband Code Division Multiple Access,WCDMA)、4G网络、5G网络、蓝牙(Bluetooth)、Wi-Fi等无线或有线网络。The network interface 23 may include a wireless network interface or a wired network interface. The network interface 23 is generally used to establish a communication connection between the computer device 2 and other computer devices. For example, the network interface 23 is configured to connect the computer device 2 and an external terminal through a network, and establish a data transmission channel and a communication connection between the computer device 2 and the external terminal. The network may be an intranet, the Internet, a Global System for Mobile Communication (GSM), a Wideband Code Division Multiple Access (WCDMA), a 4G network, 5G Wireless, wired or other networks such as Internet, Bluetooth, Wi-Fi.
需要指出的是,图5仅示出了具有组件21-23的计算机设备2,但是应理解的是,并不 要求实施所有示出的组件,可以替代的实施更多或者更少的组件。It should be noted that FIG. 5 only shows the computer device 2 with components 21-23, but it should be understood that it is not required to implement all the illustrated components, and more or fewer components may be implemented instead.
在本实施例中,存储于存储器21中的所述可协商的区块链交易系统20可以被一个或多个处理器(本实施例为处理器22)所执行,以完成上述可协商的区块链交易方法的操作。In this embodiment, the negotiable blockchain transaction system 20 stored in the memory 21 may be executed by one or more processors (processor 22 in this embodiment) to complete the negotiable area. The operation of the blockchain transaction method.
此外,本申请一种计算机可读存储介质,所述计算机可读存储介质为非易失性可读存储介质,其内存储有计算机程序指令,所述计算机程序指令可被至少一个处理器所执行,以实现上述可协商的区块链交易方法或电子装置的操作。In addition, the present application provides a computer-readable storage medium. The computer-readable storage medium is a non-volatile readable storage medium that stores therein computer program instructions that can be executed by at least one processor. To achieve the above-mentioned negotiable blockchain transaction method or operation of an electronic device.
虽然以上描述了本申请的具体实施方式,但是本领域的技术人员应当理解,这仅是举例说明,本申请的保护范围是由所附权利要求书限定的。本领域的技术人员在不背离本申请的原理和实质的前提下,可以对这些实施方式做出多种变更或修改,但这些变更和修改均落入本申请的保护范围。Although the specific implementation of the present application is described above, those skilled in the art should understand that this is only an example, and the protection scope of the present application is defined by the appended claims. Those skilled in the art can make various changes or modifications to these embodiments without departing from the principle and essence of this application, but these changes and modifications fall within the protection scope of this application.

Claims (20)

  1. 一种可协商的区块链交易方法,在区块链上建立具有映射关系的临时账本区块和正式账本区块,其特征在于,所述交易包括以下步骤:A negotiable blockchain transaction method, which establishes a temporary ledger block and a formal ledger block with a mapping relationship on the blockchain, wherein the transaction includes the following steps:
    接收交易中资金转出方向区块链发起的交易请求;Receive a transaction request initiated by the transfer of funds in the transaction to the blockchain;
    对接收到的请求中包含的当前临时账本余额的零知识证明、当前正式账本余额的零知识证明以及签名进行验证,若验证均通过,则将所述请求中包含的所有内容写入到该交易请求对应的临时账本区块中;Verify the zero-knowledge certificate of the current temporary ledger balance, the zero-knowledge certificate of the current official ledger balance, and the signature included in the received request. If the verification is passed, write all the content contained in the request to the transaction Request the corresponding temporary ledger block;
    接收发起请求的相对方向区块链发起的反馈请求,若所述反馈请求是交易修改请求,则重复上一步;若所述反馈请求是交易结束请求,则进一步识别所述交易结束请求的类型;Receiving a feedback request initiated by the blockchain in the opposite direction of the request, if the feedback request is a transaction modification request, repeating the previous step; if the feedback request is a transaction end request, further identifying the type of the transaction end request;
    若所述交易结束请求为同意交易请求,则将所述同意交易请求中包含的正式账本余额和所述同意请求发送方的相对方最后一次发起的请求中包含的正式账本余额,写入与所述临时账本区块具有映射关系的正式账本区块中;If the transaction end request is a consent transaction request, write the formal ledger balance included in the consent transaction request and the formal ledger balance included in the last request initiated by the counterparty of the consent request sender to the The temporary ledger block has a mapping relationship in the formal ledger block;
    若所述交易结束请求为拒绝交易请求,则在所述临时账本区块中,将交易双方的临时账本余额和正式账本余额分别加上最近一次请求中包含的交易金额。If the transaction end request is a transaction rejection request, in the temporary ledger block, the temporary ledger balance and formal ledger balance of both parties to the transaction are added to the transaction amount included in the latest request, respectively.
  2. 根据权利要求1所述的可协商的区块链交易方法,其特征在于,所述当前临时账本余额是指所述发起请求的请求方的正式账户余额减去该请求方所有处于待确认状态的交易金额的总和后的差值。The negotiable blockchain transaction method according to claim 1, wherein the current temporary ledger balance refers to the official account balance of the requesting party who initiated the request minus all of the requesting party's pending confirmation status The difference between the sum of the transaction amounts.
  3. 根据权利要求1所述的可协商的区块链交易方法,其特征在于,所述验证通过指:The negotiable blockchain transaction method according to claim 1, wherein the verification passes:
    发送请求的请求方的相对方使用公钥对所述请求中包含的当前临时账本余额、当前正式账本余额和交易金额成功解密;以及,The counterparty of the requesting party that sent the request successfully decrypted the current temporary ledger balance, current formal ledger balance, and transaction amount contained in the request using the public key; and,
    当前临时账本余额和当前正式账本余额均大于零。Both the current temporary ledger balance and the current official ledger balance are greater than zero.
  4. 根据权利要求1所述的可协商的区块链交易方法,其特征在于,若所述交易结束请求为同意交易请求,则先根据预设的再确认策略对所述同意交易请求指向的交易进行再确认,若再确认为通过,则再将所述同意交易请求中包含的正式账本余额和所述同意请求发送方的相对方最后一次发起的请求中包含的正式账本余额,写入与所述临时账本区块具有映射关系的正式账本区块中。The negotiable blockchain transaction method according to claim 1, characterized in that, if the transaction end request is a consent transaction request, the transaction directed by the consent transaction request is first performed according to a preset reconfirmation policy Reconfirmation, if the reconfirmation is passed, then the formal ledger balance included in the consent transaction request and the formal ledger balance included in the last request initiated by the counterparty of the consent request sender are written into the The temporary ledger block has a mapping relationship in the formal ledger block.
  5. 根据权利要求1所述的可协商的区块链交易方法,其特征在于,所述再确认策略为第三方确认或者所述交易请求的相对方确认,所述再确认步骤包括:The negotiable blockchain transaction method according to claim 1, wherein the reconfirmation strategy is a third party confirmation or a counterparty confirmation of the transaction request, and the reconfirmation step includes:
    接收第三方或者所述交易请求的相对方发送的核定交易请求;Receiving an approved transaction request sent by a third party or a counterparty of the transaction request;
    若所述核定交易中包含有同意指令,则再将所述同意交易请求中包含的正式账本余额和所述同意请求发送方的相对方最后一次发起的请求中包含的正式账本余额,写入与所述 临时账本区块具有映射关系的正式账本区块中;If the approved transaction includes a consent instruction, the formal ledger balance included in the consent transaction request and the formal ledger balance included in the last request initiated by the counterparty of the consent request sender are written into the The temporary ledger block has a formal ledger block with a mapping relationship;
    若所述核定交易中包含有拒绝指令,则在所述临时账本区块中,将交易双方的临时账本余额和正式账本余额分别加上最近一次请求中包含的交易金额。If the approved transaction includes a refusal instruction, the temporary ledger balance and the formal ledger balance of both parties to the transaction are added to the transaction amount included in the latest request in the temporary ledger block.
  6. 根据权利要求1所述的可协商的区块链交易方法,其特征在于,所述再确认策略为延时自动确认,所述再确认步骤包括:The negotiable blockchain transaction method according to claim 1, wherein the re-confirmation strategy is delayed automatic confirmation, and the re-confirmation step comprises:
    判断在预设的时间内是否接收到交易双方中任意一方发送的撤销交易请求;Determine whether a request to cancel a transaction sent by any of the two parties to the transaction is received within a preset time;
    若没有接收到撤销交易请求,则再将所述同意交易请求中包含的正式账本余额和所述同意请求发送方的相对方最后一次发起的请求中包含的正式账本余额,写入与所述临时账本区块具有映射关系的正式账本区块中;If no request to cancel the transaction is received, the formal ledger balance included in the consent transaction request and the formal ledger balance included in the last request initiated by the counterparty of the consent request sender are written into the temporary account. The ledger block has a mapping relationship in the formal ledger block;
    若接收到撤销交易请求,则在所述临时账本区块中,将交易双方的临时账本余额和正式账本余额分别加上最近一次请求中包含的交易金额。If a request to cancel a transaction is received, in the temporary ledger block, the temporary ledger balance and formal ledger balance of both parties to the transaction are added to the transaction amount included in the latest request, respectively.
  7. 一种电子装置,其特征在于,所述电子装置上存储有可协商的区块链交易系统,所述可协商的区块链交易系统包括:An electronic device is characterized in that a negotiable blockchain transaction system is stored on the electronic device, and the negotiable blockchain transaction system includes:
    请求接收模块,用于接收交易中资金转出方向区块链发起的交易请求,以及接收发起请求的相对方向区块链发起的反馈请求;The request receiving module is used to receive a transaction request initiated by the blockchain in the transfer of funds out of the transaction, and a feedback request initiated by the blockchain opposite to the originating request;
    验证模块,用于对接收到的请求中包含的当前临时账本余额的零知识证明、当前正式账本余额的零知识证明以及签名进行验证,并在验证均通过后,将所述请求中包含的所有内容写入到该交易请求对应的临时账本区块中;A verification module for verifying the zero-knowledge certificate of the current temporary ledger balance, the zero-knowledge certificate of the current formal ledger balance, and the signature included in the received request, and after all the verifications are passed, all The content is written into the temporary ledger block corresponding to the transaction request;
    反馈请求识别模块,用于识别所述反馈请求的类型,当所述反馈请求是交易修改请求时跳转到所述验证模块,当所述反馈请求为交易结束请求时,进一步识别所述交易结束请求的类型;A feedback request identification module, configured to identify the type of the feedback request, and jump to the verification module when the feedback request is a transaction modification request, and further identify the end of the transaction when the feedback request is a transaction end request The type of request
    正式账本修改模块,用于当所述交易结束请求为同意交易请求时,将所述同意交易请求中包含的正式账本余额和所述同意请求发送方的相对方最后一次发起的请求中包含的正式账本余额,写入与所述临时账本区块具有映射关系的正式账本区块中;A formal ledger modification module is configured to: when the transaction end request is a consent transaction request, the formal ledger balance included in the consent transaction request and the formal request included in the last request initiated by the counterparty of the consent request sender The ledger balance is written into a formal ledger block having a mapping relationship with the temporary ledger block;
    交易终止模块,用于当所述交易结束请求为拒绝交易请求时,在所述临时账本区块中,将交易双方的临时账本余额和正式账本余额分别加上最近一次请求中包含的交易金额。The transaction termination module is configured to: when the transaction end request is a transaction refusal request, in the temporary ledger block, add the temporary ledger balance and formal ledger balance of both parties to the transaction to the transaction amount included in the latest request, respectively.
  8. 根据权利要求7所述的电子装置,其特征在于,所述可协商的区块链交易系统还包括:The electronic device according to claim 7, wherein the negotiable blockchain transaction system further comprises:
    再确认模块,用于在所述交易结束请求为同意交易请求时,先根据预设的再确认策略对所述同意交易请求指向的交易进行再确认,若再确认为通过,则再跳转到正式账本修改模块。A reconfirmation module is configured to reconfirm the transaction pointed to by the agreed transaction request according to a preset reconfirmation policy when the transaction end request is an agreed transaction request, and if the reconfirmation is passed, then jump to Modification of official ledger.
  9. 一种计算机设备,包括存储器和处理器,其特征在于,所述存储器上存储有可被所 述处理器执行的可协商的区块链交易系统,所述系统被所述处理器执行时实现如下步骤:A computer device includes a memory and a processor, wherein the memory stores a negotiable blockchain transaction system that can be executed by the processor, and the system is implemented as follows when executed by the processor: step:
    接收交易中资金转出方向区块链发起的交易请求;Receive a transaction request initiated by the transfer of funds in the transaction to the blockchain;
    对接收到的请求中包含的当前临时账本余额的零知识证明、当前正式账本余额的零知识证明以及签名进行验证,若验证均通过,则将所述请求中包含的所有内容写入到该交易请求对应的临时账本区块中;Verify the zero-knowledge certificate of the current temporary ledger balance, the zero-knowledge certificate of the current official ledger balance, and the signature included in the received request. If the verification is passed, write all the content contained in the request to the transaction Request the corresponding temporary ledger block;
    接收发起请求的相对方向区块链发起的反馈请求,若所述反馈请求是交易修改请求,则重复上一步;若所述反馈请求是交易结束请求,则进一步识别所述交易结束请求的类型;Receiving a feedback request initiated by the blockchain in the opposite direction of the request, if the feedback request is a transaction modification request, repeating the previous step; if the feedback request is a transaction end request, further identifying the type of the transaction end request;
    若所述交易结束请求为同意交易请求,则将所述同意交易请求中包含的正式账本余额和所述同意请求发送方的相对方最后一次发起的请求中包含的正式账本余额,写入与所述临时账本区块具有映射关系的正式账本区块中;If the transaction end request is a consent transaction request, write the formal ledger balance included in the consent transaction request and the formal ledger balance included in the last request initiated by the counterparty of the consent request sender to the The temporary ledger block has a mapping relationship in the formal ledger block;
    若所述交易结束请求为拒绝交易请求,则在所述临时账本区块中,将交易双方的临时账本余额和正式账本余额分别加上最近一次请求中包含的交易金额。If the transaction end request is a transaction rejection request, in the temporary ledger block, the temporary ledger balance and formal ledger balance of both parties to the transaction are added to the transaction amount included in the latest request, respectively.
  10. 根据权利要求9所述的计算机设备,其特征在于,所述当前临时账本余额是指所述发起请求的请求方的正式账户余额减去该请求方所有处于待确认状态的交易金额的总和后的差值。The computer device according to claim 9, wherein the current temporary ledger balance is the balance of the official account of the requesting party who initiated the request minus the sum of all the transaction amounts of the requesting party in the pending status. Difference.
  11. 根据权利要求9所述的计算机设备,其特征在于,所述验证通过指:The computer device according to claim 9, wherein the verification passes:
    发送请求的请求方的相对方使用公钥对所述请求中包含的当前临时账本余额、当前正式账本余额和交易金额成功解密;以及,The counterparty of the requesting party that sent the request successfully decrypted the current temporary ledger balance, current formal ledger balance, and transaction amount contained in the request using the public key; and,
    当前临时账本余额和当前正式账本余额均大于零。Both the current temporary ledger balance and the current official ledger balance are greater than zero.
  12. 根据权利要求9所述的计算机设备,其特征在于,若所述交易结束请求为同意交易请求,则先根据预设的再确认策略对所述同意交易请求指向的交易进行再确认,若再确认为通过,则再将所述同意交易请求中包含的正式账本余额和所述同意请求发送方的相对方最后一次发起的请求中包含的正式账本余额,写入与所述临时账本区块具有映射关系的正式账本区块中。The computer device according to claim 9, characterized in that, if the transaction end request is a consent transaction request, the transaction pointed to by the consent transaction request is reconfirmed according to a preset reconfirmation policy, and if reconfirmed To pass, the formal ledger balance included in the consent transaction request and the formal ledger balance included in the last request initiated by the counterparty of the consent request sender are written in a mapping with the temporary ledger block Relationship in the formal ledger block.
  13. 根据权利要求9所述的计算机设备,其特征在于,所述再确认策略为第三方确认或者所述交易请求的相对方确认,所述再确认步骤包括:The computer device according to claim 9, wherein the reconfirmation strategy is a third party confirmation or a counterparty confirmation of the transaction request, and the reconfirmation step comprises:
    接收第三方或者所述交易请求的相对方发送的核定交易请求;Receiving an approved transaction request sent by a third party or a counterparty of the transaction request;
    若所述核定交易中包含有同意指令,则再将所述同意交易请求中包含的正式账本余额和所述同意请求发送方的相对方最后一次发起的请求中包含的正式账本余额,写入与所述临时账本区块具有映射关系的正式账本区块中;If the approved transaction includes a consent instruction, the formal ledger balance included in the consent transaction request and the formal ledger balance included in the last request initiated by the counterparty of the consent request sender are written into the The temporary ledger block has a formal ledger block with a mapping relationship;
    若所述核定交易中包含有拒绝指令,则在所述临时账本区块中,将交易双方的临时账本余额和正式账本余额分别加上最近一次请求中包含的交易金额。If the approved transaction includes a refusal instruction, the temporary ledger balance and the formal ledger balance of both parties to the transaction are added to the transaction amount included in the latest request in the temporary ledger block.
  14. 根据权利要求9所述的计算机设备,其特征在于,所述再确认策略为延时自动确认,所述再确认步骤包括:The computer device according to claim 9, wherein the reconfirmation strategy is delayed automatic confirmation, and the reconfirmation step comprises:
    判断在预设的时间内是否接收到交易双方中任意一方发送的撤销交易请求;Determine whether a request to cancel a transaction sent by any of the two parties to the transaction is received within a preset time;
    若没有接收到撤销交易请求,则再将所述同意交易请求中包含的正式账本余额和所述同意请求发送方的相对方最后一次发起的请求中包含的正式账本余额,写入与所述临时账本区块具有映射关系的正式账本区块中;If no request to cancel the transaction is received, the formal ledger balance included in the consent transaction request and the formal ledger balance included in the last request initiated by the counterparty of the consent request sender are written into the temporary account. The ledger block has a mapping relationship in the formal ledger block;
    若接收到撤销交易请求,则在所述临时账本区块中,将交易双方的临时账本余额和正式账本余额分别加上最近一次请求中包含的交易金额。If a request to cancel a transaction is received, in the temporary ledger block, the temporary ledger balance and formal ledger balance of both parties to the transaction are added to the transaction amount included in the latest request, respectively.
  15. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质内存储有计算机程序指令,所述计算机程序指令可被至少一个处理器所执行,以使所述至少一个处理器执行如下步骤:A computer-readable storage medium, characterized in that computer program instructions are stored in the computer-readable storage medium, and the computer program instructions are executable by at least one processor, so that the at least one processor executes as follows step:
    接收交易中资金转出方向区块链发起的交易请求;Receive a transaction request initiated by the transfer of funds in the transaction to the blockchain;
    对接收到的请求中包含的当前临时账本余额的零知识证明、当前正式账本余额的零知识证明以及签名进行验证,若验证均通过,则将所述请求中包含的所有内容写入到该交易请求对应的临时账本区块中;Verify the zero-knowledge certificate of the current temporary ledger balance, the zero-knowledge certificate of the current official ledger balance, and the signature included in the received request. If the verification is passed, write all the content contained in the request to the transaction Request the corresponding temporary ledger block;
    接收发起请求的相对方向区块链发起的反馈请求,若所述反馈请求是交易修改请求,则重复上一步;若所述反馈请求是交易结束请求,则进一步识别所述交易结束请求的类型;Receiving a feedback request initiated by the blockchain in the opposite direction of the request, if the feedback request is a transaction modification request, repeating the previous step; if the feedback request is a transaction end request, further identifying the type of the transaction end request;
    若所述交易结束请求为同意交易请求,则将所述同意交易请求中包含的正式账本余额和所述同意请求发送方的相对方最后一次发起的请求中包含的正式账本余额,写入与所述临时账本区块具有映射关系的正式账本区块中;If the transaction end request is a consent transaction request, write the formal ledger balance included in the consent transaction request and the formal ledger balance included in the last request initiated by the counterparty of the consent request sender to the The temporary ledger block has a mapping relationship in the formal ledger block;
    若所述交易结束请求为拒绝交易请求,则在所述临时账本区块中,将交易双方的临时账本余额和正式账本余额分别加上最近一次请求中包含的交易金额。If the transaction end request is a transaction rejection request, in the temporary ledger block, the temporary ledger balance and formal ledger balance of both parties to the transaction are added to the transaction amount included in the latest request, respectively.
  16. 根据权利要求15所述的计算机可读存储介质,其特征在于,所述当前临时账本余额是指所述发起请求的请求方的正式账户余额减去该请求方所有处于待确认状态的交易金额的总和后的差值。The computer-readable storage medium according to claim 15, wherein the current temporary ledger balance refers to the official account balance of the requesting party who initiated the request minus all the transaction amounts of the requesting party in a pending status The difference after the sum.
  17. 根据权利要求15所述的计算机可读存储介质,其特征在于,所述验证通过指:The computer-readable storage medium according to claim 15, wherein the verification passes:
    发送请求的请求方的相对方使用公钥对所述请求中包含的当前临时账本余额、当前正式账本余额和交易金额成功解密;以及,The counterparty of the requesting party that sent the request successfully decrypted the current temporary ledger balance, current formal ledger balance, and transaction amount contained in the request using the public key; and,
    当前临时账本余额和当前正式账本余额均大于零。Both the current temporary ledger balance and the current official ledger balance are greater than zero.
  18. 根据权利要求15所述的计算机可读存储介质,其特征在于,若所述交易结束请求为同意交易请求,则先根据预设的再确认策略对所述同意交易请求指向的交易进行再确认,若再确认为通过,则再将所述同意交易请求中包含的正式账本余额和所述同意请求发送方 的相对方最后一次发起的请求中包含的正式账本余额,写入与所述临时账本区块具有映射关系的正式账本区块中。The computer-readable storage medium according to claim 15, wherein if the transaction end request is a consent transaction request, first re-confirm the transaction pointed to by the consent transaction request according to a preset reconfirmation policy, If the reconfirmation is passed, the formal ledger balance included in the consent transaction request and the formal ledger balance included in the last request initiated by the counterparty of the consent request sender are written into the temporary ledger area. A block in a formal ledger block with a mapping relationship.
  19. 根据权利要求15所述的计算机可读存储介质,其特征在于,所述再确认策略为第三方确认或者所述交易请求的相对方确认,所述再确认步骤包括:The computer-readable storage medium according to claim 15, wherein the reconfirmation strategy is a third party confirmation or a counterparty confirmation of the transaction request, and the reconfirmation step includes:
    接收第三方或者所述交易请求的相对方发送的核定交易请求;Receiving an approved transaction request sent by a third party or a counterparty of the transaction request;
    若所述核定交易中包含有同意指令,则再将所述同意交易请求中包含的正式账本余额和所述同意请求发送方的相对方最后一次发起的请求中包含的正式账本余额,写入与所述临时账本区块具有映射关系的正式账本区块中;If the approved transaction includes a consent instruction, the formal ledger balance included in the consent transaction request and the formal ledger balance included in the last request initiated by the counterparty of the consent request sender are written into the The temporary ledger block has a formal ledger block with a mapping relationship;
    若所述核定交易中包含有拒绝指令,则在所述临时账本区块中,将交易双方的临时账本余额和正式账本余额分别加上最近一次请求中包含的交易金额。If the approved transaction includes a refusal instruction, the temporary ledger balance and the formal ledger balance of both parties to the transaction are added to the transaction amount included in the latest request in the temporary ledger block.
  20. 根据权利要求15所述的计算机可读存储介质,其特征在于,所述再确认策略为延时自动确认,所述再确认步骤包括:The computer-readable storage medium according to claim 15, wherein the reconfirmation strategy is delayed automatic confirmation, and the reconfirmation step comprises:
    判断在预设的时间内是否接收到交易双方中任意一方发送的撤销交易请求;Determine whether a request to cancel a transaction sent by any of the two parties to the transaction is received within a preset time;
    若没有接收到撤销交易请求,则再将所述同意交易请求中包含的正式账本余额和所述同意请求发送方的相对方最后一次发起的请求中包含的正式账本余额,写入与所述临时账本区块具有映射关系的正式账本区块中;If no request to cancel the transaction is received, the formal ledger balance included in the consent transaction request and the formal ledger balance included in the last request initiated by the counterparty of the consent request sender are written into the temporary account. The ledger block has a mapping relationship in the formal ledger block;
    若接收到撤销交易请求,则在所述临时账本区块中,将交易双方的临时账本余额和正式账本余额分别加上最近一次请求中包含的交易金额。If a request to cancel a transaction is received, in the temporary ledger block, the temporary ledger balance and formal ledger balance of both parties to the transaction are added to the transaction amount included in the latest request, respectively.
PCT/CN2018/124439 2018-08-24 2018-12-27 Negotiable block chain transaction method, apparatus, device, and storage medium WO2020037927A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810972002.5 2018-08-24
CN201810972002.5A CN109345251A (en) 2018-08-24 2018-08-24 Negotiable block chain method of commerce, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
WO2020037927A1 true WO2020037927A1 (en) 2020-02-27

Family

ID=65296555

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/124439 WO2020037927A1 (en) 2018-08-24 2018-12-27 Negotiable block chain transaction method, apparatus, device, and storage medium

Country Status (2)

Country Link
CN (1) CN109345251A (en)
WO (1) WO2020037927A1 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109919622B (en) * 2019-02-22 2020-10-23 杭州复杂美科技有限公司 Transaction replacement method, apparatus and storage medium
CN110457914A (en) * 2019-07-09 2019-11-15 深圳壹账通智能科技有限公司 Verification of data method, apparatus, computer equipment and storage medium
CN110428238A (en) * 2019-07-31 2019-11-08 北京米弘科技有限公司 The account cancelling method and system of block chain
CN110619524A (en) * 2019-10-12 2019-12-27 链农(深圳)信息科技有限公司 Transaction method based on block chain
CN110782255B (en) * 2019-11-06 2022-11-15 杭州复杂美科技有限公司 Delayed transaction cancellation method, apparatus and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101841421A (en) * 2009-03-19 2010-09-22 华为技术有限公司 Online charging method, device and system
CN106504094A (en) * 2016-11-25 2017-03-15 中国银行股份有限公司 Transaction match method and system based on the distributed general ledger system of block chain technology
CN107292691A (en) * 2016-04-05 2017-10-24 阿里巴巴集团控股有限公司 A kind of method and device for business processing
CN107665445A (en) * 2017-09-14 2018-02-06 苏宁云商集团股份有限公司 A kind of method and device for handling order and redeeming message

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102663639A (en) * 2012-04-23 2012-09-12 重庆先迈通信技术有限公司 Negotiated transaction business network system
US10355869B2 (en) * 2017-01-12 2019-07-16 International Business Machines Corporation Private blockchain transaction management and termination
CN107085810A (en) * 2017-04-19 2017-08-22 朱皞罡 Across the chain operating method and block chain management system of a kind of block chain
CN107911373B (en) * 2017-11-24 2019-09-06 中钞信用卡产业发展有限公司杭州区块链技术研究院 A kind of block chain right management method and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101841421A (en) * 2009-03-19 2010-09-22 华为技术有限公司 Online charging method, device and system
CN107292691A (en) * 2016-04-05 2017-10-24 阿里巴巴集团控股有限公司 A kind of method and device for business processing
CN106504094A (en) * 2016-11-25 2017-03-15 中国银行股份有限公司 Transaction match method and system based on the distributed general ledger system of block chain technology
CN107665445A (en) * 2017-09-14 2018-02-06 苏宁云商集团股份有限公司 A kind of method and device for handling order and redeeming message

Also Published As

Publication number Publication date
CN109345251A (en) 2019-02-15

Similar Documents

Publication Publication Date Title
TWI713353B (en) Communication method between blockchain nodes, digital certificate management method, device and electronic equipment
CN110457875B (en) Data authorization method and device based on block chain
EP3665857B1 (en) Blockchain architecture with record security
US11171782B2 (en) Identity and electronic signature verification in blockchain
WO2020037927A1 (en) Negotiable block chain transaction method, apparatus, device, and storage medium
US11170092B1 (en) Document authentication certification with blockchain and distributed ledger techniques
US11240001B2 (en) Selective access to asset transfer data
US20200382326A1 (en) Digital certificate verification method and apparatus, computer device, and storage medium
TWI727292B (en) Block chain transaction method and device, and electronic equipment
EP3520319B1 (en) Distributed electronic record and transaction history
US20200193432A1 (en) Method and system for settling a blockchain transaction
US20190188655A1 (en) Dynamic blockchain transactional policy management
US20240080205A1 (en) System and method for off-chain cryptographic transaction verification
US11652607B1 (en) Symmetric encryption for private smart contracts among multiple parties in a private peer-to-peer network
CN117640099A (en) Systems and methods for avoiding or reducing encryption retention resources on blockchain networks
KR20180113145A (en) Method for processing blockchain based real-time transaction and system thereof
JP2020507222A (en) System and method for information protection
TWI709925B (en) Method and device for business processing
CN111178894B (en) Asset type registration and transaction record verification method and system
JP2023076628A (en) Computer-implemented systems and methods relating to binary blockchain comprising one pair of coupled blockchains
US20200250655A1 (en) Efficient, environmental and consumer friendly consensus method for cryptographic transactions
CN109547206A (en) The processing method and relevant apparatus of digital certificate
WO2020233236A1 (en) Verification method and device of consumable certificates applied to block chain
WO2021019398A1 (en) Transfering tokens between blockchain networks
WO2021184642A1 (en) Blockchain-based transaction method and apparatus, electronic device, and readable storage medium

Legal Events

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

Ref document number: 18930795

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 09.06.2021)

122 Ep: pct application non-entry in european phase

Ref document number: 18930795

Country of ref document: EP

Kind code of ref document: A1