CN115131022B - Block chain based digital asset transaction method, device, equipment and medium - Google Patents
Block chain based digital asset transaction method, device, equipment and medium Download PDFInfo
- Publication number
- CN115131022B CN115131022B CN202211029718.4A CN202211029718A CN115131022B CN 115131022 B CN115131022 B CN 115131022B CN 202211029718 A CN202211029718 A CN 202211029718A CN 115131022 B CN115131022 B CN 115131022B
- Authority
- CN
- China
- Prior art keywords
- transaction
- message
- node
- block chain
- accounting
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q20/00—Payment architectures, schemes or protocols
- G06Q20/38—Payment protocols; Details thereof
- G06Q20/382—Payment protocols; Details thereof insuring higher security of transaction
- G06Q20/3825—Use of electronic signatures
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q20/00—Payment architectures, schemes or protocols
- G06Q20/38—Payment protocols; Details thereof
- G06Q20/389—Keeping log of transactions for guaranteeing non-repudiation of a transaction
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q20/00—Payment architectures, schemes or protocols
- G06Q20/38—Payment protocols; Details thereof
- G06Q20/40—Authorisation, e.g. identification of payer or payee, verification of customer or shop credentials; Review and approval of payers, e.g. check credit lines or negative lists
- G06Q20/401—Transaction verification
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q40/00—Finance; Insurance; Tax strategies; Processing of corporate or income taxes
- G06Q40/04—Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
Landscapes
- Business, Economics & Management (AREA)
- Accounting & Taxation (AREA)
- Engineering & Computer Science (AREA)
- Finance (AREA)
- General Physics & Mathematics (AREA)
- General Business, Economics & Management (AREA)
- Physics & Mathematics (AREA)
- Strategic Management (AREA)
- Theoretical Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Development Economics (AREA)
- Economics (AREA)
- Marketing (AREA)
- Technology Law (AREA)
- Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
Abstract
The invention relates to the technical field of financial data processing, and discloses a block chain-based digital asset transaction method, device, equipment and medium, wherein the method comprises the following steps: when a main node in the block chain network receives a transaction request initiated by a data asset purchasing end, the main node verifies transaction information corresponding to the transaction request; after the verification is passed, the main node broadcasts transaction requests to all accounting nodes in the block chain network; and if the number of the transaction requests verified by the accounting node exceeds a preset threshold value, the consensus of the transaction requests in the blockchain network is completed, and the transaction of the digital assets between the data asset owning end and the data asset purchasing end is achieved. The invention can realize the mutual trust online transaction of two-way transaction parties when the digital asset transaction is carried out through the block chain.
Description
Technical Field
The invention relates to the technical field of financial data processing, in particular to a block chain-based digital asset transaction method, device, equipment and medium.
Background
Currently, with the development of blockchain technology, data chaining has become a trend, and non-monetary assets are also present in blockchains. When a plurality of different assets exist in a block chain system at the same time, when a transaction partner performs a transaction between different digital assets, in a conventional mode, a data asset owning terminal provides data assets to a data asset purchasing terminal on line, and the data asset purchasing terminal also provides money assets to the data asset owning terminal on line. This model enables exchange on the premise that the two parties to the transaction must trust each other; because of the decentralized and distrust of the blockchain, the online two-way transaction process is not guaranteed, and the data asset purchasing end may not provide the monetary asset after the data asset purchasing end provides the data asset; or after the data asset purchaser provides the monetary assets, the data asset purchaser does not provide the data assets.
Disclosure of Invention
The invention mainly aims to provide a block chain-based digital asset transaction method, a block chain-based digital asset transaction device and a block chain-based digital asset transaction medium, and aims to solve the technical problems that two transaction parties are not mutually trusted and bidirectional online transaction is difficult to realize when digital asset transaction is carried out through a block chain.
In order to achieve the above object, the present invention provides a block chain-based digital asset transaction method, which includes the following steps:
when a main node in a block chain network receives a transaction request initiated by a data asset purchasing end, the main node verifies transaction information corresponding to the transaction request;
after verification, the main node broadcasts the transaction request to each accounting node in the blockchain network;
and if the number of the transaction requests verified by the accounting node exceeds a preset threshold value, the consensus of the transaction requests in the blockchain network is completed, and the transaction of the digital assets between the data asset owning terminal and the data asset purchasing terminal is achieved.
Further, the step of verifying the transaction information corresponding to the transaction request by the master node includes:
the master node inquires whether the state attribute value is an agreement transaction in the transaction information corresponding to the transaction request;
if the state attribute value is not approved to the transaction, the main node verifies whether the digital signature of the transaction information is valid;
if the digital signature of the transaction information is valid, the verification is passed;
and if the digital signature of the transaction information is invalid, the verification fails.
Further, after the step of querying whether the state attribute value is an agreement to the transaction in the transaction information corresponding to the transaction request by the master node, the method further includes:
if the state attribute value is agreement transaction, the master node verifies the following conditions: whether the digital signature in the transaction information is valid, whether a transaction application corresponding to the current transaction request exists, whether the digital asset change amounts of the data asset purchasing end and the data asset owning end are equal, and whether the digital asset change amounts are equal to the transaction amount in the transaction information;
if all the conditions are met, the verification is passed;
if one of the two is not satisfied, the verification fails.
Further, after the step of broadcasting the transaction request to each accounting node in the blockchain network, the master node further includes:
the main node packages and signs the transaction request to obtain a first message, and broadcasts the first message to the block chain network for the first time;
the accounting node responding to the first broadcast judges the validity of the first message, after the first message is determined to be valid, the accounting node packages and signs the first message to obtain a second message, and the second message is broadcasted to the block chain network;
the accounting node responding to the second broadcast judges the validity of the second message, and after the validity of the second message is determined, the transaction request is determined to pass the verification of the accounting node.
Further, the step of determining the validity of the first message includes:
judging whether the signature corresponding to the first message is correct or not;
judging whether the message view and the current accounting node are in the same view or not;
judging whether the current accounting node receives the first message before receiving the first message;
judging whether the block height is within a preset threshold range;
and if the signature corresponding to the first message is correct, the message view and the current accounting node are in the same view, the current accounting node does not receive the first message before receiving the first message, and the block height is within a preset threshold range, determining that the first message is valid.
Further, before the step of encapsulating and signing the transaction request by the master node to obtain a first message and performing a first broadcast on the first message to the blockchain network, the method further includes;
taking any node in the block chain network as a candidate node, and taking nodes except the candidate node as voting nodes;
and taking candidate nodes with preset number before the votes voted and voted by the voting nodes as the accounting nodes.
Further, after the step of broadcasting the transaction request to each accounting node in the blockchain network by the master node after the verification is passed, the method further comprises:
and if the number of the transaction requests verified by the accounting node does not exceed a preset threshold value, the master replacement node identifies the transaction requests again in the blockchain network.
In addition, to achieve the above object, the present invention also provides a block chain-based digital asset transaction apparatus, comprising:
the verification module is used for verifying the transaction information corresponding to the transaction request when the main node in the block chain network receives the transaction request initiated by the data asset purchasing end;
a broadcast module, configured to, after verification is passed, the master node broadcasts the transaction request to each accounting node in the blockchain network;
and the transaction module is used for finishing the consensus of the transaction requests in the blockchain network and achieving the transaction of the digital assets of the data asset owning end and the data asset purchasing end if the number of the transaction requests verified by the accounting node exceeds a preset threshold value.
In addition, to achieve the above object, the present invention also provides a blockchain-based digital asset transaction apparatus including: a memory, a processor and a computer program stored on the memory and executable on the processor, the computer program configured to implement the steps of the blockchain-based digital asset transaction method as described in any of the above.
Further, to achieve the above object, the present invention also provides a computer storage medium having a computer program stored thereon, which when executed by a processor, implements the steps of the blockchain-based digital asset transaction method as described in any one of the above.
The invention provides a block chain-based digital asset transaction method, a device, equipment and a medium, wherein when a main node in a block chain network receives a transaction request initiated by a data asset purchasing end, the main node verifies transaction information corresponding to the transaction request; after verification, the main node broadcasts the transaction request to each accounting node in the blockchain network; and if the number of the transaction requests verified by the accounting node exceeds a preset threshold value, the consensus of the transaction requests in the blockchain network is completed, and the transaction of the digital assets between the data asset owning end and the data asset purchasing end is achieved.
In this embodiment, the PBFT is mainly improved to provide a new consensus verification method, and then a digital asset transaction method in approved systems (alliance chain/private chain) is provided based on the new consensus verification method. Under the premise of block chain decentralization and distrust, the data asset owning end and the data asset purchasing end can carry out malicious tampering on the data. Therefore, in this embodiment, after the data asset owning terminal agrees or rejects the previous transaction request and broadcasts the transaction request to each accounting node in the blockchain network, each accounting node further verifies the transaction information corresponding to the transaction request. And judging that the quantity of the transaction requests verified by the accounting node exceeds a preset threshold value to finish the consensus of the transaction requests in the blockchain network, thereby achieving the transaction of the digital assets between the data asset owning end and the data asset purchasing end.
Drawings
Fig. 1 is a schematic structural diagram of the hardware operation of a terminal device according to an embodiment of the present invention;
fig. 2 is a flow chart illustrating an embodiment of a blockchain-based digital asset transaction method according to the present invention.
The objects, features and advantages of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
As shown in fig. 1, fig. 1 is a schematic structural diagram of a hardware operating environment related to a terminal device according to an embodiment of the present invention.
It should be noted that fig. 1 may be a schematic structural diagram of a hardware operating environment of the terminal device. The terminal device in the embodiment of the present invention may be a device for executing the block chain-based digital asset transaction method provided in the present invention for a storage device based on a nand flash as a storage medium, and the terminal device may specifically be a mobile terminal, a data storage control terminal, a PC, a portable computer, or a like.
As shown in fig. 1, the terminal device may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a storage device 1005, a communication bus 1002. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The storage device 1005 may be a non-volatile storage device (e.g., a Flash storage device), a high-speed RAM storage device, or a non-volatile storage device (e.g., a magnetic disk storage device). The storage device 1005 may alternatively be a storage means separate from the aforementioned processor 1001.
Those skilled in the art will appreciate that the terminal device configuration shown in fig. 1 is not intended to be limiting of the terminal device and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
As shown in fig. 1, a storage device 1005, which is a kind of computer storage medium, may include therein an operating system, a network communication module, a user interface module, and a computer program. The operating system is a program that manages and controls the hardware and software resources of the sample terminal device, and supports the execution of computer programs and other software or programs.
In the terminal apparatus shown in fig. 1, the user interface 1003 is mainly used for data communication with each terminal; the network interface 1004 is mainly used for connecting a background server and performing data communication with the background server; and the processor 1001 may be configured to call a computer program stored in the storage device 1005 and perform the following operations:
when a main node in a block chain network receives a transaction request initiated by a data asset purchasing end, the main node verifies transaction information corresponding to the transaction request;
after verification, the main node broadcasts the transaction request to each accounting node in the blockchain network;
and if the number of the transaction requests verified by the accounting node exceeds a preset threshold value, the consensus of the transaction requests in the blockchain network is completed, and the transaction of the digital assets between the data asset owning end and the data asset purchasing end is achieved.
Further, the processor 1001 may call a computer program stored in the storage device 1005, and also perform the following operations:
the step of verifying the transaction information corresponding to the transaction request by the master node includes:
the master node inquires whether the state attribute value is an agreement transaction in the transaction information corresponding to the transaction request;
if the state attribute value is not approved to the transaction, the main node verifies whether the digital signature of the transaction information is valid;
if the digital signature of the transaction information is valid, the verification is passed;
and if the digital signature of the transaction information is invalid, the verification fails.
Further, the processor 1001 may call a computer program stored in the storage device 1005, and also perform the following operations:
after the step of querying whether the state attribute value is an agreement transaction in the transaction information corresponding to the transaction request by the master node, the method further includes:
if the state attribute value is agreement transaction, the master node verifies the following conditions: whether the digital signature in the transaction information is valid, whether a transaction application corresponding to the current transaction request exists, whether the digital asset change amounts of the data asset purchasing end and the data asset owning end are equal, and whether the digital asset change amounts are equal to the transaction amount in the transaction information;
if all the conditions are met, the verification is passed;
if one of the two is not satisfied, the verification fails.
Further, the processor 1001 may call a computer program stored in the storage device 1005, and also perform the following operations:
after the step of broadcasting the transaction request to each accounting node in the blockchain network, the master node further includes:
the main node packages and signs the transaction request to obtain a first message, and the first message is broadcasted to the block chain network for the first time;
the accounting node responding to the first broadcast judges the validity of the first message, after the first message is determined to be valid, the accounting node packages and signs the first message to obtain a second message, and the second message is broadcasted to the block chain network;
the accounting node responding to the second broadcast judges the validity of the second message, and after the validity of the second message is determined, the transaction request is determined to pass the verification of the accounting node.
Further, the processor 1001 may call a computer program stored in the storage device 1005, and further perform the following operations:
the step of determining the validity of the first message includes:
judging whether the signature corresponding to the first message is correct or not;
judging whether the message view and the current accounting node are in the same view or not;
judging whether the current accounting node receives the first message before receiving the first message;
judging whether the block height is within a preset threshold range;
and if the signature corresponding to the first message is correct, the message view and the current accounting node are in the same view, the current accounting node does not receive the first message before receiving the first message, and the block height is within a preset threshold range, determining that the first message is valid.
Further, the processor 1001 may call a computer program stored in the storage device 1005, and also perform the following operations:
the method comprises the steps that the main node packages and signs the transaction request to obtain a first message, and before the step of first broadcasting the first message to the block chain network, the main node further comprises the steps of;
taking any node in the block chain network as a candidate node, and taking nodes except the candidate node as voting nodes;
and taking a preset number of candidate nodes before the vote ranking voted by the voting nodes as the accounting nodes.
Further, the processor 1001 may call a computer program stored in the storage device 1005, and further perform the following operations:
after the step of broadcasting the transaction request to each accounting node in the blockchain network by the master node after the verification is passed, the method further comprises:
and if the number of the transaction requests verified by the accounting node does not exceed a preset threshold value, the master replacement node identifies the transaction requests again in the blockchain network.
Based on the above structure, various embodiments of the block chain-based digital asset transaction method of the present invention are proposed. Referring to fig. 2, fig. 2 is a flowchart illustrating a block chain-based digital asset transaction method according to an embodiment of the present invention. In this embodiment, the digital asset transaction method based on the blockchain of the present invention includes:
step S10, when a main node in the block chain network receives a transaction request initiated by a data asset purchasing end, the main node verifies transaction information corresponding to the transaction request.
And step S20, after the verification is passed, the main node broadcasts the transaction request to each accounting node in the block chain network.
And step S30, if the number of the transaction requests verified by the accounting node exceeds a preset threshold value, the consensus of the transaction requests in the blockchain network is completed, and the transaction of the digital assets between the data asset owning end and the data asset purchasing end is achieved.
BFT (Byzantine genes Problem, byzantine general), is a distributed peer-to-peer network communication fault tolerance Problem. In distributed computing, different computers act on the same set of collaboration policies by communicating information to achieve consensus. Sometimes, however, the member computers in the system may make mistakes to send wrong information, and the communication network used to transmit information may also cause information damage, so that different members in the network draw different conclusions about the strategy of the overall cooperation, thereby destroying the consistency of the system. The problem of the byzantine general is considered one of the most difficult types of fault tolerance problems.
The PBFT (Practical Byzantine Fault-tolerant algorithm) is the most famous algorithm among the problems of the Byzantine general, and the PBFT provides (n-1)/3 Fault-Tolerance on the premise of ensuring availability and safety (liveness & safety), which means that if there are n machines in the system, the maximum tolerable operation/Fault nodes of the system are (n-1)/3. (rogue nodes may not respond or respond with erroneous information). The PBFT solves the problem that the original Byzantine fault-tolerant algorithm is low in efficiency, reduces the complexity of the algorithm from exponential level to polynomial level, and enables the Byzantine fault-tolerant algorithm to be feasible in practical system application.
When participating in the PBFT consensus algorithm, the consensus node needs to implement five operation steps of "request", "pre-prepare", "commit", and "reply" each time the consensus algorithm is executed. In the five operation steps, a 'pre-prepare' stage executes a BlockVerifier block executor, and the core of the BlockVerifier block executor is that a consensus node judges whether consistency can be realized according to a current verification strategy and feeds back the consistency.
In the present embodiment, all digital assets such as data assets and currency assets are represented by a common quintuple < M, hash (M), pre _ Hash (M), sign, point >. Wherein, M represents the complete information of the asset transaction and is used for recording transaction information or asset change; hash (M) is the Hash value of M and is used as the index of the five-tuple; pre _ Hash (M) is the Hash value of the last asset change and is used for tracing the source of the asset; sign is a digital signature of Hash (M) in the transaction, and the validity and legality of the transaction can be verified through Sign; point is a flag bit, which can be inserted into different values according to different assets and asset states, and can determine the type and state of the asset according to the difference of the Point values.
When a main node in the block chain network receives a transaction request initiated by a data asset purchasing end, the main node verifies transaction information corresponding to the transaction request, namely verifies the quintuple. After the verification is passed, the main node broadcasts the transaction requests to all the accounting nodes in the blockchain network, the accounting nodes responding to the broadcast verify the transaction requests, if the number of the transaction requests verified by the accounting nodes exceeds a preset threshold value, the consensus of the transaction requests in the blockchain network is considered to be completed, and the transaction of the digital assets between the data asset owning end and the data asset purchasing end can be completed.
In this embodiment, when a master node in a blockchain network receives a transaction request initiated by a data asset purchasing end, the master node verifies transaction information corresponding to the transaction request; after verification, the main node broadcasts the transaction request to each accounting node in the blockchain network; and if the number of the transaction requests verified by the accounting node exceeds a preset threshold value, the consensus of the transaction requests in the blockchain network is completed, and the transaction of the digital assets between the data asset owning end and the data asset purchasing end is achieved.
In this embodiment, PBFT is mainly modified to provide a new consensus verification method, and then a digital asset transaction method in approved systems (federation chain/private chain) is provided based on the new consensus verification method. Under the premise of block chain decentralization and distrust, the data asset owning end and the data asset purchasing end can carry out malicious tampering on the data. Therefore, in this embodiment, after the data asset owning terminal agrees or rejects the previous transaction request and broadcasts the transaction request to each accounting node in the blockchain network, each accounting node further verifies the transaction information corresponding to the transaction request. And considering that the number of the transaction requests verified by the accounting node exceeds a preset threshold value, the consensus of the transaction requests in the blockchain network is completed, and therefore the transaction of the digital assets between the data asset owning end and the data asset purchasing end is achieved.
Optionally, step S20: the main node verifies the transaction information corresponding to the transaction request, and the verification comprises the following steps:
the master node inquires whether the state attribute value is an agreement transaction in the transaction information corresponding to the transaction request;
if the state attribute value is not approved to the transaction, the main node verifies whether the digital signature of the transaction information is valid;
if the digital signature of the transaction information is valid, the transaction information passes verification;
and if the digital signature of the transaction information is invalid, the verification fails.
When a main node (consensus node) receives a transaction request initiated by a data asset purchasing end, a transaction quintuple corresponding to the transaction information is obtained by inquiring the transaction information corresponding to the transaction request, and whether the state attribute value of a marking bit Point in the transaction quintuple is an agreement transaction or not is determined. If the attribute value of the current marking position Point is not approved for transaction, for example, the attribute value of the current marking position Point is applied for transaction and refused for transaction, the transaction does not bring the change of the digital asset to the data asset owner and the data asset purchasing end, and at the moment, the master node only needs to verify whether the data signature in the transaction quintuple corresponding to the transaction information is valid. If the transaction information is valid, the main node successfully verifies the transaction information corresponding to the current transaction request; and if the transaction information is invalid, the main node fails to verify the transaction information corresponding to the current transaction request.
Optionally, after the step of querying, by the master node, whether the state attribute value is an agreement to the transaction in the transaction information corresponding to the transaction request, the method further includes:
if the state attribute value is an agreement transaction, the master node verifies the following condition: whether the digital signature in the transaction information is valid or not, whether a transaction application corresponding to the current transaction request exists or not, whether the digital asset change amounts of the data asset purchasing end and the data asset owning end are equal or not, and whether the digital asset change amounts are equal to the transaction amount in the transaction information or not;
if all the conditions are met, the verification is passed;
if one of the two is not satisfied, the verification fails.
And if the attribute value of the current mark bit Point is agreement transaction, the current transaction means that the digital asset change can be brought to the data asset owning end and the data asset purchasing end, and at the moment, the main node needs to further judge the digital asset states of the data asset owning end and the data asset purchasing end from the acquired transaction quintuple. The master node needs to judge 1: whether a valid digital signature exists or not and whether a digital signature in the transaction information is valid or not, 2: whether a transaction application corresponding to the current transaction request exists, 3: whether the digital asset change amounts of the data asset purchasing end and the data asset owning end are equal or not indicates that the two parties do not tamper with the data money, and 4: whether the amount of change in the digital asset is equal to the asset transaction amount in the transaction application. If all the conditions are met, the main node successfully verifies the transaction information corresponding to the current transaction request; and if one of the conditions is not met, the main node fails to verify the transaction information corresponding to the current transaction request.
Optionally, step S20: after the main node verifies the transaction information corresponding to the transaction request, the method also comprises the step of
The main node packages and signs the transaction request to obtain a first message, and broadcasts the first message to the block chain network for the first time;
the accounting node responding to the first broadcast judges the validity of the first message, after the first message is determined to be valid, the accounting node packages and signs the first message to obtain a second message, and the second message is broadcasted to the block chain network;
the accounting node responding to the second broadcast judges the validity of the second message, and after the validity of the second message is determined, the transaction request is determined to pass the verification of the accounting node.
In this embodiment, the master node encapsulates and signs the transaction request that needs to be identified, so as to obtain a first message, and then the master node broadcasts the encapsulated and signed first message to the blockchain network for the first time.
The accounting node responding to the first broadcast in the block chain network needs to judge the validity of the first message before receiving the first message, after the accounting node determines that the first message is valid, the accounting node, as well as the main node broadcasting the first message, packages and signs the first message to obtain a second message, and broadcasts the second message to the block chain network for the second.
The accounting node responding to the second broadcast in the blockchain network also needs to judge the validity of the second message before receiving the second message, after the accounting node determines that the second message is valid, the accounting node can determine that the transaction request passes the verification of the accounting node, the accounting node responding to the second broadcast sends a commit message indicating that the verification passes, and when the number of the transaction requests and the number of the commit messages which pass the verification of the accounting node exceed preset thresholds, the consensus of the transaction requests in the blockchain network is considered to be completed, so that the transaction of the digital assets between the data asset owning end and the data asset purchasing end is achieved.
Optionally, the step of determining the validity of the first message includes:
judging whether the signature corresponding to the first message is correct or not;
judging whether the message view and the current accounting node are in the same view or not;
judging whether the current accounting node receives the first message before receiving the first message;
judging whether the block height is within a preset threshold range;
and if the signature corresponding to the first message is correct, the message view and the current accounting node are in the same view, the current accounting node does not receive the first message before receiving the first message, and the block height is within a preset threshold range, determining that the first message is valid.
Specifically, when the validity of the first message is determined, it is necessary to determine whether the signature corresponding to the first message is correct, whether the message view and the current accounting node are in the same view, whether the current accounting node receives the same first message before receiving the first message, and whether the block height is within a preset threshold range. If the above conditions are all satisfied, the first message is determined to be valid, and if any one of the above conditions is not satisfied, the first message is determined to be invalid. In addition, the validity of the second message is determined to be similar to the validity of the first message, and details are not repeated here.
Optionally, before the step of encapsulating and signing the transaction request by the master node to obtain a first message, and performing a first broadcast on the first message to the blockchain network, the method further includes;
taking any node in the block chain network as a candidate node, and taking nodes except the candidate node as voting nodes;
and taking candidate nodes with preset number before the votes voted and voted by the voting nodes as the accounting nodes.
In this embodiment, any node in the blockchain network may vote for other nodes, when a certain arbitrary node becomes a candidate node, other nodes except the candidate node may vote for the candidate node as voting nodes, and the candidate nodes with the preset number N before the vote ranking votes voted for voting are used as accounting nodes.
Thus, when some of the accounting nodes have malicious or other illegal behaviors in the consensus process, the blockchain network can revoke the voting for the accounting nodes. When the vote is passed, the accounting node is abolished, and the accounting node is also abolished to become a candidate node, even with a certain fine. The introduction of the punishment mechanism can improve the safety performance of the block chain network in a limited way, so that the cost and consequence problems need to be considered when the node makes a malignant operation. Compared with the block chain of the PBFT, the safety capability is improved.
Optionally, step S20: after the verification is passed, the main node broadcasts the transaction request to each accounting node in the blockchain network, and the method further comprises the following steps:
and if the number of the transaction requests verified by the accounting node does not exceed a preset threshold value, the master replacement node identifies the transaction requests again in the blockchain network.
Because the number of transaction requests verified by the accounting node does not exceed the preset threshold, or the consensus is not completed within a specified time, or after the current consensus is completed, the view is switched, and the master node is replaced to perform consensus on the transaction requests in the blockchain network again. By adding the retransmission mechanism, the transaction request and message arrival rate in the block chain network can be increased, and the consensus efficiency is further improved.
In addition, an embodiment of the present invention further provides a block chain-based digital asset transaction apparatus, where the apparatus includes:
the verification module is used for verifying the transaction information corresponding to the transaction request when the main node in the block chain network receives the transaction request initiated by the data asset purchasing end;
the broadcast module is used for broadcasting the transaction request to each accounting node in the blockchain network by the main node after the verification is passed;
and the transaction module is used for finishing the consensus of the transaction requests in the blockchain network and achieving the transaction of the digital assets of the data asset owning end and the data asset purchasing end if the number of the transaction requests verified by the accounting node exceeds a preset threshold value.
Optionally, the broadcast module further includes a verification unit, configured to query, by the host node, whether a state attribute value is an agreement transaction in the transaction information corresponding to the transaction request;
if the state attribute value is not approved to the transaction, the main node verifies whether the digital signature of the transaction information is valid;
if the digital signature of the transaction information is valid, the verification is passed;
and if the digital signature of the transaction information is invalid, the verification fails.
Optionally, the verifying unit is further configured to verify, if the state attribute value is an agreement transaction, the following condition: whether the digital signature in the transaction information is valid or not, whether a transaction application corresponding to the current transaction request exists or not, whether the digital asset change amounts of the data asset purchasing end and the data asset owning end are equal or not, and whether the digital asset change amounts are equal to the transaction amount in the transaction information or not;
if all the conditions are met, the verification is passed;
if one of the two is not satisfied, the verification fails.
Optionally, the blockchain-based digital asset transaction apparatus further includes: a response module for the master node following the step of broadcasting the transaction request to accounting nodes in the blockchain network,
the main node packages and signs the transaction request to obtain a first message, and the first message is broadcasted to the block chain network for the first time;
responding to the accounting node of the first broadcast to judge the validity of the first message, after the accounting node determines that the first message is valid, encapsulating and signing the first message by the accounting node to obtain a second message, and performing second broadcast on the second message to the block chain network;
the accounting node responding to the second broadcast judges the validity of the second message, and after the validity of the second message is determined, the transaction request is determined to pass the verification of the accounting node.
Optionally, the response module is further configured to determine whether a signature corresponding to the first message is correct;
judging whether the message view and the current accounting node are in the same view or not;
judging whether the current accounting node receives the first message before receiving the first message;
judging whether the block height is within a preset threshold range;
and if the signature corresponding to the first message is correct, the message view and the current accounting node are in the same view, the current accounting node does not receive the first message before receiving the first message, and the block height is within a preset threshold range, determining that the first message is valid.
Optionally, the blockchain-based digital asset transaction apparatus further includes: an election module, configured to encapsulate and sign the transaction request to obtain a first message, and before the step of performing a first broadcast on the first message to the blockchain network by the master node,
taking any node in the block chain network as a candidate node, and taking nodes except the candidate node as voting nodes;
and taking candidate nodes with preset number before the votes voted and voted by the voting nodes as the accounting nodes.
Optionally, the blockchain-based digital asset trading device further includes: a replacement module for the master node after the step of broadcasting the transaction request to accounting nodes in the blockchain network after the verification is passed,
and if the number of the transaction requests verified by the accounting node does not exceed a preset threshold value, the master replacement node identifies the transaction requests again in the blockchain network.
The digital asset transaction device based on the block chain provided by the invention adopts the digital asset transaction method based on the block chain in the embodiment, and solves the technical problems that when the digital asset transaction is carried out through the block chain in the prior art, two transaction parties do not trust each other and bidirectional online transaction is difficult to realize. Compared with the prior art, the beneficial effects of the digital asset transaction device based on the block chain provided by the embodiment of the invention are the same as the beneficial effects of the digital asset transaction method based on the block chain provided by the embodiment, and other technical characteristics of the digital asset transaction device based on the block chain are the same as the characteristics disclosed by the embodiment method, which are not repeated herein.
In addition, an embodiment of the present invention further provides a block chain-based digital asset transaction device, where the block chain-based digital asset transaction device includes: a memory, a processor and a computer program stored on the memory and executable on the processor, the computer program configured to implement the steps of the blockchain based digital asset transaction method as defined in any one of the above.
Furthermore, an embodiment of the present invention further provides a computer storage medium applied to a computer, where the computer storage medium may be a non-volatile computer-readable computer storage medium, and a computer program is stored on the computer storage medium, and when the computer program is executed by a processor, the computer program implements the steps of the blockchain-based digital asset transaction method according to any one of the above.
The steps implemented when the computer program running on the processor is executed may refer to various embodiments of the block chain-based digital asset transaction method of the present invention, and are not described herein again.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrases "comprising a," "8230," "8230," or "comprising" does not exclude the presence of other like elements in a process, method, article, or system comprising the element.
The above-mentioned serial numbers of the embodiments of the present invention are only for description, and do not represent the advantages and disadvantages of the embodiments.
Through the description of the foregoing embodiments, it is clear to those skilled in the art that the method of the foregoing embodiments may be implemented by software plus a necessary general hardware platform, and certainly may also be implemented by hardware, but in many cases, the former is a better implementation. Based on such understanding, the technical solution of the present invention or portions thereof contributing to the prior art may be embodied in the form of a software product, where the computer software product is stored in a computer storage medium (such as a Flash storage device, a ROM/RAM, a magnetic disk, an optical disk), and includes several instructions for enabling a controller, which is used for controlling the storage medium to perform data reading and writing operations, in a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.), to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and is not intended to limit the scope of the present invention, and all equivalent structures or equivalent processes performed by the present invention or directly or indirectly applied to other related technical fields are also included in the scope of the present invention.
Claims (9)
1. A block chain-based digital asset transaction method is characterized by comprising the following steps:
when a main node in a block chain network receives a transaction request initiated by a data asset purchasing end, the main node verifies transaction information corresponding to the transaction request;
after verification, the main node broadcasts the transaction request to each accounting node in the blockchain network;
if the number of the transaction requests verified by the accounting node exceeds a preset threshold value, the consensus of the transaction requests in the blockchain network is completed, and the transaction of the digital assets between the data asset owning terminal and the data asset purchasing terminal is achieved;
after the step of broadcasting the transaction request to each accounting node in the blockchain network, the master node further includes:
the main node packages and signs the transaction request to obtain a first message, and broadcasts the first message to the block chain network for the first time;
responding to the accounting node of the first broadcast to judge the validity of the first message, after the accounting node determines that the first message is valid, encapsulating and signing the first message by the accounting node to obtain a second message, and performing second broadcast on the second message to the block chain network;
the accounting node responding to the second broadcast judges the validity of the second message, and after the validity of the second message is determined, the transaction request is determined to pass the verification of the accounting node.
2. The blockchain-based digital asset transaction method of claim 1, wherein the step of the master node verifying the transaction information corresponding to the transaction request includes:
the master node inquires whether the state attribute value is an agreement transaction in the transaction information corresponding to the transaction request;
if the state attribute value is not approved to the transaction, the main node verifies whether the digital signature of the transaction information is valid;
if the digital signature of the transaction information is valid, the transaction information passes verification;
and if the digital signature of the transaction information is invalid, the verification fails.
3. The blockchain-based digital asset transaction method according to claim 2, wherein the step of the master node inquiring whether the state attribute value is an approval for the transaction in the transaction information corresponding to the transaction request further includes, after the step of:
if the state attribute value is an agreement transaction, the master node verifies the following condition: whether the digital signature in the transaction information is valid, whether a transaction application corresponding to the current transaction request exists, whether the digital asset change amounts of the data asset purchasing end and the data asset owning end are equal, and whether the digital asset change amounts are equal to the transaction amount in the transaction information;
if all the conditions are met, the verification is passed;
if one of the two is not satisfied, the verification fails.
4. The blockchain-based digital asset transaction method according to claim 3, wherein the step of determining the validity of the first message includes:
judging whether the signature corresponding to the first message is correct or not;
judging whether the message view and the current accounting node are in the same view or not;
judging whether the current accounting node receives the first message before receiving the first message;
judging whether the block height is within a preset threshold range;
and if the signature corresponding to the first message is correct, the message view and the current accounting node are in the same view, the current accounting node does not receive the first message before receiving the first message, and the block height is within a preset threshold range, determining that the first message is valid.
5. The blockchain-based digital asset transaction method of claim 4, wherein the step of the master node encapsulating and signing the transaction request to obtain a first message and first broadcasting the first message into the blockchain network further comprises;
taking any node in the block chain network as a candidate node, and taking nodes except the candidate node as voting nodes;
and taking a preset number of candidate nodes before the vote ranking voted by the voting nodes as the accounting nodes.
6. The blockchain-based digital asset transaction method of claim 5, wherein after the step of broadcasting the transaction request to accounting nodes in the blockchain network by the master node after the verification passes, further comprising:
and if the number of the transaction requests verified by the accounting node does not exceed a preset threshold value, the master node is replaced to identify the transaction requests again in the block chain network.
7. A blockchain-based digital asset transaction apparatus, the apparatus comprising:
the verification module is used for verifying the transaction information corresponding to the transaction request when the main node in the block chain network receives the transaction request initiated by the data asset purchasing end;
a broadcast module, configured to, after verification is passed, the master node broadcasts the transaction request to each accounting node in the blockchain network;
the transaction module is used for finishing the consensus of the transaction requests in the blockchain network and achieving the transaction of the digital assets of the data asset owning end and the data asset purchasing end if the number of the transaction requests verified by the accounting node exceeds a preset threshold value;
a broadcasting module, further configured to, after the step of broadcasting the transaction request to each accounting node in the blockchain network by the master node:
the main node packages and signs the transaction request to obtain a first message, and broadcasts the first message to the block chain network for the first time;
responding to the accounting node of the first broadcast to judge the validity of the first message, after the accounting node determines that the first message is valid, encapsulating and signing the first message by the accounting node to obtain a second message, and performing second broadcast on the second message to the block chain network;
the accounting node responding to the second broadcast judges the validity of the second message, and after the validity of the second message is determined, the transaction request is determined to pass the verification of the accounting node.
8. A blockchain-based digital asset transaction device, the blockchain-based digital asset transaction device comprising: memory, a processor and a computer program stored on the memory and executable on the processor, the computer program being configured to implement the steps of the blockchain based digital asset transaction method according to any one of claims 1 to 6.
9. A computer storage medium, characterized in that the computer storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of the blockchain-based digital asset transaction method according to any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211029718.4A CN115131022B (en) | 2022-08-26 | 2022-08-26 | Block chain based digital asset transaction method, device, equipment and medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211029718.4A CN115131022B (en) | 2022-08-26 | 2022-08-26 | Block chain based digital asset transaction method, device, equipment and medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115131022A CN115131022A (en) | 2022-09-30 |
CN115131022B true CN115131022B (en) | 2022-11-29 |
Family
ID=83387240
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211029718.4A Active CN115131022B (en) | 2022-08-26 | 2022-08-26 | Block chain based digital asset transaction method, device, equipment and medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115131022B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116383875A (en) * | 2023-03-22 | 2023-07-04 | 深圳市明源云科技有限公司 | Data processing method, device and equipment for property right transaction and storage medium thereof |
CN116797376B (en) * | 2023-08-26 | 2023-12-01 | 杭州字节方舟科技有限公司 | Asset management method, system, server and storage medium based on block chain |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105488665A (en) * | 2015-11-25 | 2016-04-13 | 布比(北京)网络技术有限公司 | Decentralized transaction method |
CN111543026A (en) * | 2018-12-13 | 2020-08-14 | 阿里巴巴集团控股有限公司 | System for changing main node in distributed network |
CN112488828A (en) * | 2019-09-11 | 2021-03-12 | 富泰华工业(深圳)有限公司 | Commodity transaction device and method based on block chain system and readable storage medium |
CN114730436A (en) * | 2019-11-21 | 2022-07-08 | 松下电器(美国)知识产权公司 | Control method, device, and program |
CN114881648A (en) * | 2021-04-15 | 2022-08-09 | 北京驱云科技有限公司 | Block chain interconnection method and equipment based on prediction machine and oriented to cross-chain asset replacement scene |
-
2022
- 2022-08-26 CN CN202211029718.4A patent/CN115131022B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105488665A (en) * | 2015-11-25 | 2016-04-13 | 布比(北京)网络技术有限公司 | Decentralized transaction method |
CN111543026A (en) * | 2018-12-13 | 2020-08-14 | 阿里巴巴集团控股有限公司 | System for changing main node in distributed network |
CN112488828A (en) * | 2019-09-11 | 2021-03-12 | 富泰华工业(深圳)有限公司 | Commodity transaction device and method based on block chain system and readable storage medium |
CN114730436A (en) * | 2019-11-21 | 2022-07-08 | 松下电器(美国)知识产权公司 | Control method, device, and program |
CN114881648A (en) * | 2021-04-15 | 2022-08-09 | 北京驱云科技有限公司 | Block chain interconnection method and equipment based on prediction machine and oriented to cross-chain asset replacement scene |
Also Published As
Publication number | Publication date |
---|---|
CN115131022A (en) | 2022-09-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109981679B (en) | Method and apparatus for performing transactions in a blockchain network | |
CN115131022B (en) | Block chain based digital asset transaction method, device, equipment and medium | |
CN111343142B (en) | Data processing method and device based on block chain network and storage medium | |
CN106453415B (en) | Block chain-based equipment authentication method, authentication server and user equipment | |
CN110661658B (en) | Node management method and device of block chain network and computer storage medium | |
CN110569251A (en) | Data processing method, related equipment and computer readable storage medium | |
CN110740044B (en) | Data processing method, device, system and storage medium | |
EP4216077A1 (en) | Blockchain network-based method and apparatus for data processing, and computer device | |
CN112613877B (en) | Intelligent contract triggering method and device applied to block chain network and related equipment | |
WO2020082898A1 (en) | Blockchain-based transaction processing method and apparatus, and electronic device | |
CN110138767B (en) | Transaction request processing method, device, equipment and storage medium | |
CN110599275A (en) | Data processing method and device based on block chain network and storage medium | |
WO2022206454A1 (en) | Method and apparatus for providing cross-chain messages | |
CN111612456A (en) | Expired digital certificate management and control method, system, device and storage medium | |
CN111488626A (en) | Data processing method, device, equipment and medium based on block chain | |
CN103516517A (en) | Production method, RFID transponder, authentication method, and reader device | |
WO2023040453A1 (en) | Transaction information processing method and apparatus | |
CN112950201A (en) | Node management method and related device applied to block chain system | |
CN113179282A (en) | Method and device for merging account numbers and server | |
CN111597269A (en) | Block chain-based contract implementation method, device and equipment | |
US20220058641A1 (en) | Device and method for processing data of transactions based on block chain, and storage medium | |
CN112037055B (en) | Transaction processing method, device, electronic equipment and readable storage medium | |
CN113890739A (en) | Cross-block-chain authentication method and device, electronic equipment and medium | |
CN112181599A (en) | Model training method, device and storage medium | |
CN112037062A (en) | Transaction consensus method, device, electronic equipment and readable storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |