A method, device and storage medium for realizing cross-chain transactions of alliance chains
By introducing special accounts and smart contract mechanisms for middlemen, problems such as instability in performance, centralized processing and asset loss in alliance chain cross-chain transactions are solved, and efficient and secure cross-chain transaction atomicity is achieved.
Patent Information
- Application Number
- CN202210485677.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-06
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2042-05-06
AI Technical Summary
In the prior art, there are problems such as unstable performance, inconsistent centralized processing architecture, high system risks, large transaction delays and asset loss risks when implementing cross-chain transactions in alliance chains.
By introducing a special account of the middleman, participants negotiate cross-chain transaction requirements and generate pairing values. The middleman randomly generates secret values and calculates unlocked values. Participants generate and deploy smart contracts based on the unlocked values. The middleman checks the contract information and generates unlocked information. Participants call the contract to complete the transaction and delete secret values in the rollback mechanism to achieve atomicity.
This method avoids centralized risks, reduces transaction delays and asset loss risks, and realizes the atomicity and efficiency of cross-chain transactions.
Smart Images

Figure CN114782031B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of blockchain communication technology, and in particular to a method, device and storage medium for implementing cross-chain transactions of alliance chains. Background Art
[0002] In the existing technology, there are usually three ways to achieve cross-chain communication:
[0003] 1) Atomic swap: The transactions on two chains are packaged into one transaction at the same time, signed by both parties, and the transactions will only take effect at the same time. Individually packaged transactions are not allowed.
[0004] 2) Relay technology: Rely on the relay protocol to complete communication interconnection. The processing of relay communication can be through witnesses or through a new blockchain (relay chain).
[0005] 3) Hash lock: First, one party locks the asset through a hash lock, and exchanges the key with the other party while obtaining the other party’s assets. Then, the other party opens the hash lock within the valid time to obtain the asset, thereby completing the cross-chain transaction.
[0006] Among them, the atomic swap protocol has strict requirements on transaction conditions. It is difficult to guarantee performance under high-frequency transactions and when transactions are distributed. Relay technology, especially the witness mode, is a centralized processing architecture that is inconsistent with the multi-centralized architecture of blockchain. At the same time, assets will pass through witnesses, introducing additional system risks; the credibility and performance of the relay chain is also a complex issue in itself. Hash locking, high transaction delays, and the risk of losing assets.
[0007] In summary, each single implementation method has more or less technical problems, so it is necessary to find a method that can effectively avoid the above technical problems. Summary of the invention
[0008] The purpose of the present invention is to provide a method, device and storage medium for realizing cross-chain transactions of alliance chains, so as to solve the above-mentioned problems existing in the prior art.
[0009] In order to achieve the above object, the technical solution adopted by the present invention is as follows:
[0010] A method for implementing cross-chain transactions of alliance chains, comprising the following steps:
[0011] S1, Participant 1 and Participant 2 who use consortium chain A and consortium chain B to implement cross-chain transactions negotiate cross-chain transaction requirements through an intermediary and generate a pairing value P;
[0012] S2, selects one participant as the initiator of the transaction request, uses the alliance chain A or alliance chain B as the source chain, sends the cross-chain transaction request and the generated pairing value P to the middleman, and the middleman randomly generates a secret value s3, calculates h3 = Hash (P, s3), and sends h3 and the response information to the participant 2 of the alliance chain B to be traded and the participant 1 of the alliance chain A;
[0013] S3, Participant 1 and Participant 2 randomly generate secret values s1 and s2 respectively, and send them to the middleman, who calculates the unlocking value J according to the following calculation formula;
[0014] J = Hash(L1, R1), where L1 = Hash(s1, P), R1 = Hash(P, s2)
[0015] S4, the middleman sends the unlocking value J to participant 1 and participant 2, and the participants 1 and 2 respectively generate and deploy smart contract 1 and smart contract 2 based on the unlocking value J, and send them to the middleman at the same time;
[0016] S5, after the middleman captures smart contract 1 and smart contract 2, he checks the contract information and contract asset information. If the check passes, unlock information A and unlock information B are generated respectively, and the process goes to step S6; if the check fails, the asset rollback process is entered, and the cross-chain fails;
[0017] S6, Participant 1 and Participant 2 respectively obtain the unlocking information A and unlocking information B sent by the middleman, and call the smart contract of the transaction counterparty based on the obtained unlocking information, thereby completing the alliance chain cross-chain transaction process.
[0018] Preferably, the cross-chain transaction requirements in step S1 include but are not limited to any one of the source chain address, asset identification, asset quantity and transaction time of any alliance chain to be traded.
[0019] Preferably, before the middleman in step S2 randomly generates the secret value s3, it is necessary to verify online whether the cross-chain requirement is the same as the pairing value P, that is, whether the pairing value P is equal to the transaction information of the cross-chain transaction request. If they are not the same, the cross-chain transaction fails and the cross-chain transaction process is exited; if they are the same, the middleman randomly generates a secret value s3.
[0020] Preferably, in step S4, smart contract 1 or smart contract 2 includes at least 4 functions:
[0021] a)save(num, id): Participant 1 or Participant 2 deposits assets into the contract address, the asset quantity is num, and the asset chain identifier is id;
[0022] b) getNum(): Participant 1 or Participant 2 queries the contract balance;
[0023] c) release(input1,input2): used to release contract assets; if Hash(input1,input2) = unlock value 1, all contract assets will be transferred to the preset address 1 in the contract, and the contract will be destroyed;
[0024] d) call back (input): used to send contract assets to the counterparty user; if Hash (input) = unlock value 2, all contract assets will be transferred to the preset address 2 in the contract and the contract will be destroyed.
[0025] Preferably, after the middleman in step S5 captures smart contract 1 and smart contract 2, the contract information and contract asset information are checked, specifically including checking smart contract 1 and smart contract 2, wherein the checking process of smart contract 1 is as follows:
[0026] a) in the release(i nput1,i nput2) function, whether the preset unlocking value 1 is the unlocking value J calculated in step S4;
[0027] b) In the release(i nput1,i nput2) function, the preset address 1 is the address of participant 2 in alliance chain A, which is also the asset receiving address in the cross-chain transaction;
[0028] c) in the call back (input) function, whether the preset unlock value 2 is the secret value h3 generated in step S2;
[0029] d) In the call back (input) function, the preset address 2 is the address of participant 1 in consortium chain A, which is used to roll back the transaction and return the asset;
[0030] e) Call the getNum() function to check whether the asset identifier and asset quantity of alliance chain A in smart contract 1 correspond to the asset identifier and asset quantity of alliance chain A in step S1;
[0031] The inspection process of smart contract 2 is as follows:
[0032] a) in the release(i nput1,i nput2) function, whether the preset unlocking value 1 is the unlocking value J calculated in step S4;
[0033] b) In the release(i nput1,i nput2) function, whether the preset address 1 is the target chain address in the cross-chain information, that is, the address of participant 1 in alliance chain B, that is, the asset receiving address in the cross-chain transaction;
[0034] c) in the call back (input) function, whether the preset unlock value 2 is the secret value h3 generated in step S2;
[0035] d) In the call back (input) function, whether the preset address 2 is the target chain sending address in the cross-chain information, that is, the address of participant 2 in alliance chain B, which is used to roll back the transaction and return the asset address;
[0036] e) Call the getNum() function to check whether the asset identifier and asset quantity of alliance chain B in smart contract 2 correspond to the asset identifier and asset quantity of alliance chain B in step S1.
[0037] Preferably, the asset rollback process in step S5 includes the following steps:
[0038] The middleman destroys the received secret values s1 and s2, and sends the generated secret value s3 to Participant 1 and Participant 2;
[0039] Participant 1 calls the call back(input) method of smart contract 1, where input = s3, Hash(s3) = h3. The unlocking condition is met and the assets will be released to the source chain sending address, that is, the address of participant 1 in alliance chain A;
[0040] Similarly, when participant 2 calls the call back (input) method of smart contract 2, the assets will be released to the target chain sending address, that is, the address of participant 2 in alliance chain B;
[0041] The contract is automatically destroyed and the assets are transferred, which means the cross-chain transaction is rolled back.
[0042] Preferably, step S6 specifically includes: participant 1 calls the release(input1, input2) method of smart contract 2, where input1 == Hash(s1, P), input2 = R1; obviously, s1 is the secret value of participant 1, Hash(s1, P) = L1, Hash(L1, R1) = J, and the unlocking condition is met, and the assets will be released from smart contract 2 to the target chain address of participant 1;
[0043] Similarly, consortium chain B calls the release(input1,input2) method of smart contract 1, where input1=L1,input2=(s2,P)=R1, and the unlocking conditions are met. The assets will be released from smart contract 1 to the source chain address of participant 2.
[0044] Another object of the present invention is to provide a device for realizing cross-chain transactions of alliance chains, which device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the above-mentioned method of cross-chain transactions of alliance chains is realized.
[0045] The last object of the present invention is to provide a computer-readable storage medium having instructions stored thereon. When the instructions are executed on a terminal device, the terminal device executes the above-mentioned method for realizing cross-chain transactions of alliance chains.
[0046] The beneficial effects of the present invention are:
[0047] The present invention provides a method, device and storage medium for realizing cross-chain transactions of alliance chains. The method introduces a special account of an intermediary. Unlike the witness mode, the special account of this scheme does not obtain the assets of both parties to the transaction. At the same time, under this scheme, the hash lock of the cross-chain transaction does not need a time lock, and there is no situation where the user cannot unlock it, which improves the disadvantage of the risk of losing assets in the hash lock + time lock. A rollback mechanism is also set, and the secret value is deleted in the rollback mechanism. This means that either all cross-chain transactions are successful or all are rolled back, realizing the atomicity of cross-chain transactions. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 This is a schematic diagram of the method for implementing cross-chain transactions of alliance chains provided in Example 1;
[0049] Figure 2 This is a schematic diagram of the asset rollback principle provided in Example 1. DETAILED DESCRIPTION
[0050] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation methods described herein are only used to explain the present invention and are not used to limit the present invention.
[0051] Example 1
[0052] This embodiment provides a method for implementing cross-chain transactions of alliance chains, such as Figure 1 As shown in the figure, consortium chain A and consortium chain B are recorded as participant 1 and participant 2 respectively, and participant 1 is used as the cross-chain transaction requester. The specific process is as follows:
[0053] 1. Generation of pairing values.
[0054] In cross-chain transactions, the transaction hash values of the two chains are different, which makes it difficult to query and match. Therefore, it is recommended that the two parties negotiate the matching value in advance to facilitate quick matching. The specific process is as follows:
[0055] 1) The cross-chain transaction initiator Participant 1 and Participant 2 complete the negotiation on the cross-chain transaction content. The content includes the following fields: source chain identifier, source chain sending address, source chain asset identifier, source chain asset quantity, source chain target address, target chain identifier, target sending chain address, target chain asset identifier, target chain asset quantity, target chain target address, timestamp, and other fields.
[0056] Negotiation can be online interactive negotiation, platform negotiation, or offline negotiation. This solution does not limit the negotiation method, only the above negotiation results are required.
[0057] 2) Perform hash calculation on the above information to obtain the pairing value P.
[0058] 2. Cross-chain process
[0059] 1) The two parties to the transaction negotiate the cross-chain requirements, determine the content fields negotiated in step 1, and calculate the hash value to obtain the pairing value P;
[0060] For example, the content is: {Chain A, participant 1 chain A address, RMB, 300, participant 2 chain A address, chain B, participant 2 chain B address, gold, 1, participant 1 chain B address, timestamp}, which means that participant 1 uses RMB 300 in chain A to exchange 1g of gold in participant 2 chain B.
[0061] P = Hash (Chain A, Participant 1 Chain A address, RMB, 300, Participant 2 Chain A address, Chain B, Participant 2 Chain B address, Gold, 1, Participant 1 Chain B address, Timestamp), where Hash represents the fixed Hash algorithm adopted by the system.
[0062] 2) A participant sends a cross-chain request and a pairing value P to the middleman; the request includes transaction information and a pairing value P.
[0063] 3) The middleman verifies the consistency between the transaction information and the paired value, that is, whether P is equal to the Hash value of the transaction information. If not, the subsequent process will be rejected; after verification, the middleman randomly generates a secret value s3 and calculates h3 = Hash (P, s3). This means that h3 is a value bound to the transaction.
[0064] 4) Send response information and h3 to Participant 1 and Participant 2. The response information includes the pairing value P, indicating that the middleman agrees to participate in the transaction corresponding to the P value.
[0065] 5) Participant 1 and Participant 2 randomly generate secret values s1 and s2 and send them to the middleman.
[0066] 6) The middleman calculates the unlocking value J. The calculation method is as follows:
[0067] J = Hash(L1, R1), where L1 = Hash(s1, P), R1 = Hash(P, s2)
[0068] 7) The middleman sends the unlocking value J to Participant 1 and Participant 2.
[0069] 8) Participants generate smart contracts and deploy them.
[0070] 8-1) Alliance chain A generates smart contract 1 based on unlock value J. The description of smart contract 1 is as follows:
[0071] Contains at least 4 functions:
[0072] a)save(num, id): the caller deposits assets to the contract address, the asset quantity is num, and the asset chain identifier is id;
[0073] b) getNum(): the caller queries the contract balance;
[0074] c) release(input1,input2): used to release contract assets. If Hash(input1,input2) = unlock value 1, all contract assets are transferred to the preset address 1 in the contract, and the contract is destroyed. The unlock value 1 and preset address 1 are constants inside the contract. When participant 1 generates smart contract 1, the unlock value is the unlock value J received in 7), and the preset address 1 is the source chain target address, such as the participant 2 alliance chain A address. These constants are preset by participant 1. It also means that no matter who unlocks the asset, it will not be sent to others.
[0075] d) call back (input): used to send the contract assets to the generator. If Hash (input) = unlock value 2, all contract assets are transferred to the preset address 2 in the contract, and the contract is destroyed. The unlock value 2 and preset address 2 are constants inside the contract. Here, the unlock value 2 is the corresponding value in step 4). When participant 1 generates smart contract 1, the unlock value 2 is h3 received in step 3, and the preset address 2 is the source chain sending address, such as the address of participant 1 alliance chain A. These constants are preset by participant 1.
[0076] When participant 2 generates smart contract 2, the process is similar to the above.
[0077] 8-2) Participant 1 deploys smart contract 1 on the source chain alliance chain A, and participant 2 deploys smart contract 2 on the target chain alliance chain B.
[0078] Optionally, after deploying the smart contract, Participant 1 and Participant 2 send the contract information to the middleman.
[0079] Optionally, the middleman captures the deployed smart contract himself and identifies the contract based on the unlock value J of the built-in parameter in the release(input1,input2) function.
[0080] 8-3) Participant 1 calls smart contract 1 and deposits the corresponding asset negotiated in 1) on the source chain. For example, RMB 300 is deposited. Participant 2 calls smart contract 2 and deposits the corresponding asset negotiated in 1) on the target chain. For example, gold is deposited in 1).
[0081] 9) The middleman checks the contract information and contract asset information. Specifically, the following information needs to be checked:
[0082] 9-1) Regarding the inspection of smart contract 1, the details are as follows:
[0083] a) In the release(input1,input2) function, check whether the preset unlock value is the J calculated in 6);
[0084] b) In the release(i nput1,i nput2) function, whether the preset address is the source chain target address in the cross-chain information in 1), such as the address of participant 2 chain A;
[0085] c) In the call back (input) function, check whether the preset unlock value is h3 generated in 3);
[0086] d) In the call back (input) function, is the preset address the source chain sending address in the cross-chain information in 1), such as the address of participant 1 chain A?
[0087] e) Call the getNum() function to check whether the source chain asset ID and quantity in smart contract 1 correspond to the source chain asset ID and source chain asset quantity in 1); for example, whether RMB 300 is deposited.
[0088] 9-2) Regarding the inspection of smart contract 2, the details are as follows:
[0089] a) In the release(input1,input2) function, check whether the preset unlock value is the J calculated in 6);
[0090] b) In the release(i nput1,i nput2) function, whether the preset address is the target chain target address in the cross-chain information in 1), such as the address of participant 1 chain B;
[0091] c) In the call back (input) function, check whether the preset unlock value is h3 generated in 3);
[0092] d) In the call back (input) function, whether the preset address is the target chain sending address in the cross-chain information in 1), such as the address of participant 2 chain B;
[0093] e) Call the getNum() function to check whether the target chain asset ID and quantity in smart contract 2 correspond to the target chain asset ID and target chain asset quantity in 1); for example, whether gold 1 is deposited.
[0094] If all checks in 9) pass, then enter 10); if the check fails or the transaction is seriously timed out (the timeout limit is set by the administrator based on experience), then enter the rollback process. The rollback process is described in detail in 3.
[0095] 10) Send the unlocking information R1 calculated in 6) to participant 1, and send the unlocking information L1 calculated in 6) to participant 2.
[0096] 11) Participant 1 calls the release(input1,input2) method of smart contract 2, where input1==Hash(s1,P), input2=R1(the value received by participant 1 in 10)); obviously, s1 is the participant's own secret value, Hash(s1,P)=L1, Hash(L1,R1)=J, and the unlocking condition is met, and the asset will be released from smart contract 2 to the target chain address of participant 1. Similarly, participant 2 calls the release(input1,input2) method of smart contract 1, where input1=L1(the value received by participant 2 in 10)), input2=(s2,P)=R1, and the unlocking condition is met, and the asset will be released from smart contract 1 to the source chain address of participant 2.
[0097] 3. Asset rollback
[0098] 1) The middleman destroys the secret values s1 and s2 received in 2-5);
[0099] 2) The middleman sends the secret value s3 generated in 2-3) to Participant 1 and Participant 2;
[0100] 3) Participant 1 calls the call back (input) method of smart contract 1, where input = s3 (the value received by participant 1 in 2). Hash (s3) = h3, the unlocking condition is met, and the asset will be released to the source chain sending address, that is, the address of participant 1. Similarly, participant 2 calls the call back (input) method of smart contract 2, and the asset will be released to the target chain sending address, that is, the address of participant 2.
[0101] 4) The contract is automatically destroyed and the assets are transferred, which means the cross-chain transaction is rolled back. At this point, there is no related contract on the chain and the assets are returned to the participants.
[0102] It should be noted that the method provided in this embodiment has the following technical effects:
[0103] 1. The calculation method of the pairing value is to obtain it by performing a hash operation on the transaction content, which is unique and can be used as a feature code for cross-chain transactions.
[0104] 2. In the cross-chain process, assets will not be sent to middlemen, reducing related risks.
[0105] 3. The same unlocking value can be unlocked by different messages without leaking the relevant secret value. Participants can use the same secret value to participate in all cross-chain solutions.
[0106] 4. A rollback mechanism is set up, and the secret value is deleted in the rollback mechanism. This means that either all cross-chain transactions are successful or all are rolled back, thus achieving the atomicity of cross-chain transactions.
[0107] 5. In addition to negotiating the pairing value, participants do not need to interact with each other, which is convenient for maintaining the network. Optionally, the pairing value can be completed on the cross-chain transaction matching platform.
[0108] 6. Compared with the hash lock solution, this solution does not require a time lock, so there is no risk of participants losing their assets.
[0109] 7. All processes have transaction records on the source chain and the target chain for easy auditing.
[0110] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be considered as the scope of protection of the present invention.
Claims
1. A method for realizing cross-chain transactions of alliance chains, characterized in that: The following steps are involved: S1, Participant 1 and Participant 2 who use consortium chain A and consortium chain B to implement cross-chain transactions negotiate cross-chain transaction requirements through an intermediary and generate a pairing value P; S2, selects one participant as the initiator of the transaction request, uses the alliance chain A or alliance chain B as the source chain, sends the cross-chain transaction request and the generated pairing value P to the middleman, and the middleman randomly generates a secret value s3, calculates h3=Hash(P,s3), and sends h3 and the response information to the participant 2 of the alliance chain B to be traded and the participant 1 of the alliance chain A; S3, Participant 1 and Participant 2 randomly generate secret values s1 and s2 respectively, and send them to the middleman, who calculates the unlocking value J according to the following calculation formula; J=Hash(L1, R1), where L1=Hash(s1,P), R1= Hash(P, s2) S4, the middleman sends the unlocking value J to participant 1 and participant 2, and the participants 1 and 2 respectively generate and deploy smart contract 1 and smart contract 2 based on the unlocking value J, and send them to the middleman at the same time; In step S4, smart contract 1 or smart contract 2 contains at least 4 functions: a) save(num, id): Participant 1 or Participant 2 deposits assets into the contract address, the asset quantity is num, and the asset chain identifier is id; b) getNum(): Participant 1 or Participant 2 queries the contract balance; c) release(input1, input2): used to release contract assets; if Hash(input1, input2) = unlock value 1, all contract assets will be transferred to the preset address 1 in the contract, and the contract will be destroyed; d) callback(input): used to send the contract assets to the counterparty user; if Hash(input) = unlock value 2, all contract assets will be transferred to the preset address 2 in the contract, and the contract will be destroyed; S5, after the middleman captures smart contract 1 and smart contract 2, he checks the contract information and contract asset information. If the check passes, he generates unlocking information R1 and unlocking information L1 respectively, and enters step S6; if the check fails, he enters the asset rollback process and the cross-chain fails; S6, Participant 1 and Participant 2 respectively obtain the unlocking information R1 and unlocking information L1 sent by the middleman, and call the smart contract of the transaction counterparty based on the obtained unlocking information, thereby completing the alliance chain cross-chain transaction process.
2. The method for realizing cross-chain transactions of alliance chains according to claim 1, characterized in that: The cross-chain transaction requirements in step S1 include but are not limited to any one of the source chain address, asset identification, asset quantity and transaction time of any alliance chain to be traded.
3. The method for realizing cross-chain transactions of alliance chains according to claim 1, characterized in that: Before the middleman in step S2 randomly generates the secret value s3, it is necessary to first verify whether the cross-chain requirement is the same as the pairing value P, that is, whether the pairing value P is equal to the transaction information of the cross-chain transaction request. If they are not the same, the cross-chain transaction fails and the cross-chain transaction process is exited; If they are the same, the middleman randomly generates a secret value s3.
4. The method for realizing cross-chain transactions of alliance chains according to claim 1, characterized in that: After the middleman in step S5 captures smart contract 1 and smart contract 2, he checks the contract information and contract asset information, specifically including checking smart contract 1 and smart contract 2. The checking process of smart contract 1 is as follows: a) In the release(input1, input2) function, whether the preset unlock value 1 is the unlock value J calculated in step S4; b) In the release(input1, input2) function, whether the preset address 1 is the source chain target address in the cross-chain transaction information in step S1, that is, the address of participant 2 in chain A, that is, the asset receiving address in the cross-chain transaction; c) In the callback(input) function, the preset unlock value 2 is the secret value h3 generated in step S2; d) In the callback(input) function, whether the preset address 2 is the source chain sending address in the cross-chain transaction information in step S1, that is, the address of participant 1 in chain A, which is used to roll back the transaction and return the asset; e) Call the getNum() function to check whether the asset identifier and asset quantity of alliance chain A in smart contract 1 correspond to the asset identifier and asset quantity of alliance chain A in step S1; The inspection process of smart contract 2 is as follows: a) In the release(input1, input2) function, whether the preset unlock value 1 is the unlock value J calculated in step S4; b) In the release(input1, input2) function, whether the preset address 1 is the target chain address in the cross-chain information, that is, the address of participant 1 in alliance chain B, which is also the asset receiving address in the cross-chain transaction; c) In the callback(input) function, the preset unlock value 2 is the secret value h3 generated in step S2; d) In the callback(input) function, whether the preset address 2 is the target chain sending address in the cross-chain information, that is, the address of participant 2 in alliance chain B, which is used to roll back the transaction and return the asset address; e) Call the getNum() function to check whether the asset identifier and asset quantity of alliance chain B in smart contract 2 correspond to the asset identifier and asset quantity of alliance chain B in step S1.
5. The method for realizing cross-chain transactions of alliance chains according to claim 4, characterized in that: The asset rollback process in step S5 includes the following steps: The middleman destroys the received secret values s1 and s2, and sends the generated secret value s3 to Participant 1 and Participant 2; Participant 1 calls the callback(input) method of smart contract 1, where input=s3, Hash(s3)=h3. The unlocking condition is met and the assets will be released to the source chain sending address, that is, the address of participant 1 in alliance chain A; Similarly, when participant 2 calls the callback(input) method of smart contract 2, the assets will be released to the target chain sending address, that is, the address of participant 2 in alliance chain B; The contract is automatically destroyed and the assets are transferred, which means the cross-chain transaction is rolled back.
6. The method for realizing cross-chain transactions of alliance chains according to claim 1, characterized in that: Step S6 specifically includes: Participant 1 calls the release(input1, input2) method of smart contract 2, where input1= =Hash(s1,P), input2=R1; Obviously, s1 is the secret value of participant 1, Hash(s1,P)=L1, Hash(L1,R1)=J, and the unlocking condition is met. The assets will be released from smart contract 2 to the target chain address of participant 1; Similarly, consortium chain B calls the release(input1, input2) method of smart contract 1, where input1=L1, input2=(s2,P)=R1, and the unlocking conditions are met. The assets will be released from smart contract 1 to the source chain address of participant 2.
7. A device for realizing cross-chain transactions of alliance chains, characterized in that: The device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it executes the method for realizing cross-chain transactions of alliance chains as described in any one of claims 1-6.
8. A computer-readable storage medium, characterized in that: The storage medium stores instructions, and when the instructions are executed on a terminal device, the terminal device executes the method for realizing cross-chain transactions of alliance chains as described in any one of claims 1-6.
Citation Information
Patent Citations
An asset cross-chain transaction method between block chains
CN109685489A
Block chain cross-chain transaction model and method
CN112116472A