A data transfer method, device and equipment based on blockchain
By using constraint files and smart contracts in the blockchain network, the problem of insufficient data transfer in the existing technology has been solved, and the efficient and reliable data transfer process is achieved.
Patent Information
- Application Number
- CN202010075374.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-01-22
- Publication Date
- 2025-01-28
- Estimated Expiration
- 2040-01-22
AI Technical Summary
In the prior art, data transfer is not reliable enough, and the transaction party may fabricate data after data transfer, resulting in inconsistent or loss of data.
By using constraint files and smart contracts in the blockchain network, restrict trading events between trading parties, and automatically execute data transfer within the preset time to ensure the completion of the transaction and the reliability of data.
Improve the efficiency and reliability of data transfer, and ensure that the data transfer process in transaction events is transparent and unable to tamper.
Smart Images

Figure CN111275422B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of blockchain technology, and in particular to a blockchain-based data transfer method, device and equipment. Background Art
[0002] Internet technology is developing rapidly nowadays, and data transfer occurs all the time. For example, game player A and game player B agree to exchange equipment in an electronic game. A gives B equipment A, and B gives A special effect B. This is the process of transferring the data of equipment A from A's account to B's account, and transferring the data of special effect B from B's account to A's account. For another example, C and D reach a consensus on exchanging books in a book drifting activity. C gives D an e-book C, and D gives C an e-book D. The data transfer process is to transfer the data of book C from C's account to D's account, and the data of book D from D's account to C's account, etc. However, in the data transfer performed in the prior art, for example, if A gives B equipment A, but B uses special effect B, or B actually does not have special effect B, but B fabricates data to obtain A's equipment, then A cannot exchange for special effect B, but loses equipment A; similarly, C transfers e-book C to D, but D actually does not have e-book D. The existing scheme makes data transfer unreliable. Summary of the invention
[0003] The present application provides a data transfer method based on blockchain, in which a transaction event between a first transaction party and a second transaction party is constrained by a constraining party, and constraint file information is uploaded to a blockchain network. If the transaction event is not completed within a preset time, a smart contract is called to transfer a first preset data transfer amount from the account of the constraining party to the account of the second transaction party according to the constraint file information, thereby improving the efficiency of data transfer and ensuring the reliability of data transfer in transaction events.
[0004] On the one hand, an embodiment of the present application provides a data transfer method based on blockchain, the method comprising:
[0005] The business service node receives the constraint file information sent by the first node, where the constraint file information is determined according to a transaction event occurring between the first transaction party and the second transaction party, and includes a first digital signature, a second digital signature, a third digital signature, an identifier of the transaction event, a preset time, a first preset data transfer amount, account information of the second transaction party, and account information of the constraining party;
[0006] The business service node sends the constraint file information, the identifier of the first transaction party, the identifier of the second transaction party, and the identifier of the constraining party to the consensus node, so that the consensus node searches for the public keys of the first transaction party, the second transaction party, and the constraining party in the blockchain network according to the identifier of the first transaction party, the identifier of the second transaction party, and the identifier of the constraining party, respectively, and verifies the signature of the constraint file information. If the signature verification is successful, the consensus node returns a consensus confirmation message;
[0007] When the business service node receives a consensus confirmation message returned by the consensus node that satisfies the preset consensus policy, it generates a constraint smart contract according to the constraint file information and uploads the constraint smart contract to the blockchain network;
[0008] If the constraint smart contract fails to find the block of the transaction completion event corresponding to the transaction event in the blockchain network within the preset time, the first preset data transfer amount is transferred from the account of the constraining party to the account of the second transaction party.
[0009] In a possible implementation, uploading the constraint smart contract to the blockchain network includes:
[0010] The business service node receives transaction completion event information sent by the second node, where the transaction completion event information includes at least two digital signatures;
[0011] The business service node sends the transaction completion event information, the identifier of the first transaction party, and the identifier of the second transaction party to the consensus node, so that the consensus node searches for the public key of the first transaction party and the public key of the second transaction party in the blockchain network according to the identifier of the first transaction party and the identifier of the second transaction party, verifies the signature of the transaction completion event, and obtains a first verification code and a second verification code respectively; the consensus node performs a hash operation on the transaction completion event information to obtain a third verification code; if the first verification code, the second verification code, and the third verification code are the same, the consensus node returns a consensus confirmation message;
[0012] When the consensus confirmation message returned by the consensus node received by the business service node satisfies the preset consensus strategy, a block of the transaction completion event corresponding to the transaction event is generated according to the transaction completion event information, and the block of the transaction completion event is uploaded to the blockchain network.
[0013] In a possible embodiment, the constraint file information also includes a transaction object in the transaction event;
[0014] After transferring the first preset data transfer amount from the account of the constraining party to the account of the second transaction party, the method further comprises:
[0015] The constraint smart contract marks the state of the transaction object as a locked state.
[0016] Furthermore, the method further comprises:
[0017] If the business service node detects that the first transaction party transfers the second preset data transfer amount to the account of the constraining party, the constraint smart contract is called to change the state of the transaction object from a locked state to an unlocked state.
[0018] Optionally, before the business service node receives the constraint file information sent by the first node, the process includes:
[0019] The business service node receives a transaction event submission request submitted by the third node, where the transaction event submission request carries an identifier of the transaction event, an identifier of the first transaction party, an identifier of the second transaction party, at least two digital signatures, a transaction object, and a transaction data transfer amount;
[0020] The business service node sends the transaction event submission request to the consensus node, so that the consensus node searches for the public key of the first transaction party and the public key of the second transaction party in the blockchain network according to the identifier of the first transaction party and the identifier of the second transaction party, and verifies the signature of the transaction event submission request to obtain a fourth verification code and a fifth verification code; the consensus node performs a hash operation on the transaction event submission request to obtain a sixth verification code; if the fourth verification code, the fifth verification code and the sixth verification code are the same, the consensus node returns a consensus confirmation message;
[0021] When the consensus confirmation message returned by the consensus node received by the business service node satisfies the preset consensus strategy, a block to be added is generated according to the transaction event submission request, and the block to be added is uploaded to the blockchain network.
[0022] In a possible embodiment, the method further includes:
[0023] If the constraint smart contract detects a block of a transaction completion event corresponding to the transaction event in the blockchain network within the preset time, the transaction completion event is saved in the constraint smart contract, and the status of the constraint smart contract is marked as completed.
[0024] Optionally, the verifying the signature of the constraint file information includes:
[0025] The consensus node decrypts the constraint file information according to the public keys of the first transaction party, the second transaction party and the constraining party to obtain the seventh verification code, the eighth verification code and the ninth verification code respectively; the consensus node performs a hash operation on the constraint file information to obtain the tenth verification code; if the seventh verification code, the eighth verification code, the ninth verification code and the tenth verification code are the same, it is confirmed that the verification of the constraint file information is successful.
[0026] On the one hand, the embodiment of the present application also provides a data transfer device based on blockchain, the device comprising:
[0027] a receiving module, configured to receive constraint file information sent by the first node, wherein the constraint file information is determined according to a transaction event occurring between the first transaction party and the second transaction party, and the constraint file information includes a first digital signature, a second digital signature, a third digital signature, an identifier of the transaction event, a preset time, a first preset data transfer amount, account information of the second transaction party, and account information of the constraining party;
[0028] A sending module, used to send the constraint file information, the identifier of the first transaction party, the identifier of the second transaction party, and the identifier of the constraining party to the consensus node, so that the consensus node searches for the public keys of the first transaction party, the second transaction party, and the constraining party in the blockchain network according to the identifier of the first transaction party, the identifier of the second transaction party, and the identifier of the constraining party, respectively, and verifies the signature of the constraint file information. If the signature verification is successful, the consensus node returns a consensus confirmation message;
[0029] A generation module, configured to generate a constraint smart contract according to the constraint file information when the consensus confirmation message returned by the consensus node satisfies the preset consensus policy;
[0030] The sending module is also used to upload the constraint smart contract to the blockchain network;
[0031] The transfer module is used to transfer the first preset data transfer amount from the account of the constraining party to the account of the second transaction party if a block of the transaction completion event corresponding to the transaction event is not found in the blockchain network within the preset time.
[0032] On the one hand, an embodiment of the present application provides a blockchain-based data transfer device, which includes a transceiver, a processor, and a memory, wherein the processor is used to execute a computer program stored in the memory to implement any possible embodiment described above.
[0033] On the one hand, the present application also provides a computer-readable storage medium, in which instructions are stored. When the instructions are executed on a computer, the computer executes the methods described in the above aspects.
[0034] In the embodiment of the present application, the business service node receives the constraint file information sent by the first node, the constraint file information is determined according to the transaction event occurring between the first transaction party and the second transaction party, and the constraint file information includes the first digital signature, the second digital signature, the third digital signature, the identifier of the transaction event, the preset time, the first preset data transfer amount, the account information of the second transaction party and the account information of the constraining party; the business service node sends the constraint file information, the identifier of the first transaction party, the identifier of the second transaction party and the identifier of the constraining party to the consensus node, so that the consensus node respectively determines the constraint file information according to the identifier of the first transaction party, the identifier of the second transaction party and the identifier of the constraining party. The identifier searches for the public keys of the first transaction party, the second transaction party and the constraining party in the blockchain network, verifies the signature of the constraint file information, and if the signature verification is successful, the consensus node returns a consensus confirmation message; the business service node generates a constraint smart contract according to the constraint file information when the consensus confirmation message returned by the consensus node meets the preset consensus policy, and uploads the constraint smart contract to the blockchain network; if the constraint smart contract does not find the block of the transaction completion event corresponding to the transaction event in the blockchain network within the preset time, the first preset data transfer amount is transferred from the account of the constraining party to the account of the second transaction party. This application constrains the transaction event between the first transaction party and the second transaction party through the constraining party, and uploads the constraint file information to the blockchain network. If the transaction event is not completed within the preset time, the smart contract is called to transfer the first preset data transfer amount from the account of the constraining party to the account of the second transaction party according to the constraint file information. The implementation of this application can improve the efficiency of data transfer and ensure the reliability of data transfer in transaction events. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 A flowchart of a method for data transfer based on blockchain provided in an embodiment of the present application;
[0036] Figure 2 An application scenario diagram of a method for data transfer based on blockchain provided in an embodiment of the present application;
[0037] Figure 3 A structural block diagram of a blockchain-based data transfer system provided in an embodiment of the present application;
[0038] Figure 4A structural block diagram of a device for data transfer based on blockchain provided in an embodiment of the present application;
[0039] Figure 5 A structural block diagram of a blockchain-based data transfer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0040] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0041] The implementation of the technical solution of the present application is further described in detail below in conjunction with the accompanying drawings.
[0042] See also Figure 1 , Figure 1 A flowchart of a method for data transfer based on blockchain provided in an embodiment of the present application. Figure 1 As shown, the specific execution steps of this embodiment are as follows:
[0043] S100, the business service node receives the constraint file information sent by the first node, the constraint file information includes the first digital signature, the second digital signature, the third digital signature, the identifier of the transaction event, the preset time, the first preset data transfer amount, the account information of the second transaction party, and the account information of the constraining party. Specifically, the business service node can be any node in the blockchain network.
[0044] The transaction event is described below. In a possible implementation, before the business service node receives the constraint file information sent by the first node, it includes: the business service node receives a transaction event submission request submitted by a third node, and the transaction event submission request carries the identifier of the transaction event, the identifier of the first transaction party, the identifier of the second transaction party, at least two digital signatures, the transaction object, and the transaction data transfer amount. Specifically, the transaction event includes the first transaction party and the second transaction party, and the third node can be the terminal device of the first transaction party or the terminal device of the second transaction party, or the first transaction party and the second transaction party send the transaction event submission request to the business service node through other terminal devices. Optionally, the transaction data transfer amount is not less than the first preset data transfer amount. The transaction event can be understood as the data transfer agreed upon between the first transaction party and the second transaction party. For example, a first transaction party A and a second transaction party B conduct a goods transaction, such as A first gives B an e-book C, and B gives A an e-book D before January 20, 2020. The transaction object in the transaction event submission request refers to the object to be redeemed first, which is e-book C here, and the data transfer amount in the transaction event submission request refers to the object to be redeemed later, which is e-book D here. Furthermore, a code segment is generated for this transaction event when A sends e-book C to B, and B receives e-book C and promises to give A an e-book D before January 20, 2020. The transaction event submission request is to submit the generated code segment, define e-book C as the transaction object, and define e-book D as the data transfer amount in the code. The identifier of the transaction event can be the function name of the code segment or the module name of the code segment encapsulated into a module, etc. It can be understood that goods can also be a kind of virtual goods. For example, in an electronic game, game player A makes a request to B to exchange equipment A for B's special effect B. B accepts the request and then receives equipment A from A. The object in the transaction event submission request refers to the object that makes the application, which is equipment A in this case, and the data transfer amount in the transaction event submission request refers to the object that receives the application, which is special effect B in this case. Furthermore, in response to game player A's request to B to exchange equipment A for B's special effect B, and B accepts the request, this transaction event generates another segment of code. The transaction event submission request is to submit the generated code segment, define equipment A as the transaction object, and define special effect B as the data transfer amount in the code. Similarly, the identifier of the transaction event can be the function name of the code segment or the module name of the code segment encapsulated into a module, etc.For another example, a first transaction party and a second transaction party conduct a transaction of money and goods. For example, Party A uses 100,000 yuan to buy a house from Party B, and agrees to give the money to Party B on January 20, 2020. The object in the transaction event submission request refers to the house, and the transaction data transfer amount in the transaction event submission request is 100,000 yuan. Furthermore, Party A and Party B can sign a contract for the transaction event, the identifier of the transaction event can be the contract number, and the contract includes the digital signatures of Party A and Party B, the transaction object house, and the transaction data transfer amount of 100,000 yuan.
[0045] The business service node sends the transaction event submission request to the consensus node, so that the consensus node searches for the public key of the first transaction party and the public key of the second transaction party in the blockchain network according to the identifier of the first transaction party and the identifier of the second transaction party, and verifies the at least two digital signatures in the transaction event submission request to obtain the fourth verification code and the fifth verification code; the consensus node performs a hash operation on the transaction event submission request to obtain the sixth verification code; if the fourth verification code, the fifth verification code and the sixth verification code are the same, the consensus node returns a consensus confirmation message. Specifically, the consensus confirmation message can be considered to confirm that the at least two digital signatures carried in the transaction event submission request are the digital signatures of the first transaction party and the second transaction party. When the business service node receives the consensus confirmation message returned by the consensus node and meets the preset consensus policy, it generates a block to be added according to the transaction event submission request, and uploads the block to be added to the blockchain. Exemplarily, the blockchain network includes multiple consensus nodes, and the multiple consensus nodes may include a second business service node, a third business service node and / or a third business service node, etc. The preset consensus strategy may be that the number of consensus nodes that return consensus confirmation messages is not less than a first preset number. The first preset number may be 60, 70 or 90, etc. For example, the blockchain network includes 100 consensus nodes, the first preset number is 90, and when the number of consensus nodes that return consensus confirmation messages is not less than 90, the business service node determines that the consensus confirmation message returned by the consensus node satisfies the preset consensus strategy. For another example, the blockchain network includes multiple consensus nodes, and the preset consensus strategy is that the proportion of consensus nodes that return consensus confirmation messages to all nodes in the blockchain network is greater than the first preset ratio threshold. The first preset ratio threshold may be 50%, 60% or 70%, etc. For example, the blockchain network includes 1000 consensus nodes, the first preset ratio threshold is 50%, and when the number of consensus nodes that return consensus confirmation messages exceeds 500, the first business service node determines that the consensus confirmation message returned by the consensus node satisfies the preset consensus strategy, and the block of the transaction event submission request may be uploaded to the blockchain network.
[0046] S101, the business service node sends the constraint file information, the identifier of the first transaction party, the identifier of the second transaction party and the identifier of the constraining party to the consensus node, so that the consensus node searches for the public keys of the first transaction party, the second transaction party and the constraining party in the blockchain network according to the identifier of the first transaction party, the identifier of the second transaction party and the identifier of the constraining party, and verifies the signature of the constraint file information. If the signature verification is successful, the consensus node returns a consensus confirmation message. Specifically, the consensus node decrypts the constraint file information according to the public keys of the first transaction party, the second transaction party and the constraining party, and obtains the seventh check code, the eighth check code and the ninth check code respectively; the consensus node performs a hash operation on the constraint file information to obtain the tenth check code; if the seventh check code, the eighth check code, the ninth check code and the tenth check code are the same, it is confirmed that the signature verification of the constraint file information is successful.
[0047] S102, when the consensus confirmation message returned by the consensus node received by the business service node satisfies the preset consensus policy, a constraint smart contract is generated according to the constraint file information, and the constraint smart contract is uploaded to the blockchain network. Specifically, after step S101, the business service node determines whether the consensus confirmation message returned by the consensus node satisfies the preset consensus policy, for example, the preset consensus policy may be that the number of consensus nodes returning the consensus confirmation message is not less than the second preset number. The blockchain network includes multiple consensus nodes, and the multiple consensus nodes may include a first consensus node and a second consensus node, etc. The multiple consensus nodes may also include a second business service node, a third business service node and / or a third business service node, etc. Exemplarily, the blockchain network includes 100 consensus nodes, and the second preset number may be 50, 60 or 65, etc. If the second preset number is 60, when the consensus nodes returning the consensus confirmation message are not less than 60, the business service node determines that the consensus confirmation message returned by the consensus node satisfies the preset consensus policy. For another example, the preset consensus strategy is that the proportion of consensus nodes that return consensus confirmation messages to all nodes in the blockchain network is greater than a second preset ratio threshold. The blockchain network includes multiple consensus nodes. For example, the blockchain network includes 1,000 consensus nodes. The second preset ratio threshold can be 50%, 60%, or 65%. If the second preset ratio threshold is 60%, when the number of consensus nodes that return consensus confirmation messages exceeds 600, the business service node determines that the consensus confirmation message returned by the consensus node meets the preset consensus strategy. If the business service node determines that the consensus confirmation message returned by the consensus node satisfies the preset consensus strategy, further, the business service node can also search the blockchain network for the data transfer amount of the first transaction party within a preset time period according to the identifier of the first transaction party. If the data transfer amount transferred to the account of the first transaction party within the preset time period is greater than the third preset data transfer amount, the smart contract is triggered to extract the first digital signature, the second digital signature, the third digital signature, the identifier of the transaction event, the preset time, the first preset data transfer amount, the account information of the second transaction party and the account information of the constraining party included in the constraint file information, fill them into the smart contract, generate the constraint smart contract, and upload the constraint smart contract to the blockchain network.
[0048] S103. If the constraint smart contract fails to find the block of the transaction completion event corresponding to the transaction event in the blockchain network within a preset time, the first preset data transfer amount is transferred from the account of the constraining party to the account of the second transaction party.
[0049] Specifically, after uploading the constraint smart contract to the blockchain network in step S102: the business service node receives the transaction completion event information sent by the second node, and the transaction completion event information includes at least two digital signatures; the business service node sends the transaction completion event information, the identifier of the first transaction party, and the identifier of the second transaction party to the consensus node, and the consensus node searches for the public key of the first transaction party and the public key of the second transaction party in the blockchain network according to the identifier of the first transaction party and the identifier of the second transaction party, verifies the signature of the transaction completion event, and obtains a first verification code and a second verification code respectively; the consensus node performs a hash operation on the transaction completion event information to obtain a third verification code; if the first verification code, the second verification code and the third verification code are the same, the consensus node returns a consensus confirmation message; when the business service node receives the consensus confirmation message returned by the consensus node and satisfies the preset consensus policy, a block of the transaction completion event corresponding to the transaction event is generated according to the transaction completion event information, and the block of the transaction completion event is uploaded to the blockchain network. Here, at least two signatures in the transaction completion event are verified to verify that the at least two digital signatures are the digital signatures of the first transaction party and the second transaction party, thereby ensuring the authenticity of the transaction completion event. The consensus strategy can be that the number of consensus nodes that return consensus confirmation messages is not less than a third preset number. The blockchain network includes multiple consensus nodes, and the multiple consensus nodes may include a first consensus node and a second consensus node, etc. The multiple consensus nodes may also include a second business service node, a third business service node and / or a third business service node, etc. Exemplarily, the blockchain network includes 100 consensus nodes, and the third preset number may be 55, 65 or 75, etc. If the third preset number is 65, when the consensus nodes that return the consensus confirmation message are not less than 65, the business service node determines that the consensus confirmation message returned by the consensus node meets the preset consensus strategy. The preset consensus strategy may also be that the proportion of consensus nodes that return consensus confirmation messages to all nodes in the blockchain network is greater than the third preset ratio threshold. The blockchain network includes multiple consensus nodes. Exemplarily, the blockchain network includes 1,000 consensus nodes. The third preset ratio threshold may be 55%, 65% or 75%, etc. If the third preset ratio threshold is 65%, when the number of consensus nodes returning a consensus confirmation message exceeds 650, the business service node determines that the consensus confirmation message returned by the consensus node satisfies a preset consensus policy.
[0050] If the smart contract fails to find the block of the transaction completion event corresponding to the transaction event in the blockchain network within the preset time, for example, the preset time is January 20, 2010, and the first transaction party and the second transaction party still fail to complete the transaction within the preset time, that is, the block of the transaction completion event is not in the blockchain, the constraint smart contract automatically transfers the first preset data transfer amount from the account of the constraining party to the account of the second transaction party. For example, the first preset data transfer amount is 100,000 yuan, the account of the constraining party is "123456", and the account of the second trading party is "456789", then the constraint smart contract transfers 100,000 yuan from the account "123456" to the account "4567899"; for another example, the first preset data transfer amount is the e-book D, the account of the constraining party is "aaa", and the account of the second trading party is "bbb", then the constraint smart contract transfers the e-book D from the account "aaa" to the account "bbb"; for another example, the first preset data transfer amount is special effect B, the account of the constraining party is "A12", and the account of the second trading party is "A13", then the constraint smart contract transfers the special effect B from the account "A12" to the account "A13", and so on.
[0051] Furthermore, the constraint file information also includes the transaction object in the transaction event; after the first preset data transfer amount is transferred from the account of the constraining party to the account of the second transaction party in step S103, the constraint smart contract marks the state of the transaction object as a locked state. Specifically, taking the transaction event in which the first transaction party A uses equipment A to exchange special effect B with the second transaction party B as an example, the transaction object is special effect B. If the second transaction party does not send special effect B to the first transaction party within the preset time, the constraint smart contract automatically transfers special effect B from the account of the constraining party to the account of the second transaction party, and then locks special effect B of B. When special effect B is in a locked state, special effect B cannot be used by the second transaction party B.
[0052] Furthermore, if the business service node detects that the first transaction party transfers the second preset data transfer amount to the account of the constraining party, the constraint smart contract is called to change the state of the transaction object from a locked state to an unlocked state. Specifically, if the second transaction party transfers the second preset data, such as B special effect and / or 5 experience points, to the constraining party, the constraint smart contract unlocks the transaction object, and the B special effect of the second transaction party is in an unlocked state, and the second transaction party B can reuse the B special effect.
[0053] In a possible embodiment, if the constraint smart contract detects a block of the transaction completion event corresponding to the transaction event in the blockchain network within the preset time, the transaction completion event is saved in the constraint smart contract, and the state of the constraint smart contract is marked as completed. Specifically, in step S103, if the constraint smart contract does not detect a block of the transaction completion event in the blockchain network within the preset time, the first preset data transfer amount is automatically transferred from the account of the constrained party to the second transaction party. If the constraint smart contract can find the block of the transaction completion event in the blockchain within the preset time, it means that the transaction between the first transaction party and the second transaction party has been completed, and the constraint smart contract does not need to be automatically executed. Marking the constraint smart contract as completed can be understood as no longer executing the code segment for transferring the first preset transfer data from the account of the constrained party to the account of the second transaction party.
[0054] The present application constrains a transaction event between a first transaction party and a second transaction party through a constraining party, and uploads the constraint file information to a blockchain network. If the transaction event is not completed within a preset time, a smart contract is called to transfer a first preset data transfer amount from the constraining party's account to the second transaction party's account according to the constraint file information. The implementation of the present application can improve the efficiency of data transfer and ensure the reliability of data transfer in transaction events.
[0055] The following is an exemplary description of an application scenario of a blockchain-based data transfer method with reference to the accompanying drawings.
[0056] See also Figure 2 , Figure 2 This is an application scenario diagram of a method for data transfer based on blockchain provided in an embodiment of the present application. Figure 2As shown, a transaction event is carried out between the first transaction party A and the second transaction party B: A sends A to B, and B sends B to A; for the transaction event between A and B, the third node 21 executes step S200 to send a transaction event submission request to the first business service node 20. The third node 21 can be the terminal device of the first transaction party A or the terminal device of the second transaction party B. The transaction submission request carries the transaction event identifier "111", the first transaction party "A", the second transaction party "B", the transaction object A, the transaction data transfer amount C1, the digital signature 1 and the digital signature 2. For example, A uses 10 Q coins to buy a set of equipment B from B. A represents equipment B, and the transaction data transfer amount C1 is 10 Q coins. After receiving the transaction event submission request sent by the third node 21, the business service node 20 executes step S201 to send the transaction event submission request to the consensus node. The consensus node may include multiple nodes, such as the first consensus node 24 and / or the second consensus node 25, etc. The consensus node verifies the signature according to the transaction event submission request. The specific verification process can be referred to in conjunction with the above. Figure 1 The described embodiments are not described in detail here. After the consensus node successfully verifies the signature, it returns a consensus confirmation message to the business service node 20. The business service node 20 returns the consensus confirmation message to the business service node 20 when the consensus confirmation message returned by the consensus node satisfies the preset consensus policy. For example, the consensus policy may be that the number of consensus nodes returning the consensus confirmation message is not less than a fourth preset number, or the consensus policy may be that the number of consensus nodes returning the consensus confirmation message is not less than a fourth preset ratio threshold. Thus, the business service node 20 determines that the digital signature 1 and the digital signature 2 in the transaction event submission request are the digital signatures of the first transaction party A and the second transaction party B, respectively, to ensure the authenticity of the transaction event submission request. The business service node 20 executes step S202 to upload the block to be added generated by the transaction event submission request to the blockchain network.
[0057] The first node 22 executes step S203 to send constraint file information to the business service node 20, where the constraint file information is determined based on the transaction event. The first node 22 may search for the transaction event in the blockchain network after receiving the constraint application request submitted by the first transaction party A or the second transaction party B, and generate a constraint file based on the transaction event. The constraint file information includes the transaction event identifier "111", the preset time January 20, 2020, the first preset data transfer amount C2, the account "123456" of the second transaction party B, the account "456789" of the constraining party, digital signature 3, digital signature 4 and digital signature 5. Exemplarily, the first preset data transfer amount C2 may be the same as the transaction data transfer amount C1, such as 10 Q coins. After receiving the constraint file information, the business service node 20 executes step S204 to send the constraint file information to the consensus node. The consensus node may include multiple nodes, such as the first consensus node 24 and / or the second consensus node 25, etc. The consensus node verifies the signature according to the constraint file information. The specific verification process can be referred to in conjunction with the above text. Figure 1 The described embodiments are not described in detail here. After the consensus node successfully verifies the signature, it returns a consensus confirmation message to the business service node 20. When the consensus confirmation message returned by the consensus node satisfies the preset consensus strategy, for example, the consensus strategy may be that the number of consensus nodes returning the consensus confirmation message is not less than the fifth preset number, or the consensus strategy may be that the number of consensus nodes returning the consensus confirmation message is not less than the fifth preset ratio threshold. Thus, the business service node 20 confirms that the digital signature 3, digital signature 4 and digital signature 5 in the constraint file information are the digital signatures of the first transaction party A, the second transaction party B and the constraining party respectively, ensuring the authenticity of the constraint file information. The business service node 20 executes step S205 to generate a constraint smart contract. If the second node 23 executes step S206 before the preset time to upload a transaction completion event to the business service node 20, the transaction completion event includes the transaction event identifier "111", digital signature 6 and digital signature 7. The business service node uploads the transaction completion event to the consensus node. The consensus node may include multiple nodes, such as the first consensus node 24 and / or the second consensus node 25, etc. The consensus node verifies the signature according to the transaction completion event. The specific verification process can refer to the above text in combination with Figure 1The described embodiments are not described here in detail. After the consensus node successfully verifies the signature, it returns a consensus confirmation message to the business service node 20. When the consensus confirmation message returned by the consensus node satisfies the preset consensus strategy, for example, the consensus strategy may be that the number of consensus nodes returning the consensus confirmation message is not less than the sixth preset number, or the consensus strategy may be that the number of consensus nodes returning the consensus confirmation message is not less than the sixth preset ratio threshold. Thus, the business service node confirms that the digital signature 6 and the digital signature 7 in the transaction completion event are the digital signatures of the first transaction party A and the second transaction party B, respectively, to ensure the authenticity of the transaction completion event, and the business service node 20 uploads the block of the transaction completion event corresponding to the transaction completion event to the blockchain network. When the business service node 20 performs step S207 at the preset time to search for the block corresponding to the transaction completion event in the blockchain network, the block of the transaction completion event can be found, and the business service node performs step S208a to mark the state of the constraint smart contract as completed. If the second node 23 does not execute step S206, that is, does not upload the transaction completion event to the business service node 20 within the preset time, the business service node 20 cannot find the block corresponding to the transaction completion event in the blockchain network when executing step S207, and the business service node calls the constraint smart contract to execute step S208b, and transfers C2 from the account "456789" of the constrained party C to the account "123456" of the second transaction party B. For example, 10 Q coins are transferred from the account "456789" to the account "123456". Further, the business service node 20 can continue to execute step S209 to mark the transaction object A as locked, that is, to lock the equipment B sent by the second transaction party B to the second transaction party, which means that the first transaction party A cannot use equipment B. If the business service node detects that the first transaction party A transfers the transfer data volume C3, for example, 10 Q coins, to the account "456789" of the constraining party C, the business service node 20 executes step S210 to mark the transaction object A as unlocked, for example, unlocking A's equipment B. The first transaction party A can use equipment B when the transaction object is in the unlocked state.
[0058] The following is a data transfer system based on blockchain provided by the embodiment of the present application in conjunction with the accompanying drawings. Figure 3 , Figure 3 This is a block diagram of a data transfer system based on blockchain provided in an embodiment of the present application. Figure 3As shown, the blockchain-based data transfer system 30 includes: a business service node 300, a first node 301, a first consensus node 302, a second consensus node 303, a second node 304 and a third node 305, etc., wherein:
[0059] The business service node 300 can be a server or other terminal device with receiving and sending functions. The business service node 300 is used to receive information and requests, for example, the business service node 300 is used to receive constraint file information, transaction completion event information and transaction event submission request; the business service node 300 is also used to send information and requests, for example, the business service node 300 is also used to send the received information and request to the consensus node. The consensus node may include multiple nodes, such as a first consensus node 302 and a second consensus node 303, which are used to perform consensus confirmation on the request data submitted by the business service node 300, and return a consensus confirmation message to the business service node 300 after consensus confirmation. The consensus node may also include multiple consensus nodes, which is only used for exemplary explanation here. The first node 301 may be a terminal device of the first transaction party or the second transaction party, and the first node 301 is used to send constraint file information to the business service node 300; the second node 304 may also be a terminal device of the first transaction party or the second transaction party, and the second node 304 is used to send transaction completion event information to the business service node 300; the third node 305 may be a terminal device of the first transaction party, the second transaction party or the constraint party, and the third node 305 is used to submit a transaction event submission request to the business service node 300. The first node 301, the second node 304 and the third node 305 may be the same terminal device, and the business service node 300, the first node 301, the first consensus node 302, the second consensus node 303, the second node 304 and the third node 305 are all nodes in the blockchain network.
[0060] The present application also provides a data transfer device based on blockchain, see Figure 4 , Figure 4 This is a structural block diagram of a device for data transfer based on blockchain provided in an embodiment of the present application. Figure 4 As shown, the blockchain-based data transfer device 40 includes:
[0061] The receiving module 400 is used to receive the constraint file information sent by the first node, wherein the constraint file information is determined according to the transaction event occurring between the first transaction party and the second transaction party, and the constraint file information includes the first digital signature, the second digital signature, the third digital signature, the identifier of the transaction event, the preset time, the first preset data transfer amount, the account information of the second transaction party, and the account information of the constraining party;
[0062] The sending module 401 is used to send the constraint file information, the identifier of the first transaction party, the identifier of the second transaction party and the identifier of the constraining party to the consensus node, so that the consensus node searches for the public keys of the first transaction party, the second transaction party and the constraining party in the blockchain network according to the identifier of the first transaction party, the identifier of the second transaction party and the identifier of the constraining party, and verifies the signature of the constraint file information; the consensus node decrypts the constraint file information according to the public keys of the first transaction party, the second transaction party and the constraining party, and obtains the seventh check code, the eighth check code and the ninth check code respectively; the consensus node performs a hash operation on the constraint file information to obtain the tenth check code; if the seventh check code, the eighth check code, the ninth check code and the tenth check code are the same, it is confirmed that the signature verification of the constraint file information is successful; if the signature verification is successful, the consensus node returns a consensus confirmation message;
[0063] A generation module 402 is used to generate a constraint smart contract according to the constraint file information when the consensus confirmation message returned by the consensus node meets the preset consensus policy;
[0064] The sending module 401 is also used to upload the constraint smart contract to the blockchain network;
[0065] The transfer module 403 is used to transfer the first preset data transfer amount from the account of the constraining party to the account of the second transaction party if the block of the transaction completion event corresponding to the transaction event is not found in the blockchain network within the preset time.
[0066] In a possible implementation, the receiving module 400 is further used for the business service node to receive transaction completion event information sent by the second node, where the transaction completion event information includes at least two digital signatures;
[0067] The sending module 401 sends the transaction completion event information, the identifier of the first transaction party, and the identifier of the second transaction party to the consensus node, so that the consensus node searches for the public key of the first transaction party and the public key of the second transaction party in the blockchain network according to the identifier of the first transaction party and the identifier of the second transaction party, verifies the signature of the transaction completion event, and obtains a first verification code and a second verification code respectively; the consensus node performs a hash operation on the transaction completion event information to obtain a third verification code; if the first verification code, the second verification code, and the third verification code are the same, the consensus node returns a consensus confirmation message;
[0068] When the consensus confirmation message returned by the consensus node received by the receiving module 400 satisfies the preset consensus strategy, the generating module 402 is further used to generate a block of the transaction completion event corresponding to the transaction event according to the transaction completion event information, and the sending module 401 is further used to upload the block of the transaction completion event to the blockchain network.
[0069] In a possible embodiment, the blockchain-based data transfer device 40 further includes a marking module 404, and the constraint file information further includes a transaction object in the transaction event;
[0070] The marking module 404 is used to mark the state of the transaction object as a locked state after the transfer module 403 transfers the first preset data transfer amount from the account of the constraining party to the account of the second transaction party.
[0071] Furthermore, the blockchain-based data transfer device 40 also includes a detection module 405, which is used to detect whether the first transaction party transfers the second preset data transfer amount to the account of the constraining party. The marking module 404 is also used to change the state of the transaction object from a locked state to an unlocked state after the detection module 405 detects that the first transaction party transfers the second preset data transfer amount to the account of the constraining party.
[0072] Optionally, the receiving module 400 is further configured to receive a transaction event submission request submitted by a third node, wherein the transaction event submission request carries an identifier of the transaction event, an identifier of the first transaction party, an identifier of the second transaction party, at least two digital signatures, a transaction object, and a transaction data transfer amount; the transaction data transfer amount is not less than the first preset data transfer amount;
[0073] The sending module 401 is further used to send the transaction event submission request to the consensus node, so that the consensus node searches for the public key of the first transaction party and the public key of the second transaction party in the blockchain network according to the identifier of the first transaction party and the identifier of the second transaction party, and verifies at least two digital signatures in the transaction event submission request to obtain a fourth verification code and a fifth verification code; the consensus node performs a hash operation on the transaction event submission request to obtain a sixth verification code; if the fourth verification code, the fifth verification code and the sixth verification code are the same, the consensus node returns a consensus confirmation message;
[0074] When the consensus confirmation message returned by the consensus node received by the receiving module 400 satisfies the preset consensus strategy, the generating module 402 generates a block to be added according to the transaction event submission request, and the sending module 401 uploads the block to be added to the blockchain.
[0075] In a possible embodiment, if the detection module 405 detects a block of a transaction completion event corresponding to the transaction event in the blockchain network within the preset time, the marking module 404 saves the transaction completion event in the constraint smart contract and marks the status of the constraint smart contract as completed.
[0076] See also Figure 5 , Figure 5 This is a block diagram of a device for data transfer based on blockchain provided in an embodiment of the present application. Figure 5 As shown, the data transfer device 50 includes a transceiver 500, a processor 501 and a memory 502, wherein:
[0077] The transceiver 500 is used to receive constraint file information, transaction completion event information, transaction event submission request and consensus confirmation message returned by consensus node. The processor 500 can be a central processing unit (CPU), and the processor can also be other general processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general processor can be a microprocessor or the processor can also be any conventional processor, etc.
[0078] The memory 502 stores instructions. It is understood that the memory 502 stores the cooperation project data. Exemplarily, the memory 502 may include a read-only memory and a random access memory, and provide instructions and data to the processor 501 and the transceiver 500. A portion of the memory 502 may also include a non-volatile random access memory. For example, the memory 502 may also store information about the device type.
[0079] The processor 501 is used to execute the computer program stored in the memory to implement any possible embodiment described above.
[0080] In a specific implementation, the service application device can execute the above-mentioned Figures 1 to 3 For details on the implementation methods provided in each step, please refer to the above Figures 1 to 3 The implementation methods provided in each step will not be repeated here.
[0081] The present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, and when the computer-readable storage medium is run on the computer, the computer executes any one of the possible embodiments described above.
[0082] It should be noted that the above terms “first” and “second” are only used for descriptive purposes and should not be understood as indicating or implying relative importance.
[0083] In the several embodiments provided in the present application, it should be understood that the disclosed methods, devices and systems can be implemented in other ways. The embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0084] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0085] In addition, all functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may be separately used as a unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0086] A person skilled in the art can understand that: all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), disks or optical disks, etc. Various media that can store program codes.
[0087] Alternatively, if the above-mentioned integrated unit of the present invention is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention can be essentially or partly reflected in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, magnetic disks or optical disks.
[0088] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A data transfer method based on blockchain, characterized in that: The method comprises: The business service node receives the constraint file information sent by the first node, the constraint file information is determined according to the transaction event occurring between the first transaction party and the second transaction party, the constraint file information includes a first digital signature, a second digital signature, a third digital signature, an identifier of the transaction event, a preset time, a first preset data transfer amount, account information of the second transaction party, and account information of the constraining party, the first digital signature is a digital signature of the first transaction party, the second digital signature is a digital signature of the second transaction party, and the third digital signature is a digital signature of the constraining party; The business service node sends the constraint file information, the identifier of the first transaction party, the identifier of the second transaction party, and the identifier of the constraining party to the consensus node, so that the consensus node searches for the public keys of the first transaction party, the second transaction party, and the constraining party in the blockchain network according to the identifier of the first transaction party, the identifier of the second transaction party, and the identifier of the constraining party, respectively, and verifies the signature of the constraint file information. If the signature verification is successful, the consensus node returns a consensus confirmation message; When the business service node receives a consensus confirmation message returned by the consensus node that satisfies the preset consensus policy, it generates a constraint smart contract according to the constraint file information and uploads the constraint smart contract to the blockchain network; If the constraint smart contract fails to find the block of the transaction completion event corresponding to the transaction event in the blockchain network within the preset time, the first preset data transfer amount is transferred from the account of the constraining party to the account of the second transaction party.
2. The method according to claim 1, characterized in that After uploading the constraint smart contract to the blockchain network, the following steps are included: The business service node receives transaction completion event information sent by the second node, where the transaction completion event information includes at least two digital signatures; The business service node sends the transaction completion event information, the identifier of the first transaction party, and the identifier of the second transaction party to the consensus node, so that the consensus node searches for the public key of the first transaction party and the public key of the second transaction party in the blockchain network according to the identifier of the first transaction party and the identifier of the second transaction party, verifies the signature of the transaction completion event, and obtains a first verification code and a second verification code respectively; the consensus node performs a hash operation on the transaction completion event information to obtain a third verification code; if the first verification code, the second verification code, and the third verification code are the same, the consensus node returns a consensus confirmation message; When the consensus confirmation message returned by the consensus node received by the business service node satisfies the preset consensus strategy, a block of the transaction completion event corresponding to the transaction event is generated according to the transaction completion event information, and the block of the transaction completion event is uploaded to the blockchain network.
3. The method according to claim 1, characterized in that The constraint file information also includes the transaction object in the transaction event; After transferring the first preset data transfer amount from the account of the constraining party to the account of the second transaction party, the method further comprises: The constraint smart contract marks the state of the transaction object as a locked state.
4. The method according to claim 3, characterized in that The method further comprises: If the business service node detects that the first transaction party transfers the second preset data transfer amount to the account of the constraining party, the constraint smart contract is called to change the state of the transaction object from a locked state to an unlocked state.
5. The method according to claim 1, characterized in that Before the business service node receives the constraint file information sent by the first node, the process includes: The business service node receives a transaction event submission request submitted by the third node, where the transaction event submission request carries an identifier of the transaction event, an identifier of the first transaction party, an identifier of the second transaction party, at least two digital signatures, a transaction object, and a transaction data transfer amount; The business service node sends the transaction event submission request to the consensus node, so that the consensus node searches for the public key of the first transaction party and the public key of the second transaction party in the blockchain network according to the identifier of the first transaction party and the identifier of the second transaction party, and verifies the signature of the transaction event submission request to obtain a fourth verification code and a fifth verification code; the consensus node performs a hash operation on the transaction event submission request to obtain a sixth verification code; if the fourth verification code, the fifth verification code and the sixth verification code are the same, the consensus node returns a consensus confirmation message; When the consensus confirmation message returned by the consensus node received by the business service node satisfies the preset consensus strategy, a block to be added is generated according to the transaction event submission request, and the block to be added is uploaded to the blockchain network.
6. The method according to claim 1, characterized in that The method further comprises: If the constraint smart contract detects a block of a transaction completion event corresponding to the transaction event in the blockchain network within the preset time, the transaction completion event is saved in the constraint smart contract, and the status of the constraint smart contract is marked as completed.
7. The method according to claim 1, characterized in that The checking the signature of the constraint file information includes: The consensus node decrypts the constraint file information according to the public keys of the first transaction party, the second transaction party and the constraining party to obtain the seventh verification code, the eighth verification code and the ninth verification code respectively; the consensus node performs a hash operation on the constraint file information to obtain the tenth verification code; if the seventh verification code, the eighth verification code, the ninth verification code and the tenth verification code are the same, it is confirmed that the verification of the constraint file information is successful.
8. A data transfer device based on blockchain, characterized in that: The device comprises: a receiving module, configured to receive constraint file information sent by the first node, wherein the constraint file information is determined according to a transaction event occurring between the first transaction party and the second transaction party, and the constraint file information includes a first digital signature, a second digital signature, a third digital signature, an identifier of the transaction event, a preset time, a first preset data transfer amount, account information of the second transaction party, and account information of the constraining party, wherein the first digital signature is a digital signature of the first transaction party, the second digital signature is a digital signature of the second transaction party, and the third digital signature is a digital signature of the constraining party; A sending module, used to send the constraint file information, the identifier of the first transaction party, the identifier of the second transaction party, and the identifier of the constraining party to the consensus node, so that the consensus node searches for the public keys of the first transaction party, the second transaction party, and the constraining party in the blockchain network according to the identifier of the first transaction party, the identifier of the second transaction party, and the identifier of the constraining party, respectively, and verifies the signature of the constraint file information. If the signature verification is successful, the consensus node returns a consensus confirmation message; A generation module, configured to generate a constraint smart contract according to the constraint file information when the consensus confirmation message returned by the consensus node satisfies the preset consensus policy; The sending module is also used to upload the constraint smart contract to the blockchain network; The transfer module is used to transfer the first preset data transfer amount from the account of the constraining party to the account of the second transaction party if a block of the transaction completion event corresponding to the transaction event is not found in the blockchain network within the preset time.
9. A data transfer device based on blockchain, characterized in that: The device comprises a transceiver, a processor and a memory, wherein the processor is configured to execute a computer program stored in the memory to implement the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the steps of the method according to any one of claims 1 to 7.
11. A computer program product comprising computer instructions, characterized in that: The computer instructions are used to enable a computer device to execute the steps of the method as claimed in any one of claims 1 to 7.
Citation Information
Patent Citations
Method and equipment for implementing blockchain operating smart contract
CN108769173A
Data processing method and device based on smart contract and storage medium
CN110599145A