WO2020199703A1 - Method, device and system for blockchain transaction - Google Patents

Method, device and system for blockchain transaction Download PDF

Info

Publication number
WO2020199703A1
WO2020199703A1 PCT/CN2020/070525 CN2020070525W WO2020199703A1 WO 2020199703 A1 WO2020199703 A1 WO 2020199703A1 CN 2020070525 W CN2020070525 W CN 2020070525W WO 2020199703 A1 WO2020199703 A1 WO 2020199703A1
Authority
WO
WIPO (PCT)
Prior art keywords
transaction
party
value
blockchain
transfer
Prior art date
Application number
PCT/CN2020/070525
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
Priority claimed from CN201910257377.8A external-priority patent/CN110084595A/en
Priority claimed from CN201910257369.3A external-priority patent/CN110084594A/en
Priority claimed from CN201911289291.XA external-priority patent/CN111127011B/en
Application filed by 杜晓楠 filed Critical 杜晓楠
Publication of WO2020199703A1 publication Critical patent/WO2020199703A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/40Network security protocols
    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Definitions

  • the present invention relates to blockchain technology, and more specifically, to a method, device and system for blockchain transactions.
  • Blockchain technology uses block-chain data structures to verify and store data, uses distributed node consensus algorithms to generate and update data, uses cryptography to ensure the security of data transmission and access, and uses intelligence composed of automated script codes.
  • the existing blockchain transaction methods are usually too complicated, low performance, high cost, and vulnerable to attacks. Therefore, there is a need for a blockchain that can maintain transaction security and prevent attacks while achieving high capacity and high speed. Methods and devices for transactions.
  • the current bank reconciliation system adopts the T+1 reconciliation mechanism (that is, the purchase operation processing data on T day requires T+1 day to perform reconciliation), with many transaction processes and long capital links. And its reconciliation is usually based on one party's bill, and all the bills of both parties within a certain period of time are checked. This reconciliation rule is very complicated, making the efficiency of fund clearing and settlement very low. Moreover, during the verification process, the security of the data is difficult to guarantee. Therefore, when there is a dispute or an account error, it is difficult to determine which account has a problem. Therefore, it needs to be verified from the source, which is inefficient and error-prone.
  • the technical problem to be solved by the present invention is to provide a block chain transaction method and device for the above-mentioned defects of the prior art, which can realize high-capacity and high-speed block chain transactions while maintaining transaction security.
  • the technical solution adopted by the present invention to solve its technical problems is: constructing a block chain transaction method, including: S1, constructing a lightning network based on a stateless contract; S2, judging whether the transaction parties are on the same chain, and if it is executed Step S3, otherwise use other chains that support the same encryption to perform cross-chain atomic swap transactions; S3, use the Lightning Network to allocate transaction blocks; S4, after the transaction ends, the recipient of the two parties waits for the transaction block After the growth set time, confirm the transaction is valid.
  • a block chain transaction device the device includes: a memory; a processor, which is used to store instructions, when the instructions are executed The processor executes the blockchain transaction method.
  • the technical problem to be solved by the present invention is to provide a block chain transaction method and system in view of the complex reconciliation process, low efficiency, and low security of the prior art bank reconciliation system, which needs to be reconciled every other day. Safe, effective, simple and efficient reconciliation.
  • the technical solution adopted by the present invention to solve its technical problem is: constructing a blockchain transaction method, including: S1, the business device of the first transaction party receives first-party transaction data information, based on the first-party transaction data The information generates the first blockchain ID value according to the set rules, and sends the transaction data information of the first party to the business device of the second transaction party, and the business device of the second transaction party is based on the first party transaction
  • the data information generates the second block chain ID value according to the same set rules; S2, writes the first block chain ID value to the first block chain node, and transmits it to the second block through the block chain P2P network S3, the business device of the second transaction party monitors the second blockchain node to obtain the first blockchain ID value; S4, compares the first blockchain ID value with the The second blockchain ID value for reconciliation.
  • Another technical solution adopted by the present invention to solve its technical problem is to construct a block chain transaction system, including the business device of the first transaction party, the business device of the second transaction party and each block chain node that communicate with each other
  • the business device of the first transaction party is in communication connection with its corresponding business terminal
  • the business device of the second transaction party is in communication connection with its corresponding business terminal
  • the business device of the first transaction party the business device of the second transaction party and the blockchain node device respectively include a memory and a processor
  • the memory stores a computer program
  • the processor implements a blockchain transaction when the computer program is executed.
  • the method and device for implementing blockchain transactions of the present invention can realize high-capacity and high-speed blockchain transactions while maintaining transaction security. Furthermore, due to the advantages of the block chain such as tamper resistance, high transparency, and decentralization, the authenticity and security of the transaction details are ensured, and since only the first block chain ID value generated by the first transaction party needs to be written After entering the blockchain once, the second transaction party obtains reconciliation by monitoring it, and after the completion of the blockchain transaction, the reconciliation of both parties to the transaction can be realized. The entire reconciliation process is simple and efficient. Further, a single piece of real-time transaction data can be reconciled in real time, or multiple transactions within a certain period of time can be periodically batch reconciled, so the reconciliation time is flexible.
  • Figure 1 is a flowchart of the first embodiment of the blockchain transaction method of the present invention
  • FIG. 3 is a schematic diagram of side chain and main chain anchoring of the lightning network according to the preferred embodiment of the present invention.
  • FIG. 4 is a schematic diagram of a transaction using a blockchain transaction method in a preferred embodiment of the present invention.
  • FIG. 5 is a flowchart of the third embodiment of the blockchain transaction method of the present invention.
  • FIG. 6 is a flowchart of the steps of real-time reconciliation of a single transaction data of the fourth embodiment of the blockchain transaction method of the present invention.
  • FIG. 7 is a method flowchart of a batch reconciliation step of multiple transaction data in the fourth embodiment of the blockchain transaction method of the present invention.
  • Fig. 8 is a functional block diagram of a block chain transaction system according to a preferred embodiment of the present invention.
  • Fig. 1 is a flowchart of the first embodiment of the blockchain transaction method of the present invention.
  • a lightning network is constructed based on a stateless contract.
  • the Lightning Network is a decentralized network that can use the stateless contract function in the blockchain to realize instant payment for both parties in the transaction.
  • step S2 it is judged whether the two parties in the transaction are on the same chain. If yes, go to step S3, otherwise go to step S4.
  • step S3 for both parties in the same chain the Lightning Network is used to conduct transactions.
  • the Lightning Network can achieve high throughput and low latency transactions. In the Lightning Network, only routing nodes participate in transactions, and transactions are executed in parallel in the network. Therefore, as the nodes grow, there is no upper limit in theoretical throughput.
  • Lightning network transactions are secured by payment channels, which can realize instant transactions without waiting for block confirmation.
  • step S4 for both parties in different chains, other chains supporting the same encryption are used to perform cross-chain atomic exchange transactions.
  • cross-chain atom exchanges can immediately occur outside the chain through heterogeneous blockchain consensus rules. As long as the chain can support the same cryptographic hash function, transactions can be made across blockchains without having to trust a third-party custodian.
  • step S5 whether it is a transaction using the Lightning Network or a cross-chain atomic swap transaction, after the transaction ends, the payee of the two parties in the transaction waits for the transaction block to grow for a set time before confirming that the transaction is valid .
  • the determination time can be calculated according to the probability of preventing the attack that is actually desired to be obtained. Generally, the higher the probability of preventing the attack is desired, the longer the waiting time is. When the waiting time exceeds the predetermined time, the attacker's chance of success is very low. Those skilled in the art can use Poisson distribution for calculation. Therefore, implementing the blockchain transaction method of the present invention can realize high-capacity and high-speed blockchain transactions while maintaining transaction security.
  • Fig. 2 is a flowchart of the second embodiment of the blockchain transaction method of the present invention.
  • step S1 the side chain is connected to the Lightning Network by means of self-built side chain mortgage Token, and the registration is entered in the manner of two-way anchoring.
  • Fig. 3 is a schematic diagram of side chain and main chain anchoring of the lightning network according to the preferred embodiment of the present invention.
  • the side chain adopts the mechanism of mortgage Token self-built side chain, through the two-way anchoring design, instant payment and high scalability, and adopts a hybrid design scheme: "drive chain + notary/side "Chain" approach to achieve two-way anchoring with Bitcoin.
  • step S2 the side chain adopts a custody mode or an alliance mode for transaction asset management.
  • the Wasm smart contract is used to expand the application scenarios of Token to enhance the ecology and value of the Token, and it is possible to openly and transparently manage the side chain by displaying the number of mortgage tokens for each side chain and the management address and organization.
  • the main chain runs DAPP, and the advantage of the side chain is that each independent DAPP resource is isolated and does not occur on Ethereum. Due to the hot traffic of a single DAPP and occupying the network, the gas cost of using other DAPPs increases. From a security perspective, the main The deployment of DAPP on the chain may cause the entire Ethereum network to roll back due to a security vulnerability in a single DAPP, such as The DAO.
  • the side chain adopts custody for transaction asset management including sending the assets of the side chain to the custodian of the main chain. After the custodian receives the assets, the corresponding digital assets are activated on the side chain. .
  • the asset is sent to the custodian of the main chain. After the custodian receives the relevant asset information, the side chain activates the corresponding digital asset.
  • the custodial model tends to be centralized and requires the custodian to provide credit endorsement.
  • the side chain adopts an alliance method for transaction asset management including the use of two-way anchoring technology to transfer the assets of the main chain to the side chain, and the side chain adopts the consensus algorithm of the custodian alliance to Assets are confirmed, and the consensus algorithm of the custody alliance includes one of PBFT, PoS, and PoA.
  • the side chain adopts an alliance method for transaction asset management further includes locking a deposit corresponding to the main chain to protect the side chain when the alliance of the side chain collapses. Chain assets.
  • the custodian alliance is used to replace the single custodian credit endorsement
  • the two-way anchoring technology is used to transfer the main chain assets to the side chain.
  • the side chain uses the consensus algorithm of the custodian alliance to confirm the digital assets.
  • the consensus algorithm of the custodian is one of PBFT, POS, and POA.
  • the security of the side chain relies on the credit of the alliance. It is worth noting that although the side chain custody or the credit endorsement of the alliance since the side chain, there will be a corresponding in the main chain
  • the locking margin mechanism ensures that if the side chain credit alliance collapses, the user assets of the side chain can still be guaranteed. This is different from the traditional side chain model and is the innovation of the side chain of the present invention.
  • the amount of mortgage NBT for each side chain can be displayed in the side chain browser, and all users can refer to it at any time.
  • step S3 it is judged whether both parties to the transaction are on the same chain. If yes, go to step S5, otherwise go to step S4.
  • step S4 for both parties in different chains, other chains supporting the same encryption are used to perform cross-chain atomic exchange transactions.
  • cross-chain atom exchanges can immediately occur outside the chain through heterogeneous blockchain consensus rules. As long as the chain can support the same cryptographic hash function, transactions can be made across blockchains without having to trust a third-party custodian.
  • step S5 both parties of the transaction create a ledger entry on the blockchain, in which the set amount is pre-stored in the micro-payment channel in the lightning network and the signatures of both parties of the transaction are output.
  • a ledger entry is created on the blockchain of both parties to the transaction, and the two participants are required to sign any capital expenditures.
  • the transactions created by both parties return the ledger entries to their respective distributions, but will not broadcast them to the blockchain.
  • both parties to the transaction create multiple transaction output inputs in the ledger entry to update the ledger entry and output signatures of both parties to the transaction.
  • both parties to the transaction can create multiple transaction outputs and inputs from the current ledger entry to update the distribution of each transaction party in the ledger entry.
  • step S7 one of the parties to the transaction who needs to withdraw cash writes the latest version of the ledger entry into the blockchain, and distributes it according to the distribution plan in the latest version of the ledger entry.
  • the latest version of the ledger entry is valid, which is enforced by the smart contract script parsed by the blockchain. Any party can close this entry at any time by broadcasting the latest version to the blockchain without any trust or supervision.
  • the Lightning Network is used to create ledger entries, a path similar to routing data packets on the Internet can be found on the network. The nodes on the path are not trusted because a script is used to enforce payment, which enforces atomicity (the entire payment succeeds or fails) by decrementing the time lock.
  • the blockchain acts as an arbiter. Therefore, non-blockchain transactions can be performed without restrictions. Transactions can be traded with confidence in the enforceability of the blockchain.
  • one of the parties to the transaction who needs to withdraw cash writes the latest version of the ledger entry into the blockchain, and executes it according to the distribution plan in the latest version of the ledger entry.
  • the allocation step further includes the following steps.
  • One of the two parties in the transaction who needs to withdraw cash will write the latest version of the ledger entry signed by both parties in the transaction into the blockchain. Determine whether there is another party claiming that the ledger entry is not the latest version within a certain period of time. If there is indeed another party claiming that the ledger entry is not the latest version, then the allocation in the latest version of the ledger entry provided by the party that needs to withdraw All assets in the plan will be confiscated to the other party who raises the challenge. If not, distribute according to the distribution plan in the latest version of the ledger entry provided by the party who needs to withdraw. In order to ensure transaction security, one of the two parties who needs to withdraw will get the allocated transaction block, and the other party will first get the allocated transaction block.
  • step S8 the receiving party among the transaction parties receives the transaction block through the blockchain to determine whether the transaction block continues to grow after a set number of blocks; if so, execute step S9 to determine that the transaction is valid, otherwise Continue to wait until it is determined whether the set number of blocks have been grown after the transaction block is determined.
  • the probability of successful attack decreases exponentially with the normal presentation of the specific number of the set number of blocks. After the probability of successful attack is determined, the specific number of the set number of blocks can be calculated.
  • this step is described in detail as follows.
  • the attacker of the blockchain cannot create value out of thin air or plunder the digital currency of other accounts. The only thing you can do is to change your transaction information, which is equivalent to taking back the money you paid to others. For example, an attacker can post a transaction to the payee. After seeing the transaction, the payee sends the goods to the attacker or performs other agreements or triggers other transactions. When the attacker confirms the delivery of the goods or other agreements After it has been fulfilled or other transactions have been triggered, the attacker creates a fork on the main chain and pays the money to another address on the fork block.
  • a success event is defined as the honest chain being extended by one block, making its lead +1, while a failure event is the attacker's chain being extended by one block, making the gap -1.
  • a the probability that the honest chain increases by one block
  • b the probability that the attacker chain increases by one block
  • Cz the probability that the attacker catches up with z block gaps
  • a the probability of adding a block to the honest chain
  • the computing power of the entire network is greater than the computing power of the attacker, so a>b, then the probability of successful attack decreases exponentially due to the increase in the number of blocks, and the attacker's chance of success becomes smaller and smaller as time goes by.
  • the main chain is longer and generates m blocks, it is safe for the payee to confirm receipt of the information and send out the goods, that is, the transfer information is difficult to tamper with. How many blocks to wait, then we consider how long a payee needs to wait to be confident enough that the payer has difficulty changing the transaction. Assuming a relatively honest chain, the potential progress of the attack chain is a Poisson distribution, and the expected value of the distribution is:
  • Fig. 4 is an exemplary illustration of a transaction using a lightning network according to a preferred embodiment of the present invention.
  • step 1 both Alice and Bob each took out 0.5 BTC to construct Funding Tx, and the output was the 2/2 multi-signature of Alice and Bob. At this time, Funding Tx is not signed, let alone broadcast.
  • Alice constructs Commitment Tx: C1a and RD1a, and hands them to Bob for signature.
  • the first output of C1a is a multi-signature address, Alice's other private key Alice 2 and Bob's 2/2 multi-signature, and the second output is Bob 0.5BTC. 3.
  • RD1a is the first spending transaction output by C1a, which is output to Alice 0.5BTC, but this type of transaction has a sequence, which prevents the current transaction from entering the block, and can enter the block only when the forward transaction has sequence confirmations.
  • Bob constructs Commitment Tx: C1b and RD1b, and hands them to Alice for signature. The structure is symmetrical with C1a and RD1a. 5.
  • Bob signs C1a and RD1a, and gives the signature to Alice; in the same way, Alice signs C1b and RD1b, and gives it to Bob after completion. At this time, since Funding Tx has not been signed, neither party can do evil, nor will any party lose any money. 6. After both parties have completed signing and exchanging commitment Tx, they will sign Funding Tx and exchange. At this time, Funding Tx is a complete transaction, which is broadcast.
  • Implementing the blockchain transaction method of the present invention can realize lightning-fast blockchain payment without worrying about blocking the confirmation time. This is because the blockchain stateless contract enforces security without creating blockchain transactions for personal payments.
  • the payment speed is measured in milliseconds. And has a very high scalability, which can process millions to billions of transactions per second on the network. Capacity has blown away the traditional payment track by many orders of magnitude. Pay per action/click can now be attached without a custodian. And it can achieve extremely low fees through transactions and settlement of blockchain off-chains, so that emerging use cases such as instant micropayments can be realized.
  • Fig. 5 is a flowchart of the third embodiment of the blockchain transaction method of the present invention.
  • the business device of the first transaction party receives the first party transaction data information, generates the first blockchain ID value based on the first party transaction data information according to the set rules, and The transaction data information of the first party is sent to the business device of the second transaction party, and the business device of the second transaction party generates a second blockchain ID value based on the transaction data information of the first party according to the same set rules.
  • the business device of the first transaction party receives the data information of the first transaction party from the internal information network of the first transaction party; the business device of the first transaction party is based on the The transaction data information of the first party generates the first blockchain ID value according to the set rules and stores the first blockchain ID value in the business device of the first transaction party; the business device of the first transaction party will The transaction data information of the first party is sent to the business device of the second transaction party in a message; the business device of the second transaction party generates a second transaction based on the transaction data information of the first party according to the same set rules. Blockchain ID value.
  • the first transaction party data information is a single piece of real-time transaction data and includes: transaction time, transaction amount, transaction transfer party and transaction transfer party.
  • the first transaction party and the second transaction party are only for distinguishing the two parties to the transaction, and any transaction party can be the first transaction party or the second transaction party.
  • the first-party transaction data information includes multiple transaction data within a set time period, and each transaction data includes transaction time, transaction amount, transaction transfer-out party and transaction transfer-in party.
  • the first block chain ID value and the second block chain ID value may also include multiple sets of block chain ID values.
  • ICBC 622230************
  • a transfer operation was performed, the transfer amount was 100 yuan, and the transfer time was 2019-9-23, 20:23.
  • ICBC is the first business party and the Agricultural Bank is the second business party.
  • the ICBC business device will receive this transfer operation information through the internal network, that is, the first transaction party data information, which includes the transaction time, transaction amount, transaction transferer account number, and transaction transferee account number. Subsequently, the first transaction party data information can be generated according to the set rules to generate the first blockchain ID value.
  • the data of the transaction party can be extracted according to a specific rule to a binary value of any length, and then mapped into a binary value of a fixed length, for example, using the MD5 algorithm. Any known extraction algorithm and mapping method in the art can be used in the present invention.
  • the ICBC business device For each transaction time, transaction amount, transaction transferor account number, and transaction transferee account of each transaction party’s data information can be extracted in accordance with the above methods to generate the first time associated value, the first amount associated value, The first transfer-out party related value and the first transfer-in party related value, the second time related value, the second amount related value, the second transfer-out party related value, and the second transfer-in party related value.
  • the ICBC business device After the ICBC business device generates the first blockchain ID value, it is stored in the internal memory.
  • the first blockchain ID value includes a first time related value, a first amount related value, a first transfer-out party related value, and a first transfer-in party related value.
  • the Agricultural Bank of China can also receive the data information of the first transaction party through the public network.
  • the business device of the Agricultural Bank of China will use the same algorithm and the same rule to generate the second blockchain ID value based on the data information of the first transaction party.
  • the second blockchain ID value includes a second time related value, a second amount related value, a second transfer-out party related value, and a second transfer-in party related value. Since the algorithms and rules are the same, if there is no problem in the accounts, the first blockchain ID value and the second blockchain ID value should be the same, or conform to the set rules. Specifically, those skilled in the art can make settings according to actual needs.
  • step S2 the first blockchain ID value is written into the first blockchain node, and transmitted to the second blockchain node through the blockchain P2P network.
  • the business device of the first transaction party can initiate a chain entry request, block link income chain request, and complete consensus on the block chain.
  • Blockchain is a peer-to-peer network with a decentralized open ledger; for example, the structure of Bitcoin and the structure of Ethereum rely on a distributed shared network to exist among users. Each user has his own public ledger that records every transaction, and based on the application of the network structure, it can be assured that it is correct when checking transaction records with other users.
  • the second blockchain node will receive the first blockchain ID value.
  • the second blockchain node may be any node on the blockchain, and the difference is that it is always monitored by the business device of the second transaction party.
  • step S3 the business device of the second transaction party monitors the second blockchain node to obtain the first blockchain ID value.
  • the business device of the second transaction party can communicate with the second blockchain node in any manner, thereby safely obtaining the first blockchain ID value.
  • step S4 the first blockchain ID value and the second blockchain ID value can be compared for reconciliation.
  • different comparisons can be made according to different rules. For example, in the case where the data information of the first transaction party is a single piece of real-time transaction data, the time-related value, the amount-related value, and the value of the first block chain ID value and the second block chain ID value can be compared in sequence. The transfer-out party's associated value and transfer-in party's associated value, and an error will be reported when any set of values fails.
  • the reconciliation is deemed successful.
  • each value is returned to query.
  • the method of implementing the blockchain transaction of the present invention ensures the authenticity and security of transaction details due to the advantages of the blockchain such as tamper-proof, high transparency and decentralization, and because only the business of the first transaction party is required
  • the first blockchain ID value generated by the device is written into the blockchain once, and the business device of the second transaction party obtains and reconciles it by monitoring, so the whole process is simple and efficient. Further, a single piece of real-time transaction data can be reconciled in real time, or multiple transactions within a certain period of time can be periodically batch reconciled, so the reconciliation time is flexible.
  • Fig. 6 is a flowchart of the steps of real-time reconciliation of a single transaction data in the fourth embodiment of the blockchain transaction method of the present invention.
  • the first transaction party data information is a single piece of real-time transaction data and includes: transaction time, transaction amount, transaction transfer-out party and transaction transfer-in party.
  • the first blockchain ID value includes a first time associated value, a first amount associated value, a first transfer-out party associated value, and a first transfer-in party associated value.
  • the second blockchain ID value includes a second time related value, a second amount related value, a second transfer-out party related value, and a second transfer-in party related value.
  • the generation and acquisition of the first blockchain ID value and the second blockchain ID value can refer to the embodiment shown in FIG.
  • step S1 the first time correlation value and the second time correlation value are compared, and if they are the same, step S2 is executed, otherwise, step S6 is executed.
  • step S2 the first amount associated value and the second amount associated value are compared, and if they are the same, step S3 is executed, otherwise, step S6 is executed.
  • step S3 the correlation value of the first transfer-out party is compared with the correlation value of the second transfer-out party, if they are the same, step S4 is executed, otherwise, step S6 is executed.
  • step S4 the first transfer-in party associated value and the second transfer-in party associated value are compared, if they are the same, step S5 is executed, otherwise, step S6 is executed.
  • step S5 the business device of the first transaction party and the business device of the second transaction party respectively display that the reconciliation is successful.
  • the business device of the first transaction party and the business device of the second transaction party respectively display the transaction data information of the first party and report an error.
  • the reconciliation is determined to be correct. Therefore, you can check whether these values are the same according to the actual situation, and determine whether the reconciliation is correct.
  • the judgment is made according to the sequence of the time-related value, the amount-related value, the transfer-out party's related value, and the transfer-in party's related value. In other preferred embodiments of the present invention, other options may be selected.
  • FIG. 7 is a method flowchart of a batch reconciliation step of multiple transaction data in the fourth embodiment of the blockchain transaction method of the present invention.
  • the first-party transaction data information includes multiple transaction data within a set time period, and each transaction data includes transaction time, transaction amount, transaction transfer-out party and transaction transfer-in party;
  • a blockchain ID value includes the first time correlation total value generated based on all transaction times, the first amount correlation total value generated based on all transaction amounts, the first transferer correlation total value generated based on all transaction transferors, and Based on the total associated value of the first transferee generated by all the transferees of the transaction, the first blockchain ID value further includes multiple first time associated values and multiple first amount associated values generated based on each transaction data , Multiple first transfer-out party associated values and multiple first transfer-in party associated values;
  • the second block chain ID value includes a second time associated total value generated based on all transaction time, and generated based on all transaction amount The second total amount of associated total value, the total associated value of the second transferer generated based on all
  • step S1 the first time correlation total value and the second time correlation total value are compared, if they are the same, step S2 is performed, otherwise step S6 is performed to traverse and compare the first time correlation value and the second time of each transaction data Correlation value and output transaction data with different first time correlation value and second time correlation value and report an error.
  • step S2 the first amount of associated total value and the second amount of associated total value are compared, if they are the same, step S3 is executed, otherwise step S7 is executed to traverse and compare the first amount associated value of each transaction data with the second amount associated value.
  • step S3 compare the total associated value of the first transfer-out party with the total associated value of the second transfer-out party, if they are the same, proceed to step S4, otherwise proceed to step S7 to traverse and compare the first transfer-out of each transaction data
  • the related value of the party and the related value of the second transferer are output, and the transaction data in which the related value of the first transferor and the related value of the second transferor are different are output and an error is reported.
  • step S4 compare the total associated value of the first transfer-in party and the total associated value of the second transfer-in party, if they are the same, proceed to step S5, otherwise proceed to step S7 to traverse and compare the first transfer-in of each transaction data
  • the related value of the party and the related value of the second transfer-in party and output the transaction data with different related values of the first transfer-in party and the related value of the second transfer-in party and report an error.
  • the business device of the first transaction party and the business device of the second transaction party respectively display that the reconciliation is successful.
  • the total value of the time correlation, the total value of the amount, the total value of the transferor's correlation, and the total value of the transferee's correlation can be calculated separately to compare the total value first.
  • the total value is not equal, the corresponding value of each transaction data is compared to find out the transaction data in question.
  • FIG. 8 is a schematic block diagram of a blockchain transaction system according to a preferred embodiment of the present invention.
  • the system includes a business device 100 of a first transaction party, a business device 200 of a second transaction party, and first and second areas that communicate with each other Block chain node devices 310, 320.
  • the business device 100 of the first transaction party is communicatively connected with each corresponding business terminal 101.
  • the service device of the second transaction party and its corresponding service terminal 201 are in communication connection.
  • the business device 100 of the first transaction party communicates with the first block chain node device 310, and the business device 200 of the second transaction party monitors the second block chain node device 320, the first and second blocks
  • the chain node devices 310 and 320 are set in the blockchain P2P network 300.
  • the business device 100 of the first transaction party, the business device 200 of the second transaction party, and the blockchain node devices 310 and 320 respectively include a memory and a processor.
  • the memory stores a computer program
  • the The processor implements the aforementioned blockchain transaction method when executing the computer program.
  • the present invention can be implemented by hardware, software or a combination of software and hardware.
  • the present invention can be implemented in a centralized manner in at least one computer system, or implemented in a decentralized manner by different parts distributed in several interconnected computer systems. Any computer system or other equipment that can implement the method of the present invention is applicable.
  • the combination of commonly used software and hardware can be a general computer system with a computer program installed, and the computer system is controlled by installing and executing the program to make it run according to the method of the present invention.
  • the present invention can also be implemented by a computer program product.
  • the program contains all the features capable of implementing the method of the present invention. When it is installed in a computer system, the method of the present invention can be implemented.
  • the computer program in this document refers to any expression of a set of instructions that can be written in any programming language, code, or symbol.
  • the instruction set enables the system to have information processing capabilities to directly implement specific functions, or to perform After one or two steps, a specific function is realized: a) conversion into other languages, codes or symbols; b) reproduction in a different format.

Abstract

A method, device and system for a blockchain transaction. The method comprises: configuring a lightning network on the basis of a stateless contract (S1); determining whether both parties of a transaction are on the same chain (S2); if so, using the lightning network to allocate a transaction block (S3); or if not, using another chain supporting the same encryption function to conduct the transaction via an atomic cross-chain swap (S4); and after completion of the transaction, the payee in the transaction confirming that the transaction is valid after elapse of a preset transaction block growth duration (S5). The method ensures transaction security while realizing high capacity and high speed blockchain transactions. The method further enables both parties of a transaction to perform reconciliation, and the entire reconciliation process is simple and highly efficient. Reconciliation can be performed in real time on a single piece of real-time transaction data, or batch reconciliation can be performed periodically on multiple pieces of transaction data within a certain period of time, such that reconciliation can be performed flexibly as required.

Description

一种区块链交易的方法、装置和系统Method, device and system for blockchain transaction 技术领域Technical field
本发明涉及区块链技术,更具体地说,涉及一种区块链交易的方法、装置和系统。The present invention relates to blockchain technology, and more specifically, to a method, device and system for blockchain transactions.
背景技术Background technique
区块链技术是利用块链式数据结构来验证与存储数据、利用分布式节点共识算法来生成和更新数据、利用密码学的方式保证数据传输和访问的安全、利用由自动化脚本代码组成的智能合约来编程和操作数据的一种全新的分布式基础架构与计算方式。然而,现有的区块链交易方法通常过于繁复,性能低下,成本高企,并且容易受到攻击,因此需要一种能够维护交易安全防止攻击的同时,又能够实现高容量和高速度的区块链交易的方法和装置。Blockchain technology uses block-chain data structures to verify and store data, uses distributed node consensus algorithms to generate and update data, uses cryptography to ensure the security of data transmission and access, and uses intelligence composed of automated script codes. A new distributed infrastructure and calculation method in which contracts are used to program and manipulate data. However, the existing blockchain transaction methods are usually too complicated, low performance, high cost, and vulnerable to attacks. Therefore, there is a need for a blockchain that can maintain transaction security and prevent attacks while achieving high capacity and high speed. Methods and devices for transactions.
进一步的,目前的银行对账系统,采用的是T+1对账机制(即T日的申购作业处理数据,需T+1日才能进行对账),交易流程多,资金链路长。并且其对账通常是以一方的账单为准,将双方一定时间内的全部账单进行核对。这种对账规则非常复杂,使得资金清结算的效率非常低。而且在核对过程中,数据的安全性难以得到保障,因此在出现争议或者账目出错时,很难判断是哪边的账目有问题,因此需要从源头进行核对,因此效率低下,且容易出错。Furthermore, the current bank reconciliation system adopts the T+1 reconciliation mechanism (that is, the purchase operation processing data on T day requires T+1 day to perform reconciliation), with many transaction processes and long capital links. And its reconciliation is usually based on one party's bill, and all the bills of both parties within a certain period of time are checked. This reconciliation rule is very complicated, making the efficiency of fund clearing and settlement very low. Moreover, during the verification process, the security of the data is difficult to guarantee. Therefore, when there is a dispute or an account error, it is difficult to determine which account has a problem. Therefore, it needs to be verified from the source, which is inefficient and error-prone.
发明内容Summary of the invention
本发明要解决的技术问题在于,针对现有技术的上述缺陷,提供一种区块链交易的方法和装置,其能够在维护交易安全的同时,实现高容量和高速度的区块链交易。The technical problem to be solved by the present invention is to provide a block chain transaction method and device for the above-mentioned defects of the prior art, which can realize high-capacity and high-speed block chain transactions while maintaining transaction security.
本发明解决其技术问题所采用的技术方案是:构造一种区块链交易的方法,包括:S1、基于无状态合同构造闪电网络;S2、判断交易双方是否在同 一条链上,如果是执行步骤S3,否则采用支持相同加密的其他链进行交叉链原子交换交易;S3、采用闪电网络进行交易区块的分配;S4、在交易结束之后,所述交易双方中的收款方等待交易区块生长设定时间之后再确认交易有效。The technical solution adopted by the present invention to solve its technical problems is: constructing a block chain transaction method, including: S1, constructing a lightning network based on a stateless contract; S2, judging whether the transaction parties are on the same chain, and if it is executed Step S3, otherwise use other chains that support the same encryption to perform cross-chain atomic swap transactions; S3, use the Lightning Network to allocate transaction blocks; S4, after the transaction ends, the recipient of the two parties waits for the transaction block After the growth set time, confirm the transaction is valid.
本发明解决其技术问题所采用的另一技术方案是:构造一种区块链交易的装置,所述装置包括:存储器;处理器,其用于存储指令,当所述指令被执行时使得所述处理器执行所述的区块链交易的方法。Another technical solution adopted by the present invention to solve its technical problem is to construct a block chain transaction device, the device includes: a memory; a processor, which is used to store instructions, when the instructions are executed The processor executes the blockchain transaction method.
本发明要解决的技术问题在于,针对现有技术的银行对账系统对账过程复杂、效率低下、安全性低需要隔天对账的缺陷,提供一种区块链交易的方法和系统,能够安全有效、简单高效地进行对账。The technical problem to be solved by the present invention is to provide a block chain transaction method and system in view of the complex reconciliation process, low efficiency, and low security of the prior art bank reconciliation system, which needs to be reconciled every other day. Safe, effective, simple and efficient reconciliation.
本发明解决其技术问题所采用的技术方案是:构造一种区块链交易的方法,包括:S1、第一交易方的业务装置接收第一方交易数据信息,基于所述第一方交易数据信息按照设定规则生成第一区块链ID值,并将所述第一方交易数据信息发送给第二交易方的业务装置,所述第二交易方的业务装置基于所述第一方交易数据信息按照相同设定规则生成第二区块链ID值;S2、将所述第一区块链ID值写入第一区块链节点,并通过区块链P2P网络传输到第二区块链节点;S3、所述第二交易方的业务装置监听所述第二区块链节点以获取所述第一区块链ID值;S4、比较所述第一区块链ID值和所述第二区块链ID值以进行对账。The technical solution adopted by the present invention to solve its technical problem is: constructing a blockchain transaction method, including: S1, the business device of the first transaction party receives first-party transaction data information, based on the first-party transaction data The information generates the first blockchain ID value according to the set rules, and sends the transaction data information of the first party to the business device of the second transaction party, and the business device of the second transaction party is based on the first party transaction The data information generates the second block chain ID value according to the same set rules; S2, writes the first block chain ID value to the first block chain node, and transmits it to the second block through the block chain P2P network S3, the business device of the second transaction party monitors the second blockchain node to obtain the first blockchain ID value; S4, compares the first blockchain ID value with the The second blockchain ID value for reconciliation.
本发明解决其技术问题所采用的又一技术方案是:构造一种区块链交易的系统,包括彼此通信的第一交易方的业务装置、第二交易方的业务装置以及各个区块链节点设备,所述第一交易方的业务装置与其对应的各个业务终端通信连接,所述第二交易方的业务装置与其对应的各个业务终端通信连接,所述第一交易方的业务装置、所述第二交易方的业务装置和所述区块链节点设备中分别包括存储器和处理器,所述存储器中存储计算机程序,所述处理器在执行所述计算机程序时执行时实施区块链交易的方法。Another technical solution adopted by the present invention to solve its technical problem is to construct a block chain transaction system, including the business device of the first transaction party, the business device of the second transaction party and each block chain node that communicate with each other The business device of the first transaction party is in communication connection with its corresponding business terminal, the business device of the second transaction party is in communication connection with its corresponding business terminal, the business device of the first transaction party, the The business device of the second transaction party and the blockchain node device respectively include a memory and a processor, the memory stores a computer program, and the processor implements a blockchain transaction when the computer program is executed. method.
实施本发明的区块链交易的方法和装置,其能够在维护交易安全的同时,实现高容量和高速度的区块链交易。进一步地,由于区块链的防篡改、高透明 及去中心化等优势,确保了交易明细的真实性及安全性,并且由于只需要将第一交易方生成的第一区块链ID值写入区块链一次,第二交易方通过监听的方式对其进行获取对账,就能在区块链交完成之后,实现交易双方的对账,整个对账过程简单高效。进一步的,可以对单条实时交易数据进行实时对账,也可以对一定时间内的多笔交易数据进行周期性批量对账,因此对账时间灵活。The method and device for implementing blockchain transactions of the present invention can realize high-capacity and high-speed blockchain transactions while maintaining transaction security. Furthermore, due to the advantages of the block chain such as tamper resistance, high transparency, and decentralization, the authenticity and security of the transaction details are ensured, and since only the first block chain ID value generated by the first transaction party needs to be written After entering the blockchain once, the second transaction party obtains reconciliation by monitoring it, and after the completion of the blockchain transaction, the reconciliation of both parties to the transaction can be realized. The entire reconciliation process is simple and efficient. Further, a single piece of real-time transaction data can be reconciled in real time, or multiple transactions within a certain period of time can be periodically batch reconciled, so the reconciliation time is flexible.
附图说明Description of the drawings
下面将结合附图及实施例对本发明作进一步说明,附图中:The present invention will be further described below in conjunction with the accompanying drawings and embodiments. In the accompanying drawings:
图1是本发明的区块链交易的方法的第一实施例的流程图;Figure 1 is a flowchart of the first embodiment of the blockchain transaction method of the present invention;
图2是本发明的区块链交易的方法的第二实施例的流程图;2 is a flowchart of the second embodiment of the blockchain transaction method of the present invention;
图3是本发明的优选实施例的闪电网络的侧链和主链锚定示意图;FIG. 3 is a schematic diagram of side chain and main chain anchoring of the lightning network according to the preferred embodiment of the present invention;
图4是本发明的优选实施例的采用区块链交易的方法进行交易的示意图;FIG. 4 is a schematic diagram of a transaction using a blockchain transaction method in a preferred embodiment of the present invention;
图5是本发明的区块链交易的方法的第三实施例的流程图;Figure 5 is a flowchart of the third embodiment of the blockchain transaction method of the present invention;
图6是本发明的区块链交易的方法的第四实施例的单条交易数据实时对账步骤的流程图;6 is a flowchart of the steps of real-time reconciliation of a single transaction data of the fourth embodiment of the blockchain transaction method of the present invention;
图7是本发明的区块链交易的方法的第四实施例的多条交易数据批量对账步骤的方法流程图;FIG. 7 is a method flowchart of a batch reconciliation step of multiple transaction data in the fourth embodiment of the blockchain transaction method of the present invention;
图8是本发明的优选实施例的区块链交易的系统的原理框图。Fig. 8 is a functional block diagram of a block chain transaction system according to a preferred embodiment of the present invention.
具体实施方式detailed description
为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。In order to make the objectives, technical solutions, and advantages of the present invention clearer, the following further describes the present invention in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present invention, but not to limit the present invention.
图1是本发明的区块链交易的方法的第一实施例的流程图。如图1所示,在步骤S1中,基于无状态合同构造闪电网络。闪电网络是一个分散系网络,其可以在区块链中使用无状态合同功能,进而实现交易双方的即时支付。在步骤S2中,判断交易双方是否在同一条链上。如果是的话,执行步骤S3,否则执行步骤S4。在步骤S3中,对于处于同一条链的交易双方,采用闪电网络进 行交易。采用闪电网络可以实现高吞吐、低延迟交易。在闪电网络中,只有路由节点参与交易,交易在网络中完全并行执行,因此随着节点增长,理论上吞吐量没有上限。闪电网络交易由支付通道保证安全性,可以实现即时交易而无需等待区块确认。在步骤S4中,对于处于不同条链的交易双方,采用支持相同加密的其他链进行交叉链原子交换交易。在本发明中,交叉链原子交换可以通过异构区块链共识规则立即在链外发生。只要链可以支持相同的加密哈希函数,就可以跨区块链进行交易,而不必信任第三方保管人。在步骤S5中,不管是对采用闪电网络进行的交易,还是对交叉链原子交换交易,在交易结束之后,所述交易双方中的收款方等待交易区块生长设定时间之后再确认交易有效。该确定时间可以根据实际希望获得的防止攻击的概率来进行计算,通常情况下,希望防止攻击的概率越高,需要等待的时间越长。当等待时间超过预定时间时,攻击者成功的几率就非常低了。本领域技术人员可以利用泊松分布进行计算。因此,实施本发明的区块链交易的方法,其能够在维护交易安全的同时,实现高容量和高速度的区块链交易。Fig. 1 is a flowchart of the first embodiment of the blockchain transaction method of the present invention. As shown in Figure 1, in step S1, a lightning network is constructed based on a stateless contract. The Lightning Network is a decentralized network that can use the stateless contract function in the blockchain to realize instant payment for both parties in the transaction. In step S2, it is judged whether the two parties in the transaction are on the same chain. If yes, go to step S3, otherwise go to step S4. In step S3, for both parties in the same chain, the Lightning Network is used to conduct transactions. The Lightning Network can achieve high throughput and low latency transactions. In the Lightning Network, only routing nodes participate in transactions, and transactions are executed in parallel in the network. Therefore, as the nodes grow, there is no upper limit in theoretical throughput. Lightning network transactions are secured by payment channels, which can realize instant transactions without waiting for block confirmation. In step S4, for both parties in different chains, other chains supporting the same encryption are used to perform cross-chain atomic exchange transactions. In the present invention, cross-chain atom exchanges can immediately occur outside the chain through heterogeneous blockchain consensus rules. As long as the chain can support the same cryptographic hash function, transactions can be made across blockchains without having to trust a third-party custodian. In step S5, whether it is a transaction using the Lightning Network or a cross-chain atomic swap transaction, after the transaction ends, the payee of the two parties in the transaction waits for the transaction block to grow for a set time before confirming that the transaction is valid . The determination time can be calculated according to the probability of preventing the attack that is actually desired to be obtained. Generally, the higher the probability of preventing the attack is desired, the longer the waiting time is. When the waiting time exceeds the predetermined time, the attacker's chance of success is very low. Those skilled in the art can use Poisson distribution for calculation. Therefore, implementing the blockchain transaction method of the present invention can realize high-capacity and high-speed blockchain transactions while maintaining transaction security.
图2是本发明的区块链交易的方法的第二实施例的流程图。在图2所示的优选实施例中,在步骤S1中,通过侧链抵押Token自建的方式将侧链接入闪电网络,并采用双向锚定的方式进入注册。图3是本发明的优选实施例的闪电网络的侧链和主链锚定示意图。在本实施例中,侧链采用抵押Token自建侧链的机制,通过双向锚定的设计,即时支付和较高的可扩展性,采用混合型的设计方案:“驱动链+公证人/侧链”方式来实现和比特币双向锚定。在步骤S2中,所述侧链采用托管方式或者联盟方式进行交易资产管理。在本优选实施例中,通过Wasm智能合约,扩展Token应用场景,提升Token的生态和价值,并可以通过展示每个侧链抵押代币数量以及管理地址与机构,公开透明管理侧链,相比主链运行DAPP,侧链的优点在于,每个独立的DAPP资源隔离,不会发生以太坊上,由于单个DAPP流量火爆,占用网络,导致使用其他DAPP的Gas费用上升,从安全的角度,主链部署DAPP,可能由于单个DAPP出现安全漏洞,如The DAO,导致整个以太坊网络回滚。Fig. 2 is a flowchart of the second embodiment of the blockchain transaction method of the present invention. In the preferred embodiment shown in FIG. 2, in step S1, the side chain is connected to the Lightning Network by means of self-built side chain mortgage Token, and the registration is entered in the manner of two-way anchoring. Fig. 3 is a schematic diagram of side chain and main chain anchoring of the lightning network according to the preferred embodiment of the present invention. In this embodiment, the side chain adopts the mechanism of mortgage Token self-built side chain, through the two-way anchoring design, instant payment and high scalability, and adopts a hybrid design scheme: "drive chain + notary/side "Chain" approach to achieve two-way anchoring with Bitcoin. In step S2, the side chain adopts a custody mode or an alliance mode for transaction asset management. In this preferred embodiment, the Wasm smart contract is used to expand the application scenarios of Token to enhance the ecology and value of the Token, and it is possible to openly and transparently manage the side chain by displaying the number of mortgage tokens for each side chain and the management address and organization. The main chain runs DAPP, and the advantage of the side chain is that each independent DAPP resource is isolated and does not occur on Ethereum. Due to the hot traffic of a single DAPP and occupying the network, the gas cost of using other DAPPs increases. From a security perspective, the main The deployment of DAPP on the chain may cause the entire Ethereum network to roll back due to a security vulnerability in a single DAPP, such as The DAO.
在本发明中,所述侧链采用托管方式进行交易资产管理包括将所述侧链的 资产发送到主链的托管方,在托管方接收到所述资产之后,在侧链激活相应的数字资产。在本发明的优选实施例中,将资产发送到主链的托管方,托管方收到相关资产信息后再侧链激活相应的数字资产,托管模式偏向于中心化,需要托管方提供信用背书。在本发明中,所述侧链采用联盟方式进行交易资产管理包括采用双向锚定技术将所述主链的资产转移到所述侧链,所述侧链采用托管方联盟的共识算法对所述资产进行确认,其中所述托管联盟的共识算法包括PBFT、PoS、PoA中的一种。进一步地,在本发明所述的区块链交易的方法中,所述侧链采用联盟方式进行交易资产管理进一步包括在主链对应锁定保证金以在所述侧链的联盟崩溃时保障所述侧链的资产。在本发明的优选实施例中,使用托管方联盟来取代单一托管方信用背书,采用双向锚定技术将主链资产转移到侧链,侧链使用托管方联盟的共识算法对数字资产进行确认,托管方的共识算法为PBFT、POS、POA其中的一种,侧链的安全依赖联盟的信用值得注意的是,虽然侧链以来侧链托管或联盟的信用背书,但在主链会有对应的锁定保证金机制,使得如果侧链信用联盟崩溃的时候,仍然可以使得侧链的用户资产得到保障,这与传统的侧链模式不同,是本发明的侧链创新的地方。在本发明的优选实施例中,可以侧链浏览器中展示每个侧链的抵押NBT数量,所有用户可以随时参考。In the present invention, the side chain adopts custody for transaction asset management including sending the assets of the side chain to the custodian of the main chain. After the custodian receives the assets, the corresponding digital assets are activated on the side chain. . In a preferred embodiment of the present invention, the asset is sent to the custodian of the main chain. After the custodian receives the relevant asset information, the side chain activates the corresponding digital asset. The custodial model tends to be centralized and requires the custodian to provide credit endorsement. In the present invention, the side chain adopts an alliance method for transaction asset management including the use of two-way anchoring technology to transfer the assets of the main chain to the side chain, and the side chain adopts the consensus algorithm of the custodian alliance to Assets are confirmed, and the consensus algorithm of the custody alliance includes one of PBFT, PoS, and PoA. Further, in the blockchain transaction method of the present invention, the side chain adopts an alliance method for transaction asset management further includes locking a deposit corresponding to the main chain to protect the side chain when the alliance of the side chain collapses. Chain assets. In the preferred embodiment of the present invention, the custodian alliance is used to replace the single custodian credit endorsement, and the two-way anchoring technology is used to transfer the main chain assets to the side chain. The side chain uses the consensus algorithm of the custodian alliance to confirm the digital assets. The consensus algorithm of the custodian is one of PBFT, POS, and POA. The security of the side chain relies on the credit of the alliance. It is worth noting that although the side chain custody or the credit endorsement of the alliance since the side chain, there will be a corresponding in the main chain The locking margin mechanism ensures that if the side chain credit alliance collapses, the user assets of the side chain can still be guaranteed. This is different from the traditional side chain model and is the innovation of the side chain of the present invention. In a preferred embodiment of the present invention, the amount of mortgage NBT for each side chain can be displayed in the side chain browser, and all users can refer to it at any time.
在步骤S3中,判断交易双方是否在同一条链上。如果是的话,执行步骤S5,否则执行步骤S4。在步骤S4中,对于处于不同条链的交易双方,采用支持相同加密的其他链进行交叉链原子交换交易。在本发明中,交叉链原子交换可以通过异构区块链共识规则立即在链外发生。只要链可以支持相同的加密哈希函数,就可以跨区块链进行交易,而不必信任第三方保管人。在步骤S5中,交易双方在区块链上创建一个分类账目条,其中预存设定金额到所述闪电网络中的微支付通道中并输出交易双方签名。在本实施例中,交易双方区块链上创建一个分类帐条目,要求两个参与者签署任何资金支出。双方创建的交易将分类账分录退还给各自的分配,但不会将其广播到区块链。在步骤S6中,交易双方在所述分类账目条中创建多个交易输出输入来更新所述分类账目条并输出交易双方签名。在产生交易时,交易双方可以从当前分类账目条中创建多个 交易输出输入来更新所述分类账目条中的各个交易方自己的分配。在步骤S7中,交易双方中需要提现的一方将最新版本的分类账目条写入区块链中,并按照所述最新版本的分类账目条中的分配方案进行分配。为了保证交易的快速和安全,在本发明中,只有最新版本的分类账目条才是有效的,这是由区块链可解析的智能合约脚本强制执行的。任何一方可以通过向区块链广播最新版本而无任何信任或监管,随时关闭此条目。由于采用了闪电网络创建分类账目条,可以在网络上找到类似于在Internet上路由数据包的路径。路径上的节点不受信任,因为使用脚本强制执行付款,该脚本通过递减时间锁来强制执行原子性(整个付款成功或失败)。而区块链作为仲裁者。因此,可以无限制地进行非区块链交易。可以通过对区块链可执行性的信心对交易进行交易。In step S3, it is judged whether both parties to the transaction are on the same chain. If yes, go to step S5, otherwise go to step S4. In step S4, for both parties in different chains, other chains supporting the same encryption are used to perform cross-chain atomic exchange transactions. In the present invention, cross-chain atom exchanges can immediately occur outside the chain through heterogeneous blockchain consensus rules. As long as the chain can support the same cryptographic hash function, transactions can be made across blockchains without having to trust a third-party custodian. In step S5, both parties of the transaction create a ledger entry on the blockchain, in which the set amount is pre-stored in the micro-payment channel in the lightning network and the signatures of both parties of the transaction are output. In this embodiment, a ledger entry is created on the blockchain of both parties to the transaction, and the two participants are required to sign any capital expenditures. The transactions created by both parties return the ledger entries to their respective distributions, but will not broadcast them to the blockchain. In step S6, both parties to the transaction create multiple transaction output inputs in the ledger entry to update the ledger entry and output signatures of both parties to the transaction. When a transaction is generated, both parties to the transaction can create multiple transaction outputs and inputs from the current ledger entry to update the distribution of each transaction party in the ledger entry. In step S7, one of the parties to the transaction who needs to withdraw cash writes the latest version of the ledger entry into the blockchain, and distributes it according to the distribution plan in the latest version of the ledger entry. In order to ensure the speed and safety of the transaction, in the present invention, only the latest version of the ledger entry is valid, which is enforced by the smart contract script parsed by the blockchain. Any party can close this entry at any time by broadcasting the latest version to the blockchain without any trust or supervision. Since the Lightning Network is used to create ledger entries, a path similar to routing data packets on the Internet can be found on the network. The nodes on the path are not trusted because a script is used to enforce payment, which enforces atomicity (the entire payment succeeds or fails) by decrementing the time lock. The blockchain acts as an arbiter. Therefore, non-blockchain transactions can be performed without restrictions. Transactions can be traded with confidence in the enforceability of the blockchain.
在本发明的优选实施例中,为了确保交易安全,交易双方中需要提现的一方将最新版本的分类账目条写入区块链中,并按照所述最新版本的分类账目条中的分配方案进行分配的步骤进一步包括以下步骤。交易双方中需要提现的一方将交易双方均签名的最新版本的分类账目条写入区块链中。判定一定时间内,是否有另一方提出该分类账目条并非为最新版本,如果确实有另一方提出该分类账目条并非为最新版本,那么需要提现的一方提供的最新版本的分类账目条中的分配方案中的全部资产罚没给提出质疑的所述另一方。如果没有的话,按照需要提现的一方提供的最新版本的分类账目条中的分配方案进行分配。为了确保交易安全,交易双方中需要提现的一方后获得分配的交易区块,另一方先获得分配的交易区块。In a preferred embodiment of the present invention, in order to ensure the security of the transaction, one of the parties to the transaction who needs to withdraw cash writes the latest version of the ledger entry into the blockchain, and executes it according to the distribution plan in the latest version of the ledger entry. The allocation step further includes the following steps. One of the two parties in the transaction who needs to withdraw cash will write the latest version of the ledger entry signed by both parties in the transaction into the blockchain. Determine whether there is another party claiming that the ledger entry is not the latest version within a certain period of time. If there is indeed another party claiming that the ledger entry is not the latest version, then the allocation in the latest version of the ledger entry provided by the party that needs to withdraw All assets in the plan will be confiscated to the other party who raises the challenge. If not, distribute according to the distribution plan in the latest version of the ledger entry provided by the party who needs to withdraw. In order to ensure transaction security, one of the two parties who needs to withdraw will get the allocated transaction block, and the other party will first get the allocated transaction block.
下面对步骤S5-S7中,对于处于同一条链的交易双方,采用闪电网络进行交易的原理说明如下。交易双方先预存一部分资金到“微支付通道”里,初始情况下双方的分配方案等于预存的金额。每次发生交易,需要对交易后产生资金分配结果共同进行确认,同时签字把旧版本的分配方案作废掉。任何一方需要提现时,可以将他手里双方签署过的交易结果写到区块链网络中,从而被确认。从这个过程中可以看到,只有在提现时候才需要通过区块链。任何一个版本的方案都需要经过双方的签名认证才合法。任何一方在任何时候都可以提出提现,提现时需要提供一个双方都签名过的资金分配方案(意味着肯定是某次交 易后的结果,被双方确认过,但未必是最新的结果)。在一定时间内,如果另外一方拿出证明表明这个方案其实之前被作废了(非最新的交易结果),则资金罚没给质疑方;否则按照提出方的结果进行分配。罚没机制可以确保了没人会故意拿一个旧的交易结果来提现。另外,即使双方都确认了某次提现,首先提出提现一方的资金到账时间要晚于对方,这就鼓励了链外实现交易。The following describes the principle of using the Lightning Network to conduct transactions for both parties in the same chain in steps S5-S7. Both parties to the transaction pre-deposit a part of the funds into the "micro-payment channel". Initially, the distribution plan of both parties is equal to the pre-deposited amount. Every time a transaction occurs, it is necessary to jointly confirm the result of the fund distribution after the transaction, and at the same time sign to invalidate the old version of the distribution plan. When any party needs to withdraw cash, it can write the transaction results signed by both parties in his hand to the blockchain network to be confirmed. From this process, we can see that only when withdrawing money does it need to go through the blockchain. Any version of the scheme needs to be signed by both parties to be legal. Any party can withdraw cash at any time. When withdrawing, it is necessary to provide a fund distribution plan signed by both parties (meaning it must be the result of a certain transaction, which has been confirmed by both parties, but may not be the latest result). Within a certain period of time, if the other party presents a certificate showing that this plan was actually invalidated before (not the latest transaction result), the funds will be fined and confiscated to the challenger; otherwise, the funds will be distributed according to the result of the proposing party. The confiscation mechanism ensures that no one will deliberately take an old transaction result to withdraw. In addition, even if both parties confirm a certain withdrawal, it is first proposed that the funds of the withdrawal party should arrive later than the other party, which encourages transactions outside the chain.
在步骤S8中,所述交易双方中的收款一方通过区块链接收交易区块判断该交易区块后是否继续生长了设定数量个区块;如果是则执行步骤S9确定交易有效,否则继续等待直到确定交易区块后是否继续生长了设定数量个区块。攻击成功的概率随着所述设定数量个区块的具体数量的正常呈现指数化下降,当确定攻击成功的概率之后,就可以计算所述设定数量个区块的具体数量。In step S8, the receiving party among the transaction parties receives the transaction block through the blockchain to determine whether the transaction block continues to grow after a set number of blocks; if so, execute step S9 to determine that the transaction is valid, otherwise Continue to wait until it is determined whether the set number of blocks have been grown after the transaction block is determined. The probability of successful attack decreases exponentially with the normal presentation of the specific number of the set number of blocks. After the probability of successful attack is determined, the specific number of the set number of blocks can be calculated.
在本发明的优选实施例中,对该步骤详细说明如下。本领域技术人员知悉。在默克尔树结构的约束下,区块链的攻击者,不能够凭空创造价值或者掠夺其它帐户的数字货币。唯一能够做的就是更改自己的交易信息,相当于把付给别人的钱再拿回来。举例来说,攻击者可以发布一笔交易给收款人,收款人看到这笔交易后,将货物发给攻击者或者履行其他协议或者触发其他交易,当攻击者确认货物发出或者其他协议已经履行或者其他交易已经触发之后,攻击者在主链上制造分叉,在分叉区块上把该笔钱付给自己的另一个地址,该攻击分叉链条如果能够超过当前主链的长度,矿工就会认为这个分叉是主链,而刚才包含给收款人的交易信息就被认为无效,从而实现付款后又将钱拿回来的结果。诚实链条和攻击者链条之间的竞赛,可以用二叉树随机漫步(Binomial Random Walk)来描述。成功事件定义为诚实链条延长了一个区块,使其领先性+1,而失败事件则是攻击者的链条被延长了一个区块,使得差距-1。a=诚实链条增加一个区块的概率b=攻击者链条增加一个区块的概率Cz=攻击者追赶上了z个区块差距的概率In a preferred embodiment of the present invention, this step is described in detail as follows. Those skilled in the art know. Under the constraints of the Merkel tree structure, the attacker of the blockchain cannot create value out of thin air or plunder the digital currency of other accounts. The only thing you can do is to change your transaction information, which is equivalent to taking back the money you paid to others. For example, an attacker can post a transaction to the payee. After seeing the transaction, the payee sends the goods to the attacker or performs other agreements or triggers other transactions. When the attacker confirms the delivery of the goods or other agreements After it has been fulfilled or other transactions have been triggered, the attacker creates a fork on the main chain and pays the money to another address on the fork block. If the attack fork chain can exceed the length of the current main chain , The miner will think that this fork is the main chain, and the transaction information just included to the payee is considered invalid, so as to achieve the result of getting the money back after payment. The race between the honest chain and the attacker chain can be described by Binomial Random Walk. A success event is defined as the honest chain being extended by one block, making its lead +1, while a failure event is the attacker's chain being extended by one block, making the gap -1. a = the probability that the honest chain increases by one block b = the probability that the attacker chain increases by one block Cz = the probability that the attacker catches up with z block gaps
a=诚实链条增加一个区块的概率a = the probability of adding a block to the honest chain
b=攻击者链条增加一个区块的概率Cz=攻击者追赶上了z个区块差距的概率b = the probability that the attacker's chain increases by one block Cz = the probability that the attacker catches up with z block gaps
Figure PCTCN2020070525-appb-000001
Figure PCTCN2020070525-appb-000001
全网算力大于攻击者的算力,所以a>b,那么攻击成功的概率就因为区块数的增长而呈现指数化下降,攻击者成功的机会随着时间的流逝越来越小。The computing power of the entire network is greater than the computing power of the attacker, so a>b, then the probability of successful attack decreases exponentially due to the increase in the number of blocks, and the attacker's chance of success becomes smaller and smaller as time goes by.
假定在自己的交易信息区块后边,主链又长了又生成了m个区块,收款人确认收到信息并发出货物才是安全的,即转帐信息是难以篡改的。去等待多少个区块那么我们考虑一个收款人需要等待多长时间,才能足够确信付款人已经难以更改交易了。假设相对诚实链条,攻击链条的潜在进展是一个泊松分布,分布的期望值为:Assuming that behind the own transaction information block, the main chain is longer and generates m blocks, it is safe for the payee to confirm receipt of the information and send out the goods, that is, the transfer information is difficult to tamper with. How many blocks to wait, then we consider how long a payee needs to wait to be confident enough that the payer has difficulty changing the transaction. Assuming a relatively honest chain, the potential progress of the attack chain is a Poisson distribution, and the expected value of the distribution is:
Figure PCTCN2020070525-appb-000002
Figure PCTCN2020070525-appb-000002
当此情形,为了计算攻击者追赶上的概率,我们将攻击者取得进展区块数量的泊松分布的概率密度,乘以在该数量下攻击者依然能够追赶上的概率。In this case, in order to calculate the probability of the attacker catching up, we multiply the probability density of the Poisson distribution of the number of blocks made by the attacker by the probability that the attacker can still catch up with this number.
Figure PCTCN2020070525-appb-000003
Figure PCTCN2020070525-appb-000003
化为如下形式,避免对无限数列求和:Converted to the following form, avoiding the sum of infinite series:
Figure PCTCN2020070525-appb-000004
Figure PCTCN2020070525-appb-000004
对其进行运算,我们可以得到如下的概率结果,发现概率F对m值呈指数下降。通过以上公式,就可以根据所需要的确定攻击成功的概率之后,就可以计算所述设定数量个区块的具体数量。通常可以将其设定为无限接近于0或者基于实际情况进行设定。Calculating it, we can get the following probability results, and find that the probability F decreases exponentially with respect to m. Through the above formula, after the probability of successful attack is determined according to the requirements, the specific number of the set number of blocks can be calculated. Usually it can be set to be infinitely close to 0 or set based on actual conditions.
图4是本发明的优选实施例的采用闪电网络进行交易的示例说明。如图4所示,在步骤1中,爱丽丝和鲍勃双方各拿出0.5BTC,构建Funding Tx,输出为爱丽丝和鲍伯的2/2多重签名。此时,Funding Tx未签名,更不广播。2、爱丽丝构造Commitment Tx:C1a和RD1a,并交给鲍伯签名。C1a的第一个输出为多重签名地址,爱丽丝的另一把私钥爱丽丝2和鲍伯的2/2多重签名,第二个输出为鲍伯0.5BTC。3、RD1a为C1a第一个输出的花费交易,输出给爱丽丝0.5BTC,但此类型交易带有sequence,作用是阻止当前交易进块,只 有前向交易有sequence个确认时才能进块。4、鲍伯构造Commitment Tx:C1b和RD1b,并交给爱丽丝签名。结构与C1a、RD1a是对称关系。5、鲍伯对C1a和RD1a进行签名,并将签名给爱丽丝;同理,爱丽丝对C1b和RD1b签名,完成后给鲍伯。此时,由于并未对Funding Tx进行签名,任何一方均无法作恶,任何一方也不会有任何损失。6、双方均完成对commitment Tx的签名并交换后,各自再对Funding Tx进行签名,并交换。此时,Funding Tx是完整的交易,广播之。Fig. 4 is an exemplary illustration of a transaction using a lightning network according to a preferred embodiment of the present invention. As shown in Figure 4, in step 1, both Alice and Bob each took out 0.5 BTC to construct Funding Tx, and the output was the 2/2 multi-signature of Alice and Bob. At this time, Funding Tx is not signed, let alone broadcast. 2. Alice constructs Commitment Tx: C1a and RD1a, and hands them to Bob for signature. The first output of C1a is a multi-signature address, Alice's other private key Alice 2 and Bob's 2/2 multi-signature, and the second output is Bob 0.5BTC. 3. RD1a is the first spending transaction output by C1a, which is output to Alice 0.5BTC, but this type of transaction has a sequence, which prevents the current transaction from entering the block, and can enter the block only when the forward transaction has sequence confirmations. 4. Bob constructs Commitment Tx: C1b and RD1b, and hands them to Alice for signature. The structure is symmetrical with C1a and RD1a. 5. Bob signs C1a and RD1a, and gives the signature to Alice; in the same way, Alice signs C1b and RD1b, and gives it to Bob after completion. At this time, since Funding Tx has not been signed, neither party can do evil, nor will any party lose any money. 6. After both parties have completed signing and exchanging commitment Tx, they will sign Funding Tx and exchange. At this time, Funding Tx is a complete transaction, which is broadcast.
由于C1a,C1b两笔交易花费的是同一个输出,故他们两个交易只有一个能进块。若爱丽丝广播C1a,则鲍伯立即拿到0.5BTC(C1a的第二个输出),而爱丽丝需要等C1a得到1000个确认,才能通过RD1a的输出拿到0.5BTC。另一方,若鲍伯广播C1b,则爱丽丝立即拿到0.5BTC,鲍伯等待C1b得到1000个确认,才能通过RD1b拿到0.5BTC。也就是说,单方广播交易终止合约的那一方会延迟拿到币,而另一放则立即拿币。Since the two transactions C1a and C1b spend the same output, only one of the two transactions can enter the block. If Alice broadcasts C1a, Bob immediately gets 0.5BTC (the second output of C1a), and Alice needs to wait for C1a to get 1,000 confirmations before getting 0.5BTC through the output of RD1a. On the other hand, if Bob broadcasts C1b, Alice immediately gets 0.5 BTC. Bob waits for C1b to get 1,000 confirmations before he can get 0.5 BTC through RD1b. In other words, the party that unilaterally broadcasts the transaction to terminate the contract will delay getting the coins, while the other party will get the coins immediately.
实施本发明的区块链交易的方法,可以实现闪电般快速的区块链支付,无需担心阻止确认时间。这是因为区块链无国籍合同强制执行安全性,而不为个人付款创建区块链交易。支付速度以毫秒为单位测量。并且具有很高的可扩展行,每秒可在网络上进行数百万到数十亿的事务处理。容量将传统支付轨道吹走了许多数量级。现在可以在没有托管人的情况下附加每次操作/点击付款。并且可以通过交易和解决区块外链实现极低的费用,从而可以实现即时小额支付等新兴用例。Implementing the blockchain transaction method of the present invention can realize lightning-fast blockchain payment without worrying about blocking the confirmation time. This is because the blockchain stateless contract enforces security without creating blockchain transactions for personal payments. The payment speed is measured in milliseconds. And has a very high scalability, which can process millions to billions of transactions per second on the network. Capacity has blown away the traditional payment track by many orders of magnitude. Pay per action/click can now be attached without a custodian. And it can achieve extremely low fees through transactions and settlement of blockchain off-chains, so that emerging use cases such as instant micropayments can be realized.
图5是本发明的区块链交易的方法的第三实施例的流程图。如图5所示,在步骤S1中,第一交易方的业务装置接收第一方交易数据信息,基于所述第一方交易数据信息按照设定规则生成第一区块链ID值,并将所述第一方交易数据信息发送给第二交易方的业务装置,所述第二交易方的业务装置基于所述第一方交易数据信息按照相同设定规则生成第二区块链ID值。在本发明的一个优选实施例中,所述第一交易方的业务装置从所述第一交易方的内部信息网络接收所述第一交易方数据信息;第一交易方的业务装置基于所述第一方交易数据信息按照设定规则生成第一区块链ID值并将所述第一区块链ID值存储在 所述第一交易方的业务装置中;第一交易方的业务装置将所述第一方交易数据信息以报文方式发送给所述第二交易方的业务装置;所述第二交易方的业务装置基于所述第一方交易数据信息按照相同设定规则生成第二区块链ID值。在本发明的优选实施例中,所述第一交易方数据信息为单条实时交易数据且包括:交易时间、交易金额、交易转出方和交易转入方。在本发明中,需要注意的是,第一交易方和第二交易方只是为了区分交易双方,任何交易方都可以作为第一交易方,也可以作为第二交易方。在本发明的优选实施例中,所述第一方交易数据信息包括设定时间周期内的多条交易数据,每条交易数据包括交易时间、交易金额、交易转出方和交易转入方。对应地,所述第一区块链ID值和所述第二区块链ID值也可以包括多组区块链ID值。Fig. 5 is a flowchart of the third embodiment of the blockchain transaction method of the present invention. As shown in Figure 5, in step S1, the business device of the first transaction party receives the first party transaction data information, generates the first blockchain ID value based on the first party transaction data information according to the set rules, and The transaction data information of the first party is sent to the business device of the second transaction party, and the business device of the second transaction party generates a second blockchain ID value based on the transaction data information of the first party according to the same set rules. In a preferred embodiment of the present invention, the business device of the first transaction party receives the data information of the first transaction party from the internal information network of the first transaction party; the business device of the first transaction party is based on the The transaction data information of the first party generates the first blockchain ID value according to the set rules and stores the first blockchain ID value in the business device of the first transaction party; the business device of the first transaction party will The transaction data information of the first party is sent to the business device of the second transaction party in a message; the business device of the second transaction party generates a second transaction based on the transaction data information of the first party according to the same set rules. Blockchain ID value. In a preferred embodiment of the present invention, the first transaction party data information is a single piece of real-time transaction data and includes: transaction time, transaction amount, transaction transfer party and transaction transfer party. In the present invention, it should be noted that the first transaction party and the second transaction party are only for distinguishing the two parties to the transaction, and any transaction party can be the first transaction party or the second transaction party. In a preferred embodiment of the present invention, the first-party transaction data information includes multiple transaction data within a set time period, and each transaction data includes transaction time, transaction amount, transaction transfer-out party and transaction transfer-in party. Correspondingly, the first block chain ID value and the second block chain ID value may also include multiple sets of block chain ID values.
下面用一个例子来进行说明。比如某个个人在工行的终端会员机上采用工行的A(622230************)卡向农行的B卡(62284************)进行了一笔转账操作,转账金额为100元,转账时间为2019-9-23,20:23。这时,工行作为第一业务方,而农行作为第二业务方。工行的业务装置将通过内部网络接收到这一笔转账操作信息,即第一交易方数据信息,其包含了交易时间、交易金额、交易转出方账号和交易转入方账号。随后,可以按照设定的规则,将这些第一交易方数据信息生成第一区块链ID值。本领域技术人员可以采用本领域中已知的任何方法生成这样的第一区块链ID值。例如,可以将交易方数据按照特定的规则提取任意长度的二进制值,然后将其映射成固定长度的二进制值,例如采用MD5算法等等。本领域中的任何已知提取算法和映射方式都可以用于本发明。对个每个交易方数据信息的每个交易时间、交易金额、交易转出方账号和交易转入方账号都可以按照以上方法进行提取,从而生成第一时间关联值、第一金额关联值、第一转出方关联值和第一转入方关联值、第二时间关联值、第二金额关联值、第二转出方关联值和第二转入方关联值。在工行的业务装置生成该第一区块链ID值后,将其存储在内部存储器中。在本实施例中,所述第一区块链ID值包括第一时间关联值、第一金额关联值、第一转出方关联值和第一转入方关联值。在此同时,农行作为第二业务方,同样可以通过公共网络,接收该第一交易方数据信息。这时,农行的业务装置将以同 样的算法,同样的规则基于该第一交易方数据信息生成第二区块链ID值。在本实施例中,所述第二区块链ID值包括第二时间关联值、第二金额关联值、第二转出方关联值和第二转入方关联值。由于算法和规则是相同的,因此在账目没有出现问题的情况下,第一区块链ID值和第二区块链ID值应该是相同的,或者说符合设定规则的。具体本领域技术人员可以根据实际需要进行设置。Let's use an example to illustrate. For example, an individual uses ICBC’s A (622230************) card on ICBC’s terminal member machine to ABC’s B card (62284************) A transfer operation was performed, the transfer amount was 100 yuan, and the transfer time was 2019-9-23, 20:23. At this time, ICBC is the first business party and the Agricultural Bank is the second business party. The ICBC business device will receive this transfer operation information through the internal network, that is, the first transaction party data information, which includes the transaction time, transaction amount, transaction transferer account number, and transaction transferee account number. Subsequently, the first transaction party data information can be generated according to the set rules to generate the first blockchain ID value. Those skilled in the art can use any method known in the art to generate such a first blockchain ID value. For example, the data of the transaction party can be extracted according to a specific rule to a binary value of any length, and then mapped into a binary value of a fixed length, for example, using the MD5 algorithm. Any known extraction algorithm and mapping method in the art can be used in the present invention. For each transaction time, transaction amount, transaction transferor account number, and transaction transferee account of each transaction party’s data information can be extracted in accordance with the above methods to generate the first time associated value, the first amount associated value, The first transfer-out party related value and the first transfer-in party related value, the second time related value, the second amount related value, the second transfer-out party related value, and the second transfer-in party related value. After the ICBC business device generates the first blockchain ID value, it is stored in the internal memory. In this embodiment, the first blockchain ID value includes a first time related value, a first amount related value, a first transfer-out party related value, and a first transfer-in party related value. At the same time, as the second business party, the Agricultural Bank of China can also receive the data information of the first transaction party through the public network. At this time, the business device of the Agricultural Bank of China will use the same algorithm and the same rule to generate the second blockchain ID value based on the data information of the first transaction party. In this embodiment, the second blockchain ID value includes a second time related value, a second amount related value, a second transfer-out party related value, and a second transfer-in party related value. Since the algorithms and rules are the same, if there is no problem in the accounts, the first blockchain ID value and the second blockchain ID value should be the same, or conform to the set rules. Specifically, those skilled in the art can make settings according to actual needs.
在步骤S2中,将所述第一区块链ID值写入第一区块链节点,并通过区块链P2P网络传输到第二区块链节点。在本发明的优选实施例中,首先所述第一交易方的业务装置可以发起入链请求,区块链接收入链请求,并在区块链上完成共识。然后将第一区块链ID值写入第一区块链节点,并在区块链P2P网络上广播。区块链为一对等网络,其去中心化的开放式账本;譬如比特币结构,以太坊结构,依赖于一分布式共享网络存在于各用户之间。每一用户拥有自己的公开账本都记录着每一笔交易,而基于应用在该网络结构上,可以作到确信其当检验与其他使用者交易记录时的正确性。如果想要改写区块链,需要对网络进行追踪式的分叉式攻击,并且即使对每一个对等网络用读写的存取方式,也无法提取充足的数据来改变已经放在区块链的交易记录。因此,将第一区块链ID写入区块链之后,其很难被更改。而区块链上的其余区块链节点将分别接收所述第一区块链ID值。这样,第二区块链节点将接收所述第一区块链ID值。在此,本领域技术人员知悉,该第二区块链节点可以是区块链上任何节点,其区别在于,一直被所述第二交易方的业务装置监听。In step S2, the first blockchain ID value is written into the first blockchain node, and transmitted to the second blockchain node through the blockchain P2P network. In a preferred embodiment of the present invention, first, the business device of the first transaction party can initiate a chain entry request, block link income chain request, and complete consensus on the block chain. Then write the first blockchain ID value to the first blockchain node and broadcast it on the blockchain P2P network. Blockchain is a peer-to-peer network with a decentralized open ledger; for example, the structure of Bitcoin and the structure of Ethereum rely on a distributed shared network to exist among users. Each user has his own public ledger that records every transaction, and based on the application of the network structure, it can be assured that it is correct when checking transaction records with other users. If you want to rewrite the blockchain, you need to carry out a tracking bifurcation attack on the network, and even if you use a read-write access method for each peer-to-peer network, you cannot extract enough data to change what is already on the blockchain. Transaction records. Therefore, after the first blockchain ID is written into the blockchain, it is difficult to change it. The remaining blockchain nodes on the blockchain will respectively receive the first blockchain ID value. In this way, the second blockchain node will receive the first blockchain ID value. Here, those skilled in the art know that the second blockchain node may be any node on the blockchain, and the difference is that it is always monitored by the business device of the second transaction party.
在步骤S3中,所述第二交易方的业务装置监听所述第二区块链节点以获取所述第一区块链ID值。在本发明的优选实施例中所述第二交易方的业务装置可以与所述第二区块链节点通过任何方式通信,从而安全获得所述第一区块链ID值。In step S3, the business device of the second transaction party monitors the second blockchain node to obtain the first blockchain ID value. In a preferred embodiment of the present invention, the business device of the second transaction party can communicate with the second blockchain node in any manner, thereby safely obtaining the first blockchain ID value.
在步骤S4中,可以比较所述第一区块链ID值和所述第二区块链ID值以进行对账。在本发明的优选实施例中,可以根据不同的规则进行不同的比较。比如对于所述第一交易方数据信息为单条实时交易数据的情况,可以依次比较所述第一区块链ID值和所述第二区块链ID值中的时间关联值、金额关联值、转出方关联值和转入方关联值,并且在任何一组值出现问题时报错。在本发明 的进一步的优选实施例中,在所述第一交易方数据信息包括多条实时交易数据的情况,可以分别计算时间关联总值、金额关联总值、转出方关联总值和转入方关联总值,只要总值均相同或符合设定规则,即认定会对账成功。当总值出现错误时,返回查询每个值。In step S4, the first blockchain ID value and the second blockchain ID value can be compared for reconciliation. In the preferred embodiment of the present invention, different comparisons can be made according to different rules. For example, in the case where the data information of the first transaction party is a single piece of real-time transaction data, the time-related value, the amount-related value, and the value of the first block chain ID value and the second block chain ID value can be compared in sequence. The transfer-out party's associated value and transfer-in party's associated value, and an error will be reported when any set of values fails. In a further preferred embodiment of the present invention, in the case where the first transaction party data information includes multiple pieces of real-time transaction data, the total value of time correlation, the total value of money, the total value of the transferor's correlation, and the transfer As long as the total value of the incoming party's association is the same or meets the set rules, the reconciliation is deemed successful. When there is an error in the total value, each value is returned to query.
实施本发明的区块链交易的方法,由于区块链的防篡改、高透明及去中心化等优势,确保了交易明细的真实性及安全性,并且由于只需要将第一交易方的业务装置生成的第一区块链ID值写入区块链一次,第二交易方的业务装置通过监听的方式对其进行获取对账,因此整个过程简单高效。进一步的,可以对单条实时交易数据进行实时对账,也可以对一定时间内的多笔交易数据进行周期性批量对账,因此对账时间灵活。The method of implementing the blockchain transaction of the present invention ensures the authenticity and security of transaction details due to the advantages of the blockchain such as tamper-proof, high transparency and decentralization, and because only the business of the first transaction party is required The first blockchain ID value generated by the device is written into the blockchain once, and the business device of the second transaction party obtains and reconciles it by monitoring, so the whole process is simple and efficient. Further, a single piece of real-time transaction data can be reconciled in real time, or multiple transactions within a certain period of time can be periodically batch reconciled, so the reconciliation time is flexible.
图6是本发明的区块链交易的方法的第四实施例的单条交易数据实时对账步骤的流程图。在该实施例中,所述第一交易方数据信息为单条实时交易数据且包括:交易时间、交易金额、交易转出方和交易转入方。所述第一区块链ID值包括第一时间关联值、第一金额关联值、第一转出方关联值和第一转入方关联值。所述第二区块链ID值包括第二时间关联值、第二金额关联值、第二转出方关联值和第二转入方关联值。在本实施例中,所述第一区块链ID值和所述第二区块链ID值的生成,获取均可以参照图1中所示的实施例,在此就不在累述了。因此,在进行对账时,在步骤S1中,比较所述第一时间关联值和所述第二时间关联值,如果相同则执行步骤S2,否则执行步骤S6。在步骤S2中,比较所述第一金额关联值和所述第二金额关联值,如果相同则执行步骤S3,否则执行步骤S6。在步骤S3中,比较所述第一转出方关联值和所述第二转出方关联值,如果相同则执行步骤S4,否则执行步骤S6。在步骤S4中,比较所述第一转入方关联值和所述第二转入方关联值,如果相同则执行步骤S5,否则执行步骤S6。在步骤S5中,所述第一交易方的业务装置和所述第二交易方的业务装置分别显示对账成功。在所述步骤S6中,所述第一交易方的业务装置和所述第二交易方的业务装置分别显示所述第一方交易数据信息并报错。Fig. 6 is a flowchart of the steps of real-time reconciliation of a single transaction data in the fourth embodiment of the blockchain transaction method of the present invention. In this embodiment, the first transaction party data information is a single piece of real-time transaction data and includes: transaction time, transaction amount, transaction transfer-out party and transaction transfer-in party. The first blockchain ID value includes a first time associated value, a first amount associated value, a first transfer-out party associated value, and a first transfer-in party associated value. The second blockchain ID value includes a second time related value, a second amount related value, a second transfer-out party related value, and a second transfer-in party related value. In this embodiment, the generation and acquisition of the first blockchain ID value and the second blockchain ID value can refer to the embodiment shown in FIG. 1, which will not be repeated here. Therefore, during the reconciliation, in step S1, the first time correlation value and the second time correlation value are compared, and if they are the same, step S2 is executed, otherwise, step S6 is executed. In step S2, the first amount associated value and the second amount associated value are compared, and if they are the same, step S3 is executed, otherwise, step S6 is executed. In step S3, the correlation value of the first transfer-out party is compared with the correlation value of the second transfer-out party, if they are the same, step S4 is executed, otherwise, step S6 is executed. In step S4, the first transfer-in party associated value and the second transfer-in party associated value are compared, if they are the same, step S5 is executed, otherwise, step S6 is executed. In step S5, the business device of the first transaction party and the business device of the second transaction party respectively display that the reconciliation is successful. In the step S6, the business device of the first transaction party and the business device of the second transaction party respectively display the transaction data information of the first party and report an error.
针对单条实时交易数据,当第一时间关联值、第一金额关联值、第一转出 方关联值和第一转入方关联值和第二时间关联值、第二金额关联值、第二转出方关联值和第二转入方关联值均相同时,认定对账正确。因此,可以根据实际情况,轮流查询这些数值是否相同,判定对账是否正确。虽然,在本实施例中,是依照时间关联值、金额关联值、转出方关联值和转入方关联值的顺序来进行判定的,在本发明的其他优选实施例中,还可以选择其他顺序,在此均落入本发明的保护范围。采用本实施例,可以对单条实时交易数据进行实时对账,缩短了资金在途时间及资金清算周期,提高了资金在交易期间的安全性。For a single piece of real-time transaction data, when the first time associated value, the first amount associated value, the first transferer's associated value, the first transferer's associated value and the second time associated value, the second amount of associated value, the second transfer When the associated value of the outgoing party and the associated value of the second transfer-in party are the same, the reconciliation is determined to be correct. Therefore, you can check whether these values are the same according to the actual situation, and determine whether the reconciliation is correct. Although, in this embodiment, the judgment is made according to the sequence of the time-related value, the amount-related value, the transfer-out party's related value, and the transfer-in party's related value. In other preferred embodiments of the present invention, other options may be selected. The sequence here falls within the protection scope of the present invention. With this embodiment, a single piece of real-time transaction data can be reconciled in real time, which shortens the time of funds in transit and the period of fund settlement, and improves the security of funds during the transaction.
图7是本发明的区块链交易的方法的第四实施例的多条交易数据批量对账步骤的方法流程图。在本实施例中,所述第一方交易数据信息包括设定时间周期内的多条交易数据,每条交易数据包括交易时间、交易金额、交易转出方和交易转入方;所述第一区块链ID值包括基于全部交易时间生成的第一时间关联总值、基于全部交易金额生成的第一金额关联总值、基于全部交易转出方生成的第一转出方关联总值以及基于全部交易转入方生成的第一转入方关联总值,所述第一区块链ID值进一步包括基于每条交易数据生成的多个第一时间关联值、多个第一金额关联值、多个第一转出方关联值和多个第一转入方关联值;所述第二区块链ID值包括基于全部交易时间生成的第二时间关联总值、基于全部交易金额生成的第二金额关联总值、基于全部交易转出方生成的第二转出方关联总值以及基于全部交易转入方生成的第二转入方关联总值,所述第二区块链ID值进一步包括基于每条交易数据生成的多个第二时间关联值、多个第二金额关联值、多个第二转出方关联值和多个第二转入方关联值。在本实施例中,所述第一区块链ID值和所述第二区块链ID值的生成,获取均可以参照图1中所示的实施例,在此就不在累述了。在步骤S1中比较所述第一时间关联总值和所述第二时间关联总值,如果相同则执行步骤S2,否则执行步骤S6遍历比较每个交易数据的第一时间关联值和第二时间关联值并输出所述第一时间关联值和第二时间关联值不同的交易数据并报错。在步骤S2中,比较所述第一金额关联总值和所述第二金额关联总值,如果相同则执行步骤S3,否则执行步骤S7遍历比较每个交易数据的第一金额关联值和第二金额关联值并输出所述第一金额关联值和第二金额关联值不同的交易数据并报错。在步骤 S3中,比较所述第一转出方关联总值和所述第二转出方关联总值,如果相同则执行步骤S4,否则执行步骤S7遍历比较每个交易数据的第一转出方关联值和第二转出方关联值并输出所述第一转出方关联值和第二转出方关联值不同的交易数据并报错。在步骤S4中,比较所述第一转入方关联总值和所述第二转入方关联总值,如果相同则执行步骤S5,否则执行步骤S7遍历比较每个交易数据的第一转入方关联值和第二转入方关联值并输出所述第一转入方关联值和第二转入方关联值不同的交易数据并报错。在步骤S5中,所述第一交易方的业务装置和所述第二交易方的业务装置分别显示对账成功。FIG. 7 is a method flowchart of a batch reconciliation step of multiple transaction data in the fourth embodiment of the blockchain transaction method of the present invention. In this embodiment, the first-party transaction data information includes multiple transaction data within a set time period, and each transaction data includes transaction time, transaction amount, transaction transfer-out party and transaction transfer-in party; A blockchain ID value includes the first time correlation total value generated based on all transaction times, the first amount correlation total value generated based on all transaction amounts, the first transferer correlation total value generated based on all transaction transferors, and Based on the total associated value of the first transferee generated by all the transferees of the transaction, the first blockchain ID value further includes multiple first time associated values and multiple first amount associated values generated based on each transaction data , Multiple first transfer-out party associated values and multiple first transfer-in party associated values; the second block chain ID value includes a second time associated total value generated based on all transaction time, and generated based on all transaction amount The second total amount of associated total value, the total associated value of the second transferer generated based on all transaction transferors, and the total associated value of the second transferee generated based on all transaction transferers, the second blockchain ID value It further includes multiple second time associated values, multiple second amount associated values, multiple second transfer-out party associated values, and multiple second transfer-in party associated values generated based on each transaction data. In this embodiment, the generation and acquisition of the first blockchain ID value and the second blockchain ID value can refer to the embodiment shown in FIG. 1, which will not be repeated here. In step S1, the first time correlation total value and the second time correlation total value are compared, if they are the same, step S2 is performed, otherwise step S6 is performed to traverse and compare the first time correlation value and the second time of each transaction data Correlation value and output transaction data with different first time correlation value and second time correlation value and report an error. In step S2, the first amount of associated total value and the second amount of associated total value are compared, if they are the same, step S3 is executed, otherwise step S7 is executed to traverse and compare the first amount associated value of each transaction data with the second amount associated value. Amount-related value and output transaction data with different first amount-related value and second amount-related value and report an error. In step S3, compare the total associated value of the first transfer-out party with the total associated value of the second transfer-out party, if they are the same, proceed to step S4, otherwise proceed to step S7 to traverse and compare the first transfer-out of each transaction data The related value of the party and the related value of the second transferer are output, and the transaction data in which the related value of the first transferor and the related value of the second transferor are different are output and an error is reported. In step S4, compare the total associated value of the first transfer-in party and the total associated value of the second transfer-in party, if they are the same, proceed to step S5, otherwise proceed to step S7 to traverse and compare the first transfer-in of each transaction data The related value of the party and the related value of the second transfer-in party, and output the transaction data with different related values of the first transfer-in party and the related value of the second transfer-in party and report an error. In step S5, the business device of the first transaction party and the business device of the second transaction party respectively display that the reconciliation is successful.
在本实施例中,对于批量处理的情况,可以通过分别计算时间关联总值、金额总值、转出方关联总值以及转入方关联总值,从而先对总值进行比较,在总值相同时,就可以直接认定对账成功,从而简化了对账流程,实现了批量对账的简化。而在总值不等的情况下,才开始对各条交易数据的对应值进行比较,找出出问题的交易数据。In this embodiment, in the case of batch processing, the total value of the time correlation, the total value of the amount, the total value of the transferor's correlation, and the total value of the transferee's correlation can be calculated separately to compare the total value first. At the same time, you can directly determine that the reconciliation is successful, which simplifies the reconciliation process and realizes the simplification of batch reconciliation. When the total value is not equal, the corresponding value of each transaction data is compared to find out the transaction data in question.
图8是本发明的优选实施例的区块链交易的系统的原理框图,该系统包括彼此通信的第一交易方的业务装置100、第二交易方的业务装置200以及第一和第二区块链节点设备310、320。所述第一交易方的业务装置100与其对应的各个业务终端101通信连接。所述第二交易方的业务装置与其对应的各个业务终端201通信连接。所述第一交易方的业务装置100与第一区块链节点设备310通信,第二交易方的业务装置200监听所述第二区块链节点设备320,所述第一和第二区块链节点设备310、320设置在区块链P2P网络300中。所述第一交易方的业务装置100、所述第二交易方的业务装置200和所述区块链节点设备310、320中分别包括存储器和处理器,所述存储器中存储计算机程序,所述处理器在执行所述计算机程序时执行时实施前述区块链交易的方法。FIG. 8 is a schematic block diagram of a blockchain transaction system according to a preferred embodiment of the present invention. The system includes a business device 100 of a first transaction party, a business device 200 of a second transaction party, and first and second areas that communicate with each other Block chain node devices 310, 320. The business device 100 of the first transaction party is communicatively connected with each corresponding business terminal 101. The service device of the second transaction party and its corresponding service terminal 201 are in communication connection. The business device 100 of the first transaction party communicates with the first block chain node device 310, and the business device 200 of the second transaction party monitors the second block chain node device 320, the first and second blocks The chain node devices 310 and 320 are set in the blockchain P2P network 300. The business device 100 of the first transaction party, the business device 200 of the second transaction party, and the blockchain node devices 310 and 320 respectively include a memory and a processor. The memory stores a computer program, and the The processor implements the aforementioned blockchain transaction method when executing the computer program.
因此,本发明可以通过硬件、软件或者软、硬件结合来实现。本发明可以在至少一个计算机系统中以集中方式实现,或者由分布在几个互连的计算机系统中的不同部分以分散方式实现。任何可以实现本发明方法的计算机系统或其它设备都是可适用的。常用软硬件的结合可以是安装有计算机程序的通用计算机系统,通过安装和执行程序控制计算机系统,使其按本发明方法运行。Therefore, the present invention can be implemented by hardware, software or a combination of software and hardware. The present invention can be implemented in a centralized manner in at least one computer system, or implemented in a decentralized manner by different parts distributed in several interconnected computer systems. Any computer system or other equipment that can implement the method of the present invention is applicable. The combination of commonly used software and hardware can be a general computer system with a computer program installed, and the computer system is controlled by installing and executing the program to make it run according to the method of the present invention.
本发明还可以通过计算机程序产品进行实施,程序包含能够实现本发明方法的全部特征,当其安装到计算机系统中时,可以实现本发明的方法。本文件中的计算机程序所指的是:可以采用任何程序语言、代码或符号编写的一组指令的任何表达式,该指令组使系统具有信息处理能力,以直接实现特定功能,或在进行下述一个或两个步骤之后实现特定功能:a)转换成其它语言、编码或符号;b)以不同的格式再现。The present invention can also be implemented by a computer program product. The program contains all the features capable of implementing the method of the present invention. When it is installed in a computer system, the method of the present invention can be implemented. The computer program in this document refers to any expression of a set of instructions that can be written in any programming language, code, or symbol. The instruction set enables the system to have information processing capabilities to directly implement specific functions, or to perform After one or two steps, a specific function is realized: a) conversion into other languages, codes or symbols; b) reproduction in a different format.
虽然本发明是通过具体实施例进行说明的,本领域技术人员应当明白,在不脱离本发明范围的情况下,还可以对本发明进行各种变换及等同替代。另外,针对特定情形或材料,可以对本发明做各种修改,而不脱离本发明的范围。因此,本发明不局限于所公开的具体实施例,而应当包括落入本发明权利要求范围内的全部实施方式。Although the present invention is described through specific embodiments, those skilled in the art should understand that various changes and equivalent substitutions can be made to the present invention without departing from the scope of the present invention. In addition, various modifications can be made to the present invention for specific situations or materials without departing from the scope of the present invention. Therefore, the present invention is not limited to the disclosed specific embodiments, but should include all embodiments falling within the scope of the claims of the present invention.
以上所述仅为本发明的较佳实施例而已,并不用以限制本发明,凡在本发明的精神和原则之内所作的任何修改、等同替换和改进等,均应包含在本发明的保护范围之内。The above descriptions are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modification, equivalent replacement and improvement made within the spirit and principle of the present invention shall be included in the protection of the present invention. Within range.

Claims (17)

  1. 一种区块链交易的方法,其特征在于,包括A blockchain transaction method, characterized in that it includes
    S1、基于无状态合同构造闪电网络;S1. Construct a lightning network based on stateless contracts;
    S2、判断交易双方是否在同一条链上,如果是执行步骤S3,否则采用支持相同加密的其他链进行交叉链原子交换交易;S2. Judge whether the two parties to the transaction are on the same chain, if it is to perform step S3, otherwise use other chains that support the same encryption to perform cross-chain atomic exchange transactions;
    S3、采用闪电网络进行交易区块的分配;S3. Use the Lightning Network to distribute transaction blocks;
    S4、在交易结束之后,所述交易双方中的收款方等待交易区块生长设定时间之后再确认交易有效。S4. After the transaction ends, the payee of the two parties in the transaction waits for the growth of the transaction block for a set time before confirming that the transaction is valid.
  2. 根据权利要求1所述的区块链交易的方法,其特征在于,所述步骤S4进一步包括:The method of blockchain transaction according to claim 1, wherein the step S4 further comprises:
    S41、所述交易双方中的收款一方通过区块链接收交易区块,并判断该交易区块后是否继续生长了设定数量个区块;如果是则确定交易有效,否则继续等待。S41. The receiver of the two parties to the transaction receives the transaction block through the blockchain, and determines whether the transaction block continues to grow after a set number of blocks; if it is, the transaction is determined to be valid, otherwise it continues to wait.
  3. 根据权利要求2所述的区块链交易的方法,其特征在于,在所述步骤S41中,基于以下公式计算所述设定数量:The blockchain transaction method according to claim 2, characterized in that, in the step S41, the set number is calculated based on the following formula:
    Figure PCTCN2020070525-appb-100001
    Figure PCTCN2020070525-appb-100001
    其中
    Figure PCTCN2020070525-appb-100002
    a=诚实链条增加一个区块的概率b=攻击者链条增加一个区块的概率Cz=攻击者追赶上了z个区块差距的概率;m表示所述设定数量,F表示收款一方收到风险供给的概率。
    among them
    Figure PCTCN2020070525-appb-100002
    a = the probability of adding one block to the honest chain b = the probability of adding one block to the attacker's chain Cz = the probability of the attacker catching up with z block gaps; m represents the set number, and F represents the receiving party to receive To the probability of risk supply.
  4. 根据权利要求1-3中任意一项所述的区块链交易的方法,其特征在于,所述步骤S3进一步包括:The block chain transaction method according to any one of claims 1-3, wherein the step S3 further comprises:
    S31、交易双方在区块链上创建一个分类账目条,其中预存设定金额到所述闪电网络中的微支付通道中并输出交易双方签名;S31. Both parties to the transaction create a ledger entry on the blockchain, in which the set amount is pre-stored in the micro-payment channel in the lightning network and the signatures of both parties to the transaction are output;
    S32、交易双方在所述分类账目条中创建多个交易输出输入来更新所述分类账目条并输出交易双方签名;S32. Both parties to the transaction create multiple transaction output inputs in the ledger entry to update the ledger entry and output signatures of both parties to the transaction;
    S33、交易双方中需要提现的一方将最新版本的分类账目条写入区块链中,并按照所述最新版本的分类账目条中的分配方案进行交易区块的分配。S33. One of the parties to the transaction who needs to withdraw cash writes the latest version of the ledger entry into the blockchain, and distributes the transaction block according to the allocation plan in the latest version of the ledger entry.
  5. 根据权利要求4所述的区块链交易的方法,其特征在于,所述步骤S33进一步包括:The blockchain transaction method according to claim 4, wherein the step S33 further comprises:
    S331、交易双方中需要提现的一方将交易双方均签名的最新版本的分类账目条写入区块链中;S331. One of the two parties in the transaction who needs to withdraw cash writes the latest version of the ledger entry signed by both parties in the transaction into the blockchain;
    S332、判定一定时间内,是否有另一方提出该分类账目条并非为最新版本,如果是执行步骤S333,否则按照需要提现的一方提供的最新版本的分类账目条中的分配方案进行交易区块的分配;S332. Determine whether another party proposes that the ledger entry is not the latest version within a certain period of time. If step S333 is performed, otherwise the transaction block is executed according to the allocation plan in the latest version of the ledger entry provided by the party that needs to withdraw distribution;
    S333、需要提现的一方提供的最新版本的分类账目条中的分配方案中的全部交易区块罚没给提出质疑的所述另一方。S333. All transaction blocks in the distribution plan in the latest version of the ledger entry provided by the party that needs to withdraw are fined and confiscated to the other party that raises the challenge.
  6. 根据权利要求5所述的区块链交易的方法,其特征在于,在所述步骤S332中,交易双方中需要提现的一方后获得分配的交易区块,另一方先获得分配的交易区块。The block chain transaction method according to claim 5, characterized in that, in the step S332, one of the two parties in the transaction that needs to withdraw then obtains the allocated transaction block, and the other party first obtains the allocated transaction block.
  7. 根据权利要求1-3中任意一项所述的区块链交易的方法,其特征在于,所述步骤S1进一步包括:The blockchain transaction method according to any one of claims 1-3, wherein the step S1 further comprises:
    S11、通过侧链抵押Token自建的方式将侧链接入闪电网络,并采用双向锚定的方式进入注册;S11. Connect the side link to the Lightning Network through the side chain mortgage Token self-built method, and use the two-way anchoring method to enter the registration;
    S12、所述侧链采用托管方式或者联盟方式进行交易资产管理。S12. The side chain adopts custody mode or alliance mode for transaction asset management.
  8. 根据权利要求7所述的区块链交易的方法,其特征在于,所述侧链采用托管方式进行交易资产管理包括将所述侧链的资产发送到主链的托管方,在托管方接收到所述资产之后,在侧链激活相应的数字资产;所述侧链采用联盟方式进行交易资产管理包括采用双向锚定技术将所述主链的资产转移到所述侧链;所述侧链采用托管方联盟的共识算法对所述资产进行确认,在主链对应锁定保证金以在所述侧链的联盟崩溃时保障所述侧链的资产。The method of block chain transactions according to claim 7, wherein the side chain adopts custody for transaction asset management including sending the assets of the side chain to the custodian of the main chain, and the custodian receives After the asset, the corresponding digital asset is activated on the side chain; the side chain adopts an alliance to conduct transaction asset management including the use of two-way anchoring technology to transfer the assets of the main chain to the side chain; the side chain adopts The consensus algorithm of the custodian alliance confirms the assets, and locks the deposit corresponding to the main chain to protect the assets of the side chain when the alliance of the side chain collapses.
  9. 一种区块链交易的装置,所述装置包括:存储器;处理器,其用于存储指令,当所述指令被执行时使得所述处理器执行权利要求1-9中任一项所述的区块链交易的方法。A block chain transaction device, the device comprising: a memory; a processor, which is used to store instructions, when the instructions are executed, the processor executes any one of claims 1-9 Blockchain transaction method.
  10. 一种区块链交易的方法,其特征在于,包括:A blockchain transaction method, characterized in that it includes:
    S1、第一交易方的业务装置接收第一方交易数据信息,基于所述第一方交易数据信息按照设定规则生成第一区块链ID值,并将所述第一方交易数据信息发送给第二交易方的业务装置,所述第二交易方的业务装置基于所述第一方交易数据信息按照相同设定规则生成第二区块链ID值;S1. The service device of the first transaction party receives the transaction data information of the first party, generates the first blockchain ID value according to the set rules based on the transaction data information of the first party, and sends the transaction data information of the first party For the business device of the second transaction party, the business device of the second transaction party generates a second blockchain ID value based on the transaction data information of the first party according to the same set rules;
    S2、将所述第一区块链ID值写入第一区块链节点,并通过区块链P2P网络传输到第二区块链节点;S2. Write the first blockchain ID value to the first blockchain node, and transmit it to the second blockchain node through the blockchain P2P network;
    S3、所述第二交易方的业务装置监听所述第二区块链节点以获取所述第一区块链ID值;S3. The business device of the second transaction party monitors the second blockchain node to obtain the first blockchain ID value;
    S4、比较所述第一区块链ID值和所述第二区块链ID值以进行对账。S4. Compare the first block chain ID value and the second block chain ID value for reconciliation.
  11. 根据权利要求11所述的区块链交易的方法,其特征在于,所述步骤S1进一步包括:The blockchain transaction method according to claim 11, wherein the step S1 further comprises:
    S11、所述第一交易方的业务装置从所述第一交易方的内部信息网络接收所述第一交易方数据信息;S11. The business device of the first transaction party receives the data information of the first transaction party from the internal information network of the first transaction party;
    S12、第一交易方的业务装置基于所述第一方交易数据信息按照设定规则生成第一区块链ID值并将所述第一区块链ID值存储在所述第一交易方的业务装置中;S12. The business device of the first transaction party generates a first blockchain ID value according to a set rule based on the transaction data information of the first party and stores the first blockchain ID value in the first transaction party's Business device
    S13、第一交易方的业务装置将所述第一方交易数据信息以报文方式发送给所述第二交易方的业务装置;S13. The business device of the first transaction party sends the transaction data information of the first party to the business device of the second transaction party in a message;
    S14、所述第二交易方的业务装置基于所述第一方交易数据信息按照相同设定规则生成第二区块链ID值。S14. The business device of the second transaction party generates a second blockchain ID value based on the transaction data information of the first party according to the same set rules.
  12. 根据权利要求12所述的区块链交易的方法,其特征在于,所述步骤S2进一步包括:The blockchain transaction method according to claim 12, wherein the step S2 further comprises:
    S21、区块链接收入链请求,并在区块链上完成共识;S21. Block link income chain request, and complete consensus on the block chain;
    S22、将第一区块链ID值写入第一区块链节点,并在区块链P2P网络上广播;S22. Write the first blockchain ID value to the first blockchain node and broadcast it on the blockchain P2P network;
    S23、第二区块链节点接收所述第一区块链ID值。S23. The second blockchain node receives the first blockchain ID value.
  13. 根据权利要求13所述的区块链交易的方法,其特征在于,所述第一 交易方数据信息为单条实时交易数据且包括:交易时间、交易金额、交易转出方和交易转入方;所述第一区块链ID值包括第一时间关联值、第一金额关联值、第一转出方关联值和第一转入方关联值;所述第二区块链ID值包括第二时间关联值、第二金额关联值、第二转出方关联值和第二转入方关联值。The block chain transaction method according to claim 13, wherein the first transaction party data information is a single piece of real-time transaction data and includes: transaction time, transaction amount, transaction transfer-out party and transaction transfer-in party; The first blockchain ID value includes a first time associated value, a first amount associated value, a first transfer-out party associated value, and a first transfer-in party associated value; the second blockchain ID value includes a second Time related value, second amount related value, second transfer-out party related value, and second transfer-in party related value.
  14. 根据权利要求14所述的区块链交易的方法,其特征在于,所述步骤S4进一步包括The block chain transaction method according to claim 14, wherein the step S4 further comprises
    S41、比较所述第一时间关联值和所述第二时间关联值,如果相同则执行步骤S42,否则执行步骤S46;S41. Compare the first time correlation value and the second time correlation value, if they are the same, perform step S42, otherwise, perform step S46;
    S42、比较所述第一金额关联值和所述第二金额关联值,如果相同则执行步骤S43,否则执行步骤S46;S42. Compare the associated value of the first amount of money with the associated value of the second amount of money, if they are the same, execute step S43, otherwise execute step S46;
    S43、比较所述第一转出方关联值和所述第二转出方关联值,如果相同则执行步骤S44,否则执行步骤S46;S43. Compare the associated value of the first transfer-out party with the associated value of the second transfer-out party, if they are the same, execute step S44, otherwise, execute step S46;
    S44、比较所述第一转入方关联值和所述第二转入方关联值,如果相同则执行步骤S45,否则执行步骤S46;S44. Compare the associated value of the first transfer-in party with the associated value of the second transfer-in party, if they are the same, perform step S45, otherwise, perform step S46;
    S45、所述第一交易方的业务装置和所述第二交易方的业务装置分别显示对账成功;S45: The business device of the first transaction party and the business device of the second transaction party respectively display that the reconciliation is successful;
    S46、所述第一交易方的业务装置和所述第二交易方的业务装置分别显示所述第一方交易数据信息并报错。S46. The business device of the first transaction party and the business device of the second transaction party respectively display the transaction data information of the first party and report an error.
  15. 根据权利要求13所述的区块链交易的方法,其特征在于,所述第一方交易数据信息包括设定时间周期内的多条交易数据,每条交易数据包括交易时间、交易金额、交易转出方和交易转入方;所述第一区块链ID值包括基于全部交易时间生成的第一时间关联总值、基于全部交易金额生成的第一金额关联总值、基于全部交易转出方生成的第一转出方关联总值以及基于全部交易转入方生成的第一转入方关联总值,所述第一区块链ID值进一步包括基于每条交易数据生成的多个第一时间关联值、多个第一金额关联值、多个第一转出方关联值和多个第一转入方关联值;所述第二区块链ID值包括基于全部交易时间生成的第二时间关联总值、基于全部交易金额生成的第二金额关联总值、基于全部交易转出方生成的第二转出方关联总值以及基于全部交易转入方生成 的第二转入方关联总值,所述第二区块链ID值进一步包括基于每条交易数据生成的多个第二时间关联值、多个第二金额关联值、多个第二转出方关联值和多个第二转入方关联值。The block chain transaction method of claim 13, wherein the first-party transaction data information includes multiple transaction data within a set time period, and each transaction data includes transaction time, transaction amount, transaction The transfer-out party and the transaction transfer-in party; the first blockchain ID value includes the first time-related total value generated based on all transaction times, the first amount-related total value generated based on all transaction amounts, and the transfer-out based on all transactions The total associated value of the first transfer-out party generated by the party and the total associated value of the first transfer-in party generated based on all the transfer-in parties of the transaction. The first blockchain ID value further includes a plurality of first transfer-in parties generated based on each transaction data A time-related value, multiple first amount-related values, multiple first transfer-out party related values, and multiple first transfer-in party related values; the second blockchain ID value includes the first value generated based on the entire transaction time The total value of the second time association, the total value of the second amount of association generated based on the total transaction amount, the total value of the second transfer-out party generated based on all the transaction transferers, and the second transfer-in party relationship generated based on all the transaction transferees The total value of the second blockchain ID value further includes a plurality of second time-related values, a plurality of second amount-related values, a plurality of second transferor-related values, and a plurality of second time-related values generated based on each transaction data. 2. The associated value of the transfer-in party.
  16. 根据权利要求16所述的区块链交易的方法,其特征在于,所述步骤S4进一步包括:The block chain transaction method according to claim 16, wherein the step S4 further comprises:
    S41、比较所述第一时间关联总值和所述第二时间关联总值,如果相同则执行步骤S42,否则遍历比较每个交易数据的第一时间关联值和第二时间关联值并输出所述第一时间关联值和第二时间关联值不同的交易数据并报错;S41. Compare the first time correlation total value and the second time correlation total value, and if they are the same, perform step S42, otherwise, traverse and compare the first time correlation value and the second time correlation value of each transaction data and output all State the transaction data with different correlation values between the first time and the second time and report an error;
    S42、比较所述第一金额关联总值和所述第二金额关联总值,如果相同则执行步骤S43,否则遍历比较每个交易数据的第一金额关联值和第二金额关联值并输出所述第一金额关联值和第二金额关联值不同的交易数据并报错;S42. Compare the associated total value of the first amount and the associated total value of the second amount, if they are the same, perform step S43, otherwise traverse and compare the first amount associated value and the second amount associated value of each transaction data and output all State the transaction data with different correlation values between the first amount and the second amount and report an error;
    S43、比较所述第一转出方关联总值和所述第二转出方关联总值,如果相同则执行步骤S44,否则遍历比较每个交易数据的第一转出方关联值和第二转出方关联值并输出所述第一转出方关联值和第二转出方关联值不同的交易数据并报错;S43. Compare the total associated value of the first transferer with the total associated value of the second transferor, if they are the same, perform step S44, otherwise, compare the first transferor's associated value of each transaction data with the second The transferor's associated value and output the transaction data with the first transferor's associated value and the second transferor's associated value that are different and report an error;
    S44、比较所述第一转入方关联总值和所述第二转入方关联总值,如果相同则执行步骤S45,否则遍历比较每个交易数据的第一转入方关联值和第二转入方关联值并输出所述第一转入方关联值和第二转入方关联值不同的交易数据并报错;S44. Compare the total associated value of the first transfer-in party with the total associated value of the second transfer-in party, and if they are the same, perform step S45; otherwise, compare the first transfer-in party's associated value of each transaction data with the second The transfer-in party's associated value and output the transaction data with different related values of the first transfer-in party and the second transfer-in party and report an error;
    S45、所述第一交易方的业务装置和所述第二交易方的业务装置分别显示对账成功。S45. The business device of the first transaction party and the business device of the second transaction party respectively display that the reconciliation is successful.
  17. 一种区块链交易的系统,其特征在于,包括彼此通信的第一交易方的业务装置、第二交易方的业务装置以及各个区块链节点设备,所述第一交易方的业务装置与其对应的各个业务终端通信连接,所述第二交易方的业务装置与其对应的各个业务终端通信连接,所述第一交易方的业务装置、所述第二交易方的业务装置和所述区块链节点设备中分别包括存储器和处理器,所述存储器中存储计算机程序,所述处理器在执行所述计算机程序时执行时实施根据权利要求11-17中任意一项区块链交易的方法。A block chain transaction system, which is characterized in that it comprises a business device of a first transaction party, a business device of a second transaction party and each block chain node device that communicate with each other, and the business device of the first transaction party communicates with each other. Each corresponding business terminal is in communication connection, the business device of the second transaction party is in communication connection with each corresponding business terminal, the business device of the first transaction party, the business device of the second transaction party, and the block The chain node devices respectively include a memory and a processor, the memory stores a computer program, and the processor implements the method for blockchain transactions according to any one of claims 11-17 when executing the computer program.
PCT/CN2020/070525 2019-04-01 2020-01-06 Method, device and system for blockchain transaction WO2020199703A1 (en)

Applications Claiming Priority (6)

Application Number Priority Date Filing Date Title
CN201910257369.3 2019-04-01
CN201910257377.8 2019-04-01
CN201910257377.8A CN110084595A (en) 2019-04-01 2019-04-01 A kind of block chain method of commerce and device for preventing attack by lightning network
CN201910257369.3A CN110084594A (en) 2019-04-01 2019-04-01 A kind of block chain method of commerce and device by lightning network
CN201911289291.X 2019-12-13
CN201911289291.XA CN111127011B (en) 2019-12-13 2019-12-13 Transaction method, system and computer readable storage medium for checking based on blockchain

Publications (1)

Publication Number Publication Date
WO2020199703A1 true WO2020199703A1 (en) 2020-10-08

Family

ID=72664516

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/070525 WO2020199703A1 (en) 2019-04-01 2020-01-06 Method, device and system for blockchain transaction

Country Status (1)

Country Link
WO (1) WO2020199703A1 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112994892A (en) * 2020-12-17 2021-06-18 中国工商银行股份有限公司 Cross-chain interaction method, device and system and electronic equipment
US11651353B1 (en) * 2020-08-26 2023-05-16 Membrane Labs Inc. Platform for coordinated credit-based and non-custodial digital asset settlement
CN117333184A (en) * 2023-09-20 2024-01-02 金网络(北京)数字科技有限公司 Supply chain reconciliation method, system and storage medium based on blockchain

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106503995A (en) * 2016-11-17 2017-03-15 中国银行股份有限公司 A kind of data sharing method, source node, destination node and system
CN109032802A (en) * 2018-07-26 2018-12-18 国信优易数据有限公司 A kind of block catenary system and management method
CN109461076A (en) * 2018-10-09 2019-03-12 哈希(武汉)网络科技有限公司 A kind of block chain method of commerce
CN110084594A (en) * 2019-04-01 2019-08-02 杜晓楠 A kind of block chain method of commerce and device by lightning network
CN110084595A (en) * 2019-04-01 2019-08-02 杜晓楠 A kind of block chain method of commerce and device for preventing attack by lightning network
CN110400142A (en) * 2018-06-01 2019-11-01 腾讯科技(深圳)有限公司 Data processing method, device and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106503995A (en) * 2016-11-17 2017-03-15 中国银行股份有限公司 A kind of data sharing method, source node, destination node and system
CN110400142A (en) * 2018-06-01 2019-11-01 腾讯科技(深圳)有限公司 Data processing method, device and storage medium
CN109032802A (en) * 2018-07-26 2018-12-18 国信优易数据有限公司 A kind of block catenary system and management method
CN109461076A (en) * 2018-10-09 2019-03-12 哈希(武汉)网络科技有限公司 A kind of block chain method of commerce
CN110084594A (en) * 2019-04-01 2019-08-02 杜晓楠 A kind of block chain method of commerce and device by lightning network
CN110084595A (en) * 2019-04-01 2019-08-02 杜晓楠 A kind of block chain method of commerce and device for preventing attack by lightning network

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11651353B1 (en) * 2020-08-26 2023-05-16 Membrane Labs Inc. Platform for coordinated credit-based and non-custodial digital asset settlement
CN112994892A (en) * 2020-12-17 2021-06-18 中国工商银行股份有限公司 Cross-chain interaction method, device and system and electronic equipment
CN112994892B (en) * 2020-12-17 2023-06-09 中国工商银行股份有限公司 Cross-chain interaction method, device, system and electronic equipment
CN117333184A (en) * 2023-09-20 2024-01-02 金网络(北京)数字科技有限公司 Supply chain reconciliation method, system and storage medium based on blockchain

Similar Documents

Publication Publication Date Title
US20220084020A1 (en) System and method for scaling blockchain networks with secure off-chain payment hubs
US10965446B2 (en) Blockchain-based automated user matching
US11669811B2 (en) Blockchain-based digital token utilization
AU2018347195B2 (en) System and method for information protection
US11282325B2 (en) System and method for information protection
EP3549303B1 (en) System and method for information protection
AU2018347196B2 (en) System and method for information protection
KR102050129B1 (en) Block chain supporting multiple one-way functions used for verification of blocks
US10423938B1 (en) Identifying negotiable instrument fraud using distributed ledger systems
US10262321B1 (en) Digital coin, digital wallet, and model of transaction
US20170221053A1 (en) Digital asset conversion
WO2020199703A1 (en) Method, device and system for blockchain transaction
US20170032365A1 (en) Crypto-currency-based accrued value interoperability
WO2020106961A1 (en) Lightweight blockchain supported transaction platform with proof-of-two consensus and centralized identification management
US20200160328A1 (en) Lightweight blockchain supported transaction platform with digital bill optimizations and denominations
CN101652793A (en) Electronic money system and electronic money trading method
CN110084594A (en) A kind of block chain method of commerce and device by lightning network
Rubasinghe et al. Transaction verification model over double spending for peer-to-peer digital currency transactions based on blockchain architecture
Cao et al. Decentralized privacy-preserving netting protocol on blockchain for payment systems
CN110084595A (en) A kind of block chain method of commerce and device for preventing attack by lightning network
KR20210117731A (en) The blockchain-based transaction history confirmation system
Bharimalla et al. ANN based block chain security threat mechanism
US11361286B1 (en) Identifying negotiable instrument fraud using distributed ledger systems
De Silva et al. Profitable Fee Controller for Payment Channel Networks
US20230376949A1 (en) Validation computing entity node-staked digital asset-based interaction system

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: 20784779

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20784779

Country of ref document: EP

Kind code of ref document: A1