Background technique
Block chain be it is a kind of data block is combined into specific data structure in a manner of chain sequentially in time, and
General ledger is shared in the decentralization that can not be distorted He can not forge that is guaranteed in a manner of cryptography, can secure storage is simple, has
Precedence relationship, the data that can be verified in system.
Block chain has been applied to the multiple fields such as finance, medical treatment, education at present.Intelligent contract will be written in it using logic
In, it is then deployed on block chain.User sends a transaction to intelligent contract by its block chain account, triggers in contract
Logic executes corresponding operating, is finally completed practical business.Therefore account management is for block chain using extremely important.And
In some special scenes, multiple main bodys is needed to manage some account jointly, it is desirable that these main bodys possess identical control to account
Power, the main body participation for only meeting condition quantity can control account and send licit traffic, and single main body can not accomplish.
In order to realize that the target of multi-agent system account, a series of technologies are suggested.There are space occupancies for these technologies
High, versatility is not strong, participates in the defects of main body needs real-time online.This programme is one based on the block chain account pipe calculated in many ways
Reason method is equal to space occupancy with single main body account, has very strong versatility, and realize the " thresholding of account management
Change ", the online requirement of main body need to be participated in by reducing.Limit.
There are two types of the way to manages of current block chain multiagent account:
Multi-signature
Account executive and multiple client public key are bound, it is desirable to provide the corresponding digital signature of all these public keys is
It being capable of unlocking account.Detailed process:
1. the presenter that trades constructs transaction, it is then broadcast to other management subjects
2. after other receive transaction, being signed with the private key of oneself, and be broadcasted
3. being configured to complete to trade to send Schnorr signature after a main body is collected into all signatures
Basic thought is the public key by the public key " synthesis " of participant for a totality, and then each participant utilizes oneself
Private key make signature after, then this signature synthesized into overall signature, matched with overall public key.
The technical disadvantages of multi-signature:
1. space occupancy is high
2. transaction fee is high
3. poor fault tolerance, as long as soon as participant is not online, it is unable to complete signature.
4. poor compatibility does not support the block chain of intelligent contract or multi-signature script not to be available Schnorr signature
Technical disadvantages:
1. poor compatibility does not support ECDSA
2. all participants must be online simultaneously, poor fault tolerance.
Summary of the invention
In order to make up the defect on above-mentioned block chain account management, the present invention proposes a kind of block based on HTLC technology
Across the chain value exchange method of chain.
Its technical solution are as follows: a kind of across the chain value exchange method of block chain based on HTLC technology includes the following steps,
Arrange the interactive environment of block chain A and block chain B;
B chain proposes interaction request to A chain;
Interaction results are returned to B chain by A chain;
The interactive environment provisioning process includes:
Account executive disposes management agreement StoremanAdminSC in block chain A;
Management node StoremanGroup disposes groupBSC on B chain, is responsible for the value ValueB of trustship B chain, corresponding
Account is groupValueBAddr
Management node StoremanGroup disposes groupASC, the value of responsible trustship B chain tra nsfer to A chain in A chain
ValueAB, corresponding account are groupValueABAddr;
B chain negotiator desires to participate in the transfer service of B chain value, B chain contract address in StoremanAdminSC registration
GroupValueBSC, and pay value on a certain amount of block chain A as guarantee fund by regulation, StoremanAdminSC according to
The guarantee fund paid distributes corresponding WETH quota to groupValueABAddr;
The B chain includes: to A chain interactive step
User is behind StoremanAdminSC acquisition groupValueBSC contract address, from demesne in B chain network
Location UserBAddr sends the destination-address of the Hash (x), user of this time transaction on A chain to groupValueBSC
Quantity is v if StoremanGroup can provide x before window time by the amount v of UserAddrDest, injection value
ValueB be transferred to StoremanGroup account, StoremanGroup monitors have on oneself groupValueBSC contract
New transaction request, oneself transaction Hash (x), UserAddrDest, v are submitted to groupValueABSC, and reduce v number
The ValueAB quota of volume.If certain user can provide x before window time, the ValueAB that the amount of money is v is transferred to user's A chain
Destination-address UserAddrDest, user are informed on groupValueABSC after having transaction cochain relevant with oneself,
The x oneself possessed is disclosed to groupValueABSC and obtains the ValueAB exchanged, and StoremanGroup monitors oneself
GroupValueABSC has the x newly disclosed, is requested using the x of announcement to groupValueBSC contract, takes User trustship
ValueB;
Interaction results return B chain step is included: user by the A chain to be obtained from StoremanAdminSC
Behind groupValueABSC contract address, in A chain network from user A chain destination-address UserAddrDest to
GroupValueABSC sends the private address UserBAddr this time to trade Hash (x), user on B chain, transaction value quantity
v.If StoremanGroup can provide x before window time, the ValueAB that the amount of money is v is transferred to StoremanGroup
Account,
StoremanGroup monitors there is new transaction request on oneself groupValueABSC contract, uses
GroupBAddr account submits Hash (x), UserAddrDest, UserBAddr, v, locking to groupValueBSC
ValueB.If certain user can provide x before window time, the ValueB that the amount of money is v is transferred to user's B chain address
UserBAddr, user, which is informed on groupValueBSC, transaction cochain relevant with oneself, to groupValueBSC
The x for disclosing oneself obtains the ValueB exchanged, and StoremanGroup monitors that oneself groupValueBSC has and newly discloses
X is requested to groupValueABSC contract using the X of announcement, restores ValueAB quota.
Preferably, the interactive environment of the agreement block chain A and block chain B has also arranged StoremanGroup and exits stream
Journey,
The process, which includes: StoremanGroup, exits application to StoremanAdminSC sending,
StoremanAdminSC locks groupValueABSC;
StoremanGroup mentions back the value cash pledge on the block chain A of oneself, and StoremanAdminSC empties this
The ValueAB quota of group.
The groupValueABSC includes the intelligent contract on A chain, for generating, distributing, shift and managing B on A chain
Chain is worth equivalent ValueAB
The present invention compared with current block chain account management mode, the beneficial effect is that, the Hash that the present invention uses
Locking scheme can forgo, and fully meet the characteristics such as decentralization, transaction atomicity, high speed be convenient, and be not required to carry out chain
Soft bifurcated.And for traditional Hash locking mechanism, it may cause risk, i.e., on the time point that moment T arrives, A is initiating to remove
While returning coin, B broadcasts secret value S, may cause A and takes all interests, therefore the present invention sets regular hour window
Mouthful, prompt user not operate in Risk interval.In addition, the present invention is to establish HTLC on chain, all service logics are in chain
Upper completion, the separately foundation without chain lower channel.
Specific embodiment
The present invention is described further below in conjunction with embodiment
A kind of across the chain value exchange method of block chain based on HTLC technology, includes the following steps,
Arrange the interactive environment of block chain A and block chain B;
B chain proposes interaction request to A chain;
Interaction results are returned to B chain by A chain;
The interactive environment provisioning process includes:
Account executive disposes management agreement StoremanAdminSC in block chain A;
Management node StoremanGroup disposes groupBSC on B chain, is responsible for the value ValueB of trustship B chain, corresponding
Account is groupValueBAddr
Management node StoremanGroup disposes groupASC, the value of responsible trustship B chain tra nsfer to A chain in A chain
ValueAB, corresponding account are groupValueABAddr;
B chain negotiator desires to participate in the transfer service of B chain value, B chain contract address in StoremanAdminSC registration
GroupValueBSC, and pay value on a certain amount of block chain A as guarantee fund by regulation, StoremanAdminSC according to
The guarantee fund paid distributes corresponding WETH quota to groupValueABAddr;
The B chain includes: to A chain interactive step
User is behind StoremanAdminSC acquisition groupValueBSC contract address, from demesne in B chain network
Location UserBAddr sends the destination-address of the Hash (x), user of this time transaction on A chain to groupValueBSC
Quantity is v if StoremanGroup can provide x before window time by the amount v of UserAddrDest, injection value
ValueB be transferred to StoremanGroup account, StoremanGroup monitors have on oneself groupValueBSC contract
New transaction request, oneself transaction Hash (x), UserAddrDest, v are submitted to groupValueABSC, and reduce v number
The ValueAB quota of volume.If certain user can provide x before window time, the ValueAB that the amount of money is v is transferred to user's A chain
Destination-address UserAddrDest, user are informed on groupValueABSC after having transaction cochain relevant with oneself,
The x oneself possessed is disclosed to groupValueABSC and obtains the ValueAB exchanged, and StoremanGroup monitors oneself
GroupValueABSC has the x newly disclosed, is requested using the x of announcement to groupValueBSC contract, takes User trustship
ValueB;The groupValueABSC includes the intelligent contract on A chain, for generating, distributing, shift and managing B on A chain
Chain is worth equivalent ValueAB
Interaction results return B chain step is included: user by the A chain to be obtained from StoremanAdminSC
Behind groupValueABSC contract address, in A chain network from user A chain destination-address UserAddrDest to
GroupValueABSC sends the private address UserBAddr this time to trade Hash (x), user on B chain, transaction value quantity
v.If StoremanGroup can provide x before window time, the ValueAB that the amount of money is v is transferred to StoremanGroup
Account,
StoremanGroup monitors there is new transaction request on oneself groupValueABSC contract, uses
GroupBAddr account submits Hash (x), UserAddrDest, UserBAddr, v, locking to groupValueBSC
ValueB.If certain user can provide x before window time, the ValueB that the amount of money is v is transferred to user's B chain address
UserBAddr, user, which is informed on groupValueBSC, transaction cochain relevant with oneself, to groupValueBSC
The x for disclosing oneself obtains the ValueB exchanged, and StoremanGroup monitors that oneself groupValueBSC has and newly discloses
X is requested to groupValueABSC contract using the X of announcement, restores ValueAB quota.
Preferably, the interactive environment of the agreement block chain A and block chain B has also arranged StoremanGroup and exits stream
Journey,
The process, which includes: StoremanGroup, exits application to StoremanAdminSC sending,
StoremanAdminSC locks groupValueABSC;
StoremanGroup mentions back the value cash pledge on the block chain A of oneself, and StoremanAdminSC empties this
The ValueAB quota of group.
It illustrates below and detailed process of the invention is described further:
Steps are as follows to A chain tra nsfer value by B chain user Bob:
User Bob from StoremanAdminSC obtain groupValueBSC contract address after, in B chain network send across
Chain requests transaction
Tx=(UserBAddr, groupValueBSC, v, payload, sig_UserBAddr)
Payload=(' request ', UserAddrDest, Hash (x))
Step2 StoremanGroup monitors there is new across chain transaction request on groupValueBSC contract, then in A
Across chain carrying transaction is sent on chain
Tx=(StoremanGroup, groupValueABSC, 0, payload, sig_StoremanGroup)
Payload=(' request ', UserAddrDest, Hash (x), v)
GroupValueABSC reduces the ValueAB quota of v number in StoremanGroup.
Step3 user Bob is informed on groupValueABSC after having transaction cochain relevant with oneself, window time
Across chain value capture transaction is sent on inherent A chain
Tx=(UserAddrDest, groupValueABSC, 0, payload, sig_UserAddrDest)
Payload=(' release, Hash (x), x)
It is Hash (x) that groupValueABSC, which detects x cryptographic Hash, and the ValueAB of v number is distributed for UserAddrDest.
If being unable to complete above-mentioned transaction in window time, across chain application failure, groupValueBSC contract is on B chain by v number
ValueB give back in Bob account UserBAddr, groupValueABSC contract and give back the ValueAB quota of v number
StoremanGroup。
Step4 StoremanGroup monitoring obtains the x newly disclosed in groupValueABSC, and window time is interior in B chain
Send value capture transaction
Tx=(StorexanGroup, groupValueBSC, 0, payload, sig_StoremanGroup)
Payload=(' release, Hash (x), x)
It is Hash (x) that groupValueBSC, which detects x cryptographic Hash, then is transferred to the ValueB that quantity is v
StoremanGroup account groupBAddr.If being unable to complete above-mentioned transaction in window time, across chain application failure,
GroupValueBSC contract gives back the ValueB of v number to Bob account UserBAddr on B chain, and groupValueABSC is closed
The ValueAB for about deducting v number in UserAddrDest gives back StoremanGroup.
The step of value is redeemed B chain user Bob by A chain is as follows:
Step1 user Bob is sent out behind StoremanAdminSC acquisition groupValueABSC contract address in A chain network
Send redemption requests transaction
Tx=(UserAddrDest, groupValueABSC, 0, payload, sig_UserAddrDest)
Payload=(' refund ', UserBAddr, Hash (x), v)
GroupValueABSC contract reduces the valueAB of v number in UserAddrDest.
Step2 StoremanGroup monitors the redemption transaction request for having new on groupValueABSC contract, then in B
Across chain carrying transaction is sent on chain
Tx=(groupBAddr, groupValueBSC, v, payload, sig_groupBxddr)
Payload=(' refund ', UserBAddr, Hash (x))
Step3 user Bob, which is informed on groupValueBSC, relevant with oneself redemption transaction cochain, when window
The interior redemption value that sends on B chain obtains transaction
Tx=(UserBAddr, groupValueBSC, 0, payload, sig_UserBAddr)
Payload (' release ', Hash (x), x)
It is Hash (x) that groupValueBSC, which detects x cryptographic Hash, and the ValueB of v number is transferred to for UserBAddr.If window
It is unable to complete above-mentioned transaction in time, then redeems application failure, groupValueBSC contract is on B chain by v number
ValueB goes back to StoremanGroup account groupBAddr, groupValueABSC contract and gives back UserAddrDest account v
The ValueAB of number.
Step4StoremanGroup monitoring obtains the x newly disclosed in groupValueBSC, sends out in window time in A chain
Delivery volume obtains transaction
Tx=(StoremanGroup, groupValueABSC, 0, payloadsig_StoremanGroup)
Payload=(' release ', Hash (x), x)
The v number ValueAB quota of groupValueABSC contract recovery StoremanGroup.If nothing in window time
Method completes above-mentioned transaction, then redeems application failure, and groupValueBSC contract goes back to the ValueB of v number on B chain
StoremanGroup account groupBAddr, groupValueABSC contract gives back UserAddrDest account v number
ValueAB
The present invention compared with current block chain account management mode, the beneficial effect is that, the Hash that the present invention uses
Locking scheme can forgo, and fully meet the characteristics such as decentralization, transaction atomicity, high speed be convenient, and be not required to carry out chain
Soft bifurcated.
And for traditional Hash locking mechanism, it may cause risk, i.e., on the time point that moment T arrives, A is initiating to remove
While returning coin, B broadcasts secret value S, may cause A and takes all interests, therefore the present invention sets regular hour window
Mouthful, prompt user not operate in Risk interval.In addition, the present invention is to establish HTLC on chain, all service logics are in chain
Upper completion, the separately foundation without chain lower channel.
Above-mentioned technical proposal only embodies the optimal technical scheme of technical solution of the present invention, those skilled in the art
The principle of the present invention is embodied to some variations that some of them part may be made, belongs to the scope of protection of the present invention it
It is interior.