Cross-chain atomic exchange method, block chain node, block chain system and storage medium

By generating and verifying key pairs and difficulty relations between blockchain nodes and using the public parameters of the lattice hypothesis to generate pre-signatures, the problem of key loss in cross-chain atomic swaps is solved, and the security and integrity of transactions are achieved.

CN120811571APending Publication Date: 2025-10-17CHINA CITIC BANK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511155522.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-18
Publication Date
2025-10-17

AI Technical Summary

Technical Problem

Existing cross-chain atomic swap methods cannot effectively prevent the loss of the transaction object's key, affecting transaction security.

Method used

Generate a first key pair and a first difficulty relationship for the first transaction object, generate a pre-signature using the public parameters of the lattice hypothesis, and perform verification and broadcast the formal signature among the blockchain nodes to ensure the security of the key pair.

Benefits of technology

Even if the private key of one participant is lost, the key pair will not be lost, which improves the security of cross-chain atomic swaps and ensures the integrity of transactions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120811571A_ABST
    Figure CN120811571A_ABST
Patent Text Reader

Abstract

The invention discloses a cross-chain atomic exchange method, a block chain node, a block chain system and a storage medium, and relates to the technical field of block chains. A first transaction object and a second transaction object respectively correspond to two participants; the key pairs corresponding to the first transaction object and the second transaction object respectively comprise the private keys of the two participants and the public key jointly corresponding to the private keys of the two participants, even if the private key of one participant is lost, the key pairs cannot be lost, the safety of the key pairs of the transaction objects is improved, and the user experience is improved. Therefore, the safety of cross-chain atomic exchange is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of blockchains, and in particular to a cross-chain atomic exchange method, a blockchain node, a blockchain system and a storage medium. BACKGROUND

[0002] Cross-chain atomic exchange is an atomic asset exchange in different blockchain systems. Asset exchange can only be successful or fail simultaneously, and there is no intermediate state.

[0003] Both transaction objects of cross-chain atomic exchange need to generate a key to conduct a cryptocurrency transaction. However, the current cross-chain atomic transaction method cannot prevent key loss. If the key of the transaction object is lost, the transaction security is affected. SUMMARY

[0004] In view of the above problems, the present application provides a cross-chain atomic exchange method, a blockchain node, a blockchain system and a storage medium, which improves the security of the key pair of the transaction object, thereby ensuring the security of cross-chain atomic exchange. The specific scheme is as follows:

[0005] The first aspect of the present application provides a cross-chain atomic exchange method, comprising:

[0006] generating a first key pair and a first difficulty relationship of a first transaction object, and generating a first pre-signature of a first transaction according to the first key pair and the first difficulty relationship, the first transaction object corresponding to a first blockchain node on a first blockchain, the first transaction object corresponding to a first participant and a second participant, the first key pair comprising a first private key of the first participant, a second private key of the second participant, and a first public key corresponding to the first private key and the second private key;

[0007] sending the first public key, the first transaction and the first pre-signature to a second blockchain node corresponding to a second transaction object, so that the second blockchain node verifies the first pre-signature according to the first public key and the first transaction, the second blockchain node being on a second blockchain;

[0008] if the first pre-signature is verified by the second blockchain node, receiving a second public key, a second transaction and a second pre-signature sent by the second blockchain node, wherein the second transaction object corresponds to a third participant and a fourth participant, a second key pair consisting of a third private key of the third participant, a fourth private key of the fourth participant, and the second public key corresponding to the third private key and the fourth private key, the second blockchain node generating the second pre-signature of the second transaction according to the second key pair and a second difficulty relationship;

[0009] verify the second pre-signature according to the second public key and the second transaction;

[0010] generate a second formal signature corresponding to the second transaction object according to the second pre-signature in a case that the second pre-signature is verified;

[0011] broadcast the second formal signature, and the second transaction is completed;

[0012] receive a first formal signature corresponding to the first transaction object broadcast by the second blockchain node in a case that the second blockchain node verifies the second formal signature, the first transaction is completed, and the first formal signature is generated according to the first pre-signature.

[0013] In a possible implementation, the method of generating the first key pair and the first difficult relation of the first transaction object, and generating the first pre-signature of the first transaction according to the first key pair and the first difficult relation, comprises:

[0014] generating the first key pair and the first difficult relation based on public parameters of a lattice assumption;

[0015] obtaining the first pre-signature composed of a first pre-signature parameter and a second pre-signature parameter, the first pre-signature parameter being generated according to public parameters of a lattice assumption, a first evidence in the first difficult relation and the first transaction, and the second pre-signature parameter being generated according to a first intermediate parameter, the first pre-signature parameter and the second private key, the first intermediate parameter being generated according to public parameters of a lattice assumption, the first pre-signature parameter and the first private key.

[0016] In a possible implementation, the method of obtaining the first pre-signature composed of the first pre-signature parameter and the second pre-signature parameter, comprises:

[0017] receiving the first pre-signature parameter and the first intermediate parameter sent by the terminal corresponding to the first participant, the first intermediate parameter being generated by the terminal corresponding to the first participant according to public parameters of a lattice assumption, the first pre-signature parameter and the first private key;

[0018] generating the second pre-signature parameter according to the first intermediate parameter, the first pre-signature parameter and the second private key.

[0019] In a possible implementation, the method of verifying the first pre-signature according to the first public key and the first transaction by the second blockchain node, comprises:

[0020] extracting a first signature parameter and a second signature parameter in the first pre-signature by the second blockchain node;

[0021] The second blockchain node calculates a second intermediate parameter according to a public parameter of a lattice assumption, the first public key and the first pre-signature;

[0022] The second blockchain node calculates a first verification signature parameter according to the first public key, the second intermediate parameter and the first transaction;

[0023] The second blockchain node passes the verification of the first pre-signature when the first verification signature parameter is consistent with the first signature parameter.

[0024] In a possible implementation, the generating of the second formal signature corresponding to the second transaction object according to the second pre-signature comprises:

[0025] According to the second pre-signature, a second evidence in the second difficult relationship is calculated;

[0026] According to a second pre-signature parameter in the second pre-signature and the second evidence, a second signature parameter is generated, the first signature parameter and the second signature parameter constitute the second formal signature, and the first signature parameter is consistent with a first pre-signature parameter in the second pre-signature.

[0027] In a possible implementation, the method for verifying the second formal signature by the second blockchain node comprises:

[0028] The second blockchain node extracts a second signature parameter in the second formal signature;

[0029] The second blockchain node calculates a second verification evidence according to the second signature parameter and a second pre-signature parameter in the second pre-signature;

[0030] The second blockchain node passes the verification of the second formal signature when a second evidence in the second difficult relationship is consistent with the second verification evidence.

[0031] The second aspect of the present application provides a cross-chain atomic exchange method, comprising:

[0032] A second key pair and a second difficult relationship of a second transaction object are generated, a second blockchain node corresponding to the second transaction object is on a second blockchain, the second transaction object corresponds to a third participant and a fourth participant, and the second key pair comprises a third private key of the third participant, a fourth private key of the fourth participant and a second public key corresponding to the third private key and the fourth private key together;

[0033] receive a first public key, a first transaction and a first pre-signature sent by a first blockchain node, wherein the first blockchain node is on a first blockchain, the first transaction object corresponds to a first participant and a second participant, a first private key of the first participant, a second private key of the second participant and the first public key corresponding to the first private key and the second private key together form a first public key pair, and the first blockchain node generates a second pre-signature of the first transaction according to the first key pair and a first difficult relationship;

[0034] verify the first pre-signature;

[0035] generate a second pre-signature of the second transaction according to the second key pair and the second difficult relationship if the first pre-signature is verified;

[0036] send the second public key, the second transaction and the second pre-signature to the first blockchain node;

[0037] receive a second formal signature corresponding to the second transaction object broadcast by the first blockchain node if the second pre-signature is verified by the first blockchain node, wherein the second transaction is completed, and the second formal signature is generated according to the second pre-signature;

[0038] verify the second formal signature;

[0039] generate a first formal signature of the first transaction object according to the first pre-signature if the second formal signature is verified;

[0040] broadcast the first formal signature, and the first transaction is completed.

[0041] The third aspect of the present application provides a blockchain node, comprising at least one processor and a memory connected to the processor, wherein:

[0042] the memory is used to store a computer program;

[0043] the processor is used to execute the computer program, so that the blockchain node can implement the cross-chain atomic exchange method of the first aspect or the cross-chain atomic exchange method of the second aspect.

[0044] The fourth aspect of the present application provides a blockchain system, comprising at least two blockchains;

[0045] each of the blockchains comprises a plurality of blockchain nodes of the third aspect.

[0046] The fifth aspect of the present application provides a computer storage medium, the storage medium carrying one or more computer programs, when the one or more computer programs are executed by a blockchain node, the one or more computer programs can enable the blockchain node to implement the cross-chain atomic exchange method of the first aspect or the cross-chain atomic exchange method of the second aspect.

[0047] By the above technical solution, the present application provides a cross-chain atomic exchange method, the first transaction object and the second transaction object correspond to two participants respectively, and the key pair corresponding to the first transaction object and the second transaction object respectively includes a private key of the two participants and a public key corresponding to the private keys of the two participants, so that even if the private key of one participant is lost, the key pair will not be lost, the security of the key pair of the transaction object is improved, and the security of the cross-chain atomic exchange is ensured. BRIEF DESCRIPTION OF DRAWINGS

[0048] The above and other features, advantages, and aspects of the present disclosure will become more apparent by describing in detail the embodiments thereof with reference to the attached drawings. Throughout the drawings, the same or similar reference numerals refer to the same or similar elements. It should be understood that the drawings are schematic, and the shapes and elements are not necessarily drawn to scale.

[0049] Figure 1 A flowchart of a cross-chain atomic exchange method applied to a first blockchain node provided by an embodiment of the present application;

[0050] Figure 2 A flowchart of a cross-chain atomic exchange method applied to a second blockchain node provided by an embodiment of the present application;

[0051] Figure 3 A cross-chain atomic exchange flowchart provided by an embodiment of the present application;

[0052] Figure 4 A structure diagram of a blockchain node provided by an embodiment of the present application. DETAILED DESCRIPTION

[0053] The embodiments of the present application are described below in conjunction with the drawings in the embodiments of the present application. The terms used in the embodiment part of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.

[0054] The embodiments of the present application are described below in conjunction with the drawings. Those skilled in the art can know that, with the development of technology and the appearance of new scenarios, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems.

[0055] The terms "first", "second", and the like in the description and in the claims of the present application and in the above figures are used to distinguish like objects and are not necessarily used to describe a particular sequential or chronological order. It is to be understood that the terms so used are interchangeable under appropriate circumstances and that the embodiments of the present application are capable of functioning in other sequences than the one described below. Furthermore, the terms "comprise", "comprising", "include", "including", and the like are to be construed open-ended, allowing for instances where further additions are made, so that the process, method, system, product, or apparatus is not meant to be limited to the specific recitation of those elements, but rather any process, method, system, product, or apparatus that includes those elements is within the scope of protection.

[0056] The present application provides a blockchain system, including at least two blockchains, each of which includes a plurality of blockchain nodes, a cross-chain atomic exchange method is applied between the blockchain nodes in the two blockchains, for the convenience of description, the two blockchains participating in the cross-chain atomic exchange are recorded as the first blockchain and the second blockchain, and the blockchain nodes participating in the cross-chain atomic exchange are recorded as the first blockchain node and the second blockchain node, wherein the first blockchain node is on the first blockchain, and the second blockchain node is on the second blockchain.

[0057] The present application provides a cross-chain atomic exchange method. The cross-chain atomic exchange method of the embodiments of the present application will be described in detail below with reference to the accompanying drawings.

[0058] Reference Figure 1 , Figure 1 The flowchart of the cross-chain atomic exchange method provided by the embodiments of the present application is shown in FIG. 1, the cross-chain atomic exchange method provided by the embodiments of the present application, applied to the first blockchain node, can include steps 101 to 107, which will be described in detail below. Figure 1

[0059] 101: generating a first key pair of a first transaction object and a first difficulty relationship, and generating a first pre-signature of the first transaction according to the first key pair and the first difficulty relationship;

[0060] The first blockchain node corresponding to the first transaction object is on the first blockchain, the first transaction object corresponds to a first participant and a second participant, and the first key pair includes a first private key of the first participant, a second private key of the second participant, and a first public key corresponding to the first private key and the second private key.

[0061] The difficulty relationship refers to that in the encryption algorithm, some mathematical problems or operations are difficult to solve in calculation, that is, there is no known efficient algorithm that can solve these problems in polynomial time, and such difficulty is the basis of the security of the encryption algorithm, and the first pre-signature of the first transaction is generated according to the first key pair and the first difficulty relationship, so the first pre-signature is difficult to be cracked.​

[0062] The method of generating the first pre-signature of the first transaction is different for different encryption algorithms.

[0063] In one possible implementation, the first pre-signature of the first transaction is generated based on a lattice assumption (Module-SIS), which is a kind of difficult assumption that can resist quantum attacks and improve the security of cross-chain atomic exchange.

[0064] 102: Send the first public key, the first transaction, and the first pre-signature to a second blockchain node corresponding to the second transaction object, so that the second blockchain node verifies the first pre-signature based on the first public key and the first transaction;

[0065] The first transaction is a transaction of the first transaction object to the second transaction object, such as the first transaction object sending c0 encrypted currencies to the second transaction object.

[0066] The method of verifying the first pre-signature corresponds to the method of generating the first pre-signature.

[0067] 103: If the first pre-signature is verified by the second blockchain node, receive the second public key, the second transaction, and the second pre-signature sent by the second blockchain node;

[0068] The second transaction object corresponds to a third participant and a fourth participant, and the second key pair is composed of a third private key of the third participant, a fourth private key of the fourth participant, and a second public key corresponding to the third private key and the fourth private key. The second blockchain node generates the second pre-signature of the second transaction based on the second key pair and the second difficult relationship.

[0069] The principle of the second blockchain node generating the second key pair and the second difficult relationship of the second transaction object is the same as the principle of the first blockchain node generating the first key pair and the first difficult relationship of the first transaction object.

[0070] The principle of the second blockchain node generating the second pre-signature is also the same as the principle of the first blockchain node generating the first pre-signature.

[0071] The second transaction is a transaction of the second transaction object to the first transaction object, such as the second transaction object sending c1 encrypted currencies to the first transaction object.

[0072] 104: Verify the second pre-signature based on the second public key and the second transaction;

[0073] The principle of the first blockchain node verifying the second pre-signature is also the same as the principle of the second blockchain node verifying the first pre-signature.

[0074] 105: generating a second formal signature corresponding to the second transaction object according to the second pre-signature in the case that the second pre-signature passes the verification;

[0075] In the case that the second pre-signature passes the verification, a second formal signature is generated by adapting the second pre-signature to a formal signature supported by the second blockchain.

[0076] 106: broadcasting the second formal signature, and the second transaction is completed;

[0077] The first blockchain node obtains the transfer of the first transaction object by broadcasting the second formal signature.

[0078] 107: in the case that the second formal signature passes the verification of the second blockchain node, receiving the first formal signature corresponding to the first transaction object broadcast by the second blockchain node, the first transaction is completed, and the first formal signature is generated according to the first pre-signature.

[0079] The second blockchain node obtains the transfer of the first transaction object by broadcasting the first formal signature.

[0080] It should be noted that if the first blockchain node or the second blockchain node fails to verify the pre-signature, the cross-chain atomic exchange is ended, and the atomicity of the cross-chain transaction is ensured.

[0081] The cross-chain atomic exchange method disclosed in the embodiment includes that the first transaction object and the second transaction object correspond to two participants respectively, and the key pair corresponding to the first transaction object and the second transaction object respectively includes a private key of the two participants and a public key corresponding to the private keys of the two participants, so that even if the private key of one participant is lost, the key pair will not be lost, the security of the key pair of the transaction object is improved, and the security of the cross-chain atomic exchange is ensured.

[0082] In a possible implementation, the cross-chain atomic exchange method disclosed in the embodiment is implemented based on a lattice assumption.

[0083] A possible implementation of step 101 in the above embodiment includes steps 1011-1012:

[0084] 1011: generating a first key pair and a first difficult relationship based on public parameters of a lattice assumption;

[0085] The public parameters (A, H) of the lattice assumption.

[0086] Wherein:

[0087] ;

[0088] ;

[0089] is a hash function;

[0090] n represents the length n of A, q represents the modulus of A, and R is a polynomial matrix.

[0091] obtaining a first private key of a first participant in a first key pair by sampling A and a second private key of a second participant , a first public key Q= .

[0092] generating an instance I={((Q, A), w)|Q=Aw} to obtain a first difficult relation , wherein w is a first evidence.

[0093] 1012: obtaining a first pre-signature composed of a first pre-signature parameter and a second pre-signature parameter.

[0094] The first pre-signature parameter is generated according to a public parameter of a lattice assumption, a first evidence in the first difficult relation, and a first transaction, and the second pre-signature parameter is generated according to a first intermediate parameter, the first pre-signature parameter, and the second private key, and the first intermediate parameter is generated according to the public parameter of the lattice assumption, the first pre-signature parameter, and the first private key.

[0095] There can be multiple ways to obtain the first pre-signature.

[0096] Illustratively, the first participant and the second participant log in to a first blockchain node respectively, and input the first private key of the first participant and the second private key of the second participant. The first blockchain node generates the first pre-signature parameter according to the public parameter of the lattice assumption, the first evidence in the first difficult relation, and the first transaction, and generates the second pre-signature according to the first intermediate parameter, the first pre-signature parameter, and the second private key, thereby obtaining the first pre-signature composed of the first pre-signature parameter and the second pre-signature parameter.

[0097] Illustratively, a terminal corresponding to the first participant generates the first pre-signature parameter and the first intermediate parameter according to the public parameter of the lattice assumption, the first evidence in the first difficult relation, and the first transaction, and sends the first pre-signature parameter and the first intermediate parameter to the first blockchain node. The second participant logs in to the first blockchain node, generates the second pre-signature according to the first intermediate parameter, the first pre-signature parameter, and the second private key, thereby obtaining the first pre-signature composed of the first pre-signature parameter and the second pre-signature parameter.

[0098] Exemplarily, the terminal corresponding to the first participant generates the first pre-signature parameter and the first intermediate parameter according to the public parameter of the lattice assumption, the first evidence in the first difficult relation and the first transaction, and sends the first pre-signature parameter and the first intermediate parameter to the terminal corresponding to the second participant. The terminal corresponding to the second participant generates the second pre-signature according to the first intermediate parameter, the first pre-signature parameter and the second private key, and sends the first pre-signature composed of the first pre-signature parameter and the second pre-signature parameter to the first blockchain node.

[0099] Specifically, the terminal P0 corresponding to the first participant extracts a polynomial vector y from the public parameter A of the lattice assumption as a random number, calculates Y=Ay, and calculates the first pre-signature parameter , m is the first transaction, and then calculates the first intermediate parameter , and sends the first pre-signature parameter c and the first intermediate parameter to the terminal corresponding to the second participant.

[0100] The terminal P1 corresponding to the second participant calculates the second pre-signature parameter , and outputs the first pre-signature .

[0101] In a possible implementation, a method for verifying the first pre-signature by the second blockchain node according to the first public key and the first transaction, comprising steps A1-A4:

[0102] A1: The second blockchain node extracts the first signature parameter and the second signature parameter in the first pre-signature;

[0103] The second blockchain node extracts the first signature parameter and the second signature parameter in the first pre-signature .

[0104] A2: The second blockchain node calculates a second intermediate parameter according to the public parameter of the lattice assumption, the first public key and the first pre-signature;

[0105] The second intermediate parameter is calculated.

[0106] A3: The second blockchain node calculates a first verification signature parameter according to the first public key, the first intermediate parameter and the first transaction;

[0107] The first verification signature parameter is calculated.

[0108] A4: The second blockchain node verifies the first pre-signature in the case that the first verification signature parameter is consistent with the first signature parameter.

[0109] The second blockchain node verifies the first pre-signature in the case that the first verification signature parameter With the first signature parameter If they are consistent, the first pre-signature verification passes.

[0110] The second blockchain node generates a second pre-signature based on the same principle The first blockchain node also uses the same principle to sign the second Perform verification.

[0111] In one possible implementation, in the above embodiment 105, the method for generating the second formal signature corresponding to the second transaction object based on the second pre-signature includes the following steps 1051-1052:

[0112] 1051: Calculate a second evidence in a second difficult relationship based on the second pre-signature;

[0113] Extract the second pre-signature The first pre-signed parameter in , according to the second public key Q, the second transaction m and the first pre-signature parameter The calculation formula , compute the second evidence w in the second difficult relation.

[0114] 1052: Generate a second signature parameter according to the second pre-signature parameter and the second evidence in the second pre-signature.

[0115] Second signature parameter , the first signature parameter and the second signature parameter Composition of the second official signature , the first signature parameter is consistent with the first pre-signature parameter in the second pre-signature.

[0116] In one possible implementation, the method for the second blockchain node to verify the second official signature includes the following steps B1-B3:

[0117] B1: The second blockchain node extracts the second signature parameter from the second official signature;

[0118] The second blockchain node extracts the second official signature The second signature parameter in .

[0119] B2: The second blockchain node calculates the second verification evidence based on the second signature parameter and the second pre-signature parameter in the second pre-signature;

[0120] Calculate the second verification evidence .

[0121] B3: When the second evidence in the second difficult relationship is consistent with the second verification evidence, the second blockchain node verifies the second official signature successfully.

[0122] Second Evidence in a Second Difficult Relationship Verify evidence with the second If they are consistent, the second blockchain node verifies the second official signature.

[0123] Reference Figure 2 , Figure 2 A schematic diagram of a cross-chain atomic swap method provided in an embodiment of the present application is shown below. Figure 2 As shown, a cross-chain atomic swap method provided in an embodiment of the present application, applied to a second blockchain node, may include steps 201 to 209:

[0124] 201: Generate a second key pair and a second difficulty relationship for a second transaction object;

[0125] The second blockchain node corresponding to the second transaction object is on the second blockchain, the second transaction object corresponds to the third participant and the fourth participant, and the second key pair includes the third private key of the third participant, the fourth private key of the fourth participant, and the second public key corresponding to the third private key and the fourth private key.

[0126] 202: Receive a first public key, a first transaction, and a first pre-signature sent by a first blockchain node;

[0127] In which, the first blockchain node is on the first blockchain, the first transaction object corresponds to the first participant and the second participant, the first private key of the first participant, the second private key of the second participant, and the first public key corresponding to the first private key and the second private key constitute a first public key pair, and the first blockchain node generates the second pre-signature for the first transaction based on the first key pair and the first difficulty relationship.

[0128] 203: Verify the first pre-signature;

[0129] 204: If the first pre-signature is verified, generate a second pre-signature for the second transaction according to the second key pair and the second difficulty relationship;

[0130] 205: Send the second public key, the second transaction, and the second pre-signature to the first blockchain node;

[0131] 206: When the first blockchain node verifies the second pre-signature successfully, the first blockchain node receives the second official signature corresponding to the second transaction object broadcast by the first blockchain node, and the second transaction is completed.

[0132] The second official signature is generated based on the second pre-signature.

[0133] 207: Verify the second official signature;

[0134] 208: If the second official signature is verified successfully, generate a first official signature of the first transaction object based on the first pre-signature;

[0135] 209: The first official signature is broadcast, and the first transaction is completed.

[0136] The following introduces a cross-chain atomic swap method provided by the above embodiment through a specific example.

[0137] like Figure 3 The cross-chain atomic swap process diagram shown in the figure assumes that consortium chain A and consortium chain B are two consortium chains that have undergone quantum-resistant transformation. In other words, the entire cross-chain atomic swap method is implemented based on the lattice hypothesis. Institutions A and B are located on two consortium chains respectively. Now institutions A and B want to exchange assets A and B and prevent the loss of assets due to key loss. The cross-chain atomic swap method includes the following steps C1-C6:

[0138] C1: The first and second participants of organization A interact and each obtains a private key and the public key corresponding to the two private keys; organization B performs the same operation.

[0139] C2: Institution A randomly generates a piece of evidence and uses it to generate a difficulty relationship. The first and second parties then rely on the difficulty relationship to interactively generate a pre-signature of Institution A and send the pre-signature to Institution B.

[0140] C3: After receiving the pre-signature, institution B verifies it. If the verification is successful, institution B randomly generates a piece of evidence. The third and fourth parties of institution B rely on the difficulty relationship to interact and generate the pre-signature of institution B, and send the pre-signature to institution A.

[0141] C4: Institution A verifies the pre-signature of institution B. If the verification passes, it uses evidence to adapt the pre-signature to a formal signature supported by consortium chain B and broadcasts the signature.

[0142] C5: After receiving the official signature, institution B uses the official signature and its own pre-signature to recover the evidence, then adapts the official signature supported by consortium chain A and broadcasts the official signature.

[0143] C6: After both parties’ formal signatures are verified and uploaded to the chain, the transaction is completed.

[0144] The cross-chain atomic swap method disclosed in this embodiment can not only achieve fairness in cross-chain transactions, but also resist quantum attacks. Even if the private key of a participant in the transaction is lost, the key pair of the transaction party will not be lost.

[0145] The embodiment of the present application also provides a blockchain node, comprising at least one processor and a memory connected with the processor, wherein: the memory is used to store a computer program, and the processor is used to execute the computer program, so that the blockchain node can implement any cross-chain atomic exchange method provided by the embodiment of the present application.

[0146] Reference Figure 4 As shown in the figure, a structural diagram suitable for implementing the blockchain node in the embodiment of the present application is shown. The blockchain node in the embodiment of the present application can include, but is not limited to, fixed terminals such as smart phones, notebook computers, PDAs (personal digital assistants), PADs (tablets), desktop computers, and the like. Figure 4 The blockchain node shown is only an example and should not bring any limitation to the functions and use range of the embodiment of the present application.

[0147] As Figure 4 shown, the blockchain node can include a processing device (for example, a central processor, a graphics processor, etc.) 401, which can perform various appropriate actions and processes according to programs stored in a read-only memory (ROM) 402 or loaded from a storage device 408 to a random access memory (RAM) 403. In the state that the blockchain node is powered on, the RAM 403 also stores various programs and data required for the operation of the blockchain node. The processing device 401, the ROM 402, and the RAM 403 are connected with each other through a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.

[0148] Generally, the following devices can be connected to the I / O interface 405: an input device 406 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 407 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 408 including, for example, a memory card, a hard disk, etc.; and a communication device 409. The communication device 409 can allow the blockchain node to communicate with other devices wirelessly or by wire to exchange data. Although Figure 4 The blockchain node with various devices is shown, but it should be understood that it is not required to implement or have all the devices shown. More or fewer devices can be alternatively implemented or provided.

[0149] The embodiment of the present application also provides a computer program product comprising computer readable instructions which, when run on a blockchain node, cause the blockchain node to implement any cross-chain atomic exchange method provided by the embodiment of the present application.

[0150] The embodiment of the present application further provides a computer readable storage medium, the storage medium carries one or more computer programs, when the one or more computer programs are executed by a blockchain node, the blockchain node can implement any cross-chain atomic exchange method provided by the embodiment of the present application.

[0151] In addition, it should be noted that the apparatus embodiments described above are merely illustrative, wherein the units described as separate components can or can not be physically separated, and the components displayed as units can or can not be physical units, i.e., can be located in one place, or can be distributed on multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the embodiment. In addition, the connection relationship between the modules in the apparatus embodiment provided by the present application indicates that there is a communication connection between them, which can be implemented as one or more communication buses or signal lines.

[0152] Through the description of the above embodiments, those skilled in the art can clearly understand that the present application can be realized by means of software and necessary general hardware, and of course can also be realized by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. Generally, functions completed by computer programs can be easily realized by corresponding hardware, and the specific hardware structure for realizing the same function can also be various, such as analog circuit, digital circuit or special circuit, etc. However, for the present application, software program implementation is a better embodiment. Based on this understanding, the technical solutions of the present application can be embodied in the form of software products, which are stored in readable storage media, such as computer floppy disks, U disks, mobile hard disks, ROM, RAM, magnetic or optical disks, etc., including a plurality of instructions for making a computer device (which can be a personal computer, a training device, or a network device, etc.) execute the methods described in various embodiments of the present application.

[0153] In the above embodiments, all or part can be realized by software, hardware, firmware or any combination thereof. When realized by software, it can be realized in the form of a computer program product in whole or in part.

[0154] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present application are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions can be transmitted from one website, computer, training device or data center to another website, computer, training device or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be stored by the computer or a data storage device such as a training device, a data center, etc. integrated with one or more available media sets. The available media can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid state disk (SSD)), etc.

Claims

1. A cross-chain atomic swap method, characterized in that: include: Generating a first key pair and a first difficulty relationship for a first transaction object, and generating a first pre-signature for the first transaction based on the first key pair and the first difficulty relationship, wherein a first blockchain node corresponding to the first transaction object is on a first blockchain, the first transaction object corresponds to a first participant and a second participant, and the first key pair includes: a first private key of the first participant, a second private key of the second participant, and a first public key corresponding to both the first private key and the second private key; sending the first public key, the first transaction, and the first pre-signature to a second blockchain node corresponding to a second transaction object, so that the second blockchain node verifies the first pre-signature based on the first public key and the first transaction, where the second blockchain node is on a second blockchain; If the second blockchain node passes verification of the first pre-signature, the second blockchain node receives a second public key, a second transaction, and a second pre-signature sent by the second blockchain node, wherein the second transaction object corresponds to a third party and a fourth party, a third private key of the third party, a fourth private key of the fourth party, and the second public key corresponding to the third and fourth private keys constitute a second key pair, and the second blockchain node generates the second pre-signature for the second transaction based on the second key pair and the second difficulty relationship; verifying the second pre-signature according to the second public key and the second transaction; If the second pre-signature is verified, generating a second official signature corresponding to the second transaction object based on the second pre-signature; The second official signature is broadcasted, and the second transaction is completed; When the second blockchain node successfully verifies the second official signature, the first official signature corresponding to the first transaction object broadcast by the second blockchain node is received, the first transaction is completed, and the first official signature is generated based on the first pre-signature.

2. The cross-chain atomic swap method according to claim 1, characterized in that: The generating a first key pair and a first difficulty relationship of the first transaction object, and generating a first pre-signature of the first transaction according to the first key pair and the first difficulty relationship, includes: generating the first key pair and the first difficulty relation based on public parameters of the lattice hypothesis; Obtaining a first pre-signature consisting of a first pre-signature parameter and a second pre-signature parameter, where the first pre-signature parameter is generated based on a public parameter of a lattice assumption, a first evidence in the first difficult relation, and the first transaction, and the second pre-signature parameter is generated based on a first intermediate parameter, the first pre-signature parameter, and the second private key, where the first intermediate parameter is generated based on the public parameter of the lattice assumption, the first pre-signature parameter, and the first private key.

3. The cross-chain atomic swap method according to claim 2, characterized in that: The obtaining of the first pre-signature consisting of the first pre-signature parameter and the second pre-signature parameter includes: receiving the first pre-signature parameter and the first intermediate parameter sent by a terminal corresponding to the first party, where the first intermediate parameter is generated by the terminal corresponding to the first party based on a public parameter of a lattice hypothesis, the first pre-signature parameter, and the first private key; The second pre-signature parameter is generated according to the first intermediate parameter, the first pre-signature parameter, and the second private key.

4. The cross-chain atomic swap method according to claim 1, characterized in that: The method for the second blockchain node to verify the first pre-signature according to the first public key and the first transaction includes: The second blockchain node extracts the first signature parameter and the second signature parameter from the first pre-signature; The second blockchain node calculates a second intermediate parameter based on the public parameter of the lattice hypothesis, the first public key, and the first pre-signature; The second blockchain node calculates a first verification signature parameter based on the first public key, the second intermediate parameter, and the first transaction; The second blockchain node passes the first pre-signature verification when the first verification signature parameter is consistent with the first signature parameter.

5. The cross-chain atomic swap method according to claim 1, characterized in that: Generating a second formal signature corresponding to the second transaction object according to the second pre-signature includes: calculating a second evidence in the second difficult relationship based on the second pre-signature; A second signature parameter is generated based on the second pre-signature parameter in the second pre-signature and the second evidence. The first signature parameter and the second signature parameter constitute the second formal signature. The first signature parameter is consistent with the first pre-signature parameter in the second pre-signature.

6. The cross-chain atomic swap method according to claim 1, characterized in that: The method for the second blockchain node to verify the second official signature includes: The second blockchain node extracts a second signature parameter from the second official signature; The second blockchain node calculates a second verification evidence based on the second signature parameter and the second pre-signature parameter in the second pre-signature; When the second evidence in the second difficult relationship is consistent with the second verification evidence, the second blockchain node verifies the second official signature successfully.

7. A cross-chain atomic swap method, characterized in that: include: Generating a second key pair and a second difficulty relationship for a second transaction object, wherein the second blockchain node corresponding to the second transaction object is on the second blockchain, the second transaction object corresponds to a third party and a fourth party, and the second key pair includes a third private key of the third party, a fourth private key of the fourth party, and a second public key corresponding to both the third private key and the fourth private key; Receiving a first public key, a first transaction, and a first pre-signature sent by a first blockchain node, wherein the first blockchain node is on the first blockchain, the first transaction object corresponds to a first participant and a second participant, a first private key of the first participant, a second private key of the second participant, and the first public key corresponding to the first private key and the second private key constitute a first public key pair, and the first blockchain node generates the second pre-signature for the first transaction based on the first key pair and the first difficulty relationship; Verifying the first pre-signature; If the first pre-signature is verified to be successful, generating a second pre-signature for the second transaction based on the second key pair and the second difficulty relationship; Sending the second public key, the second transaction, and the second pre-signature to the first blockchain node; If the first blockchain node verifies the second pre-signature successfully, the first blockchain node receives the second official signature corresponding to the second transaction object broadcast by the first blockchain node, the second transaction is completed, and the second official signature is generated based on the second pre-signature. verifying the second official signature; If the second official signature is verified successfully, generating a first official signature of the first transaction object based on the first pre-signature; The first official signature is broadcasted, and the first transaction is completed.

8. A blockchain node, characterized in that: comprising at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program so that the blockchain node can implement the cross-chain atomic swap method according to any one of claims 1 to 6 or the cross-chain atomic swap method according to claim 7.

9. A blockchain system, characterized in that: Include at least two blockchains; Each of the blockchains includes multiple blockchain nodes as described in claim 8.

10. A computer storage medium, characterized in that The storage medium carries one or more computer programs, which, when executed by a blockchain node, enable the blockchain node to implement the cross-chain atomic exchange method according to any one of claims 1 to 6 or the cross-chain atomic exchange method according to claim 7.