CN111325625A - Transaction method, device and storage medium - Google Patents
Transaction method, device and storage medium Download PDFInfo
- Publication number
- CN111325625A CN111325625A CN202010099007.9A CN202010099007A CN111325625A CN 111325625 A CN111325625 A CN 111325625A CN 202010099007 A CN202010099007 A CN 202010099007A CN 111325625 A CN111325625 A CN 111325625A
- Authority
- CN
- China
- Prior art keywords
- transaction
- channel
- client
- server
- user
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 102
- 230000004044 response Effects 0.000 claims abstract description 68
- 238000000151 deposition Methods 0.000 claims abstract description 24
- 238000012546 transfer Methods 0.000 claims description 105
- 238000004590 computer program Methods 0.000 claims description 8
- 238000010586 diagram Methods 0.000 description 10
- 230000008014 freezing Effects 0.000 description 8
- 238000007710 freezing Methods 0.000 description 8
- 230000000694 effects Effects 0.000 description 6
- 230000008569 process Effects 0.000 description 5
- 238000004891 communication Methods 0.000 description 4
- 230000006870 function Effects 0.000 description 4
- 230000007246 mechanism Effects 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 3
- 238000012545 processing Methods 0.000 description 3
- 238000012790 confirmation Methods 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
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
- G06Q40/00—Finance; Insurance; Tax strategies; Processing of corporate or income taxes
- G06Q40/04—Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
-
- 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/08—Payment architectures
- G06Q20/10—Payment architectures specially adapted for electronic funds transfer [EFT] systems; specially adapted for home banking systems
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/55—Push-based network services
Landscapes
- Business, Economics & Management (AREA)
- Accounting & Taxation (AREA)
- Engineering & Computer Science (AREA)
- Finance (AREA)
- General Business, Economics & Management (AREA)
- Development Economics (AREA)
- Economics (AREA)
- Strategic Management (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Signal Processing (AREA)
- Marketing (AREA)
- Technology Law (AREA)
- Computer Networks & Wireless Communication (AREA)
- Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
Abstract
The invention provides a transaction method, equipment and a storage medium, wherein the method comprises the following steps: sending first registration request information of a registration service to a server; receiving channel creation notification information pushed by a server; in response to a current user depositing in a first channel, sending a first deposit transaction to a server; receiving first deposit notification information, and updating first expendable asset limit information of a current user in a first channel; receiving second deposit notification information pushed by the server, and updating second expendable asset limit information of a second user in the first channel; sending a first down-link transaction to a server in response to a current user transferring money to a second user in a first channel; receiving and storing a second downlink transaction sent by the server; wherein the first and second down-link transactions are used as proof of evidence of asset clearing for the first contract when the current user or the second user requests clearing of the first channel. The application efficiency of the lightning network or the lightning network is improved.
Description
Technical Field
The present application relates to the field of blockchain technology, and in particular, to a transaction method, device and storage medium.
Background
In the existing block chain technology, high-frequency and small-amount transactions can be subjected to offline transactions through a lightning network or a lightning network, both parties executing the offline transactions need to operate an offline transaction special node respectively, and a transaction channel is created for each type of evidence;
based on the mechanism, the deployment and use processes of the lightning network and the lightning network are complicated and very complex, and the lightweight client cannot directly use the lightning network or the lightning network for offline transaction, so that the application efficiency of the lightning network or the lightning network is low.
Disclosure of Invention
The application provides a transaction method, a transaction device and a storage medium, which can be used for improving the application efficiency of a lightning network or a lightning network.
In a first aspect, the present invention provides a transaction method applicable to a client, including:
sending first registration request information of a registration service to a server, so that the server registers a transaction push service for a first user of a current client according to the first registration request information, and storing a push address of the current client;
receiving channel creation notification information pushed by a server; the channel creation notification information is generated by the server from the block chain synchronization to the creation of the first channel between the current user and the second user;
in response to a current user depositing in a first channel, sending a first deposit transaction to a server for the server to:
forwarding the first deposit transaction to the blockchain node for the blockchain node to perform the first deposit transaction via the first contract to transfer the first deposit transaction-specific assets to the first channel;
acquiring an execution result of the first deposit transaction from the blockchain to generate first deposit notification information and respectively pushing the first deposit notification information to a current user and a second client of a second user;
receiving first deposit notification information, and updating first expendable asset limit information of a current user in a first channel according to the first deposit notification information;
receiving second deposit notification information pushed by the server, and updating second expendable asset limit information of the second user in the first channel according to the second deposit notification information; the second deposit notification information is generated by the second client by the server according to the execution result of the second deposit transaction acquired by the server from the blockchain and is respectively pushed to the current user and the second client, and the second deposit transaction is generated by the second client in response to the deposit of the second user in the first channel and is sent to the blockchain node through the server so that the blockchain node can execute the second deposit transaction through the first contract to transfer a plurality of assets specified by the second deposit transaction to the first channel;
responding to the account transfer of the current user to the second user in the first channel, and sending a first down-link transaction to the server, so that the server forwards the first down-link transaction to the second client, and the second client stores the first down-link transaction; the transaction amount of the first-chain transaction is the sum of the transaction amount of the previous first-chain transaction and the transaction amount to be transferred;
receiving and storing a second downlink transaction sent by the server; the second link-down transaction is generated by the second client in response to the second user transferring accounts to the first user in the first channel and is sent to the server, and the transaction amount of the second link-down transaction is the sum of the transaction amount of the previous second link-down transaction and the transaction amount to be transferred;
wherein the first and second down-link transactions are used as proof of evidence of asset clearing for the first contract when the current user or the second user requests clearing of the first channel.
In a second aspect, the present invention provides a transaction method applicable to a server, where each user registers a transaction push service with the server, and the method includes:
receiving a first channel creation transaction sent by a first client of a first user or a second client of a second user, and forwarding the first channel creation transaction to a block chain node, so that the block chain node executes the first channel creation transaction through a first contract to create a first channel of the first user and the second user;
acquiring an execution result of the first channel creation transaction from the blockchain to generate first channel creation notification information, and pushing the first channel creation notification information to the first client and the second client respectively;
receiving a deposit transaction sent by a first client or a second client, and forwarding the deposit transaction to a blockchain node so that the blockchain node executes the deposit transaction through a first contract to transfer a plurality of assets specified by the deposit transaction to a first channel; wherein the deposit transaction is generated by the first client in response to the first user depositing in the first channel, or the second client in response to the second user depositing in the first channel;
acquiring an execution result of a first deposit transaction from a block link point to generate deposit notification information, and pushing the deposit notification information to a first client and a second client respectively so that the first client and the second client can update the expendable asset limit information of a corresponding user in a first channel;
receiving a first downlink transaction sent by a first client, and forwarding the first downlink transaction to a second client so that the second client can store the first downlink transaction; the first-chain transaction is generated by a first client responding to the first user to transfer accounts to a second user in a first channel;
receiving a second downlink transaction sent by a second client, and forwarding the second downlink transaction to the first client so that the first client can store the second downlink transaction; the transaction amount of the second-chain transaction is the sum of the transaction amount of the previous second-chain transaction and the transaction amount to be transferred, and the second-chain transaction is generated by the second client responding to the second user to transfer accounts to the first user in the first channel;
wherein the first and second down-link transactions are used to certify the proof of compliance for the asset clearing as the first contract when the first or second user requests the clearing of the first channel.
In a third aspect, the present invention provides a transaction method applicable to a server, where each user registers a transaction push service with a server, and a first contract is configured with a first numerical value, where the method includes:
receiving a first channel creation transaction forwarded by a server, executing the first channel creation transaction through a first contract to create a first channel between a first user and a second user, so that the server can generate first creation channel notification information after acquiring an execution result of the first channel creation transaction and respectively push the first creation channel notification information to a first client of the first user and a second client of the second user; the first channel creation transaction is generated by the first client or the second client and is sent to the server;
receiving the deposit transaction forwarded by the server, executing the deposit transaction through a first contract to transfer a plurality of assets specified by the deposit transaction to a first channel, so that the server can acquire the execution result of the deposit transaction to generate deposit notification information and respectively push the deposit notification information to a first client or a second client; wherein the deposit transaction is generated by the first client in response to the first user depositing in the first channel, or the second client in response to the second user depositing in the first channel and sent to the server;
receiving a first closed channel transaction which is forwarded by a server and comprises a first transfer certificate, executing the first closed channel transaction through a first contract, recording the first transfer certificate on a block chain, and closing the first channel, so that the server acquires an execution result of the first closed channel transaction from the block chain to generate first closed channel notification information and respectively pushes the first closed channel notification information to a first client and a second client; the first transfer certification comprises a second down-link transaction with the largest transaction amount, the second down-link transaction is generated by a second client in response to the fact that a second user transfers accounts to the first user in a first channel and is sent to the server, the transaction amount of the second down-link transaction is the sum of the transaction amount of the previous down-link transaction and the transaction amount to be transferred, and the first closed channel transaction is sent to the server by the first client;
receiving a first submission certification transaction which is forwarded by the server and comprises a second transfer certification, and judging whether the difference between the height of a first block of a block to be generated and the height of a second block of the block where the first closed channel transaction is located is not larger than a first numerical value: if so, executing a first submission certification transaction through a first contract, and recording a second transfer certification on the blockchain, so that the server acquires an execution result of the first submission certification transaction from the blockchain to generate first submission certification notification information and respectively pushes the first submission certification notification information to the first client and the second client; the first submission certification transaction is generated by the first client in response to the second user submitting a second transfer certification, the second transfer certification comprises a first down-link transaction with the largest transaction amount, the first down-link transaction is sent to the server by the first client in response to the first user transferring accounts to the second user in the first channel, the transaction amount of the first down-link transaction is the sum of the transaction amount of the first down-link transaction at the previous time and the transaction amount to be transferred, and the first submission certification transaction is sent to the server by the second client;
receiving a first clearing transaction of a clearing first channel forwarded by a server, executing the first clearing transaction through a first contract, clearing assets specified by the first clearing transaction of a first user and a second user in the first channel, and enabling the server to acquire an execution result of the first clearing transaction from a blockchain to generate first clearing notification information and push the first clearing notification information to a first client and a second client respectively; wherein the first clearing transaction is sent by the first client or the second client to the server.
In a fourth aspect, the present invention also provides an apparatus comprising one or more processors and a memory, wherein the memory contains instructions executable by the one or more processors to cause the one or more processors to perform a transaction method provided in accordance with embodiments of the present invention.
In a fifth aspect, the present invention also provides a storage medium storing a computer program that causes a computer to execute a transaction method provided according to embodiments of the present invention.
The transaction method, the device and the storage medium provided by the embodiments of the invention send the first registration request information of the registration service to the server; receiving channel creation notification information pushed by a server; in response to a current user depositing in a first channel, sending a first deposit transaction to a server; receiving first deposit notification information, and updating first expendable asset limit information of a current user in a first channel according to the first deposit notification information; receiving second deposit notification information pushed by the server, and updating second expendable asset limit information of the second user in the first channel according to the second deposit notification information; sending a first down-link transaction to a server in response to a current user transferring money to a second user in a first channel; receiving and storing a second downlink transaction sent by the server; the first and second offline transactions are used as proof-of-evidence methods for asset clearing of the first contract when the current user or the second user requests clearing of the first channel, and application efficiency of the lightning network or the lightning network is improved.
The transaction method, the device and the storage medium provided by some embodiments of the present invention further configure a sub-channel in the first channel, where the sub-channel is based on an asset type, and all of the first link down transaction, the second closed channel transaction, the second submission certification transaction and the second clearing transaction are configured with asset type parameters, and the asset type is used to designate the sub-channel, so as to establish a general link down transaction channel for different types of assets, thereby further improving the application efficiency of a lightning network or a lightning network.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
fig. 1 is a flowchart of a transaction method according to an embodiment of the present invention.
Fig. 2 is a flow chart of step S121 in a preferred embodiment of the method shown in fig. 1.
Fig. 3 is a flow chart of step S125 in a preferred embodiment of the method shown in fig. 1.
FIG. 4 is a flow diagram of a preferred embodiment of the method shown in FIG. 1.
FIG. 5 is a flow diagram of another preferred embodiment of the method shown in FIG. 1.
Fig. 6 is a flowchart of another transaction method according to an embodiment of the invention.
FIG. 7 is a flow chart of a preferred embodiment of the method shown in FIG. 6.
Fig. 8 is a flowchart of another transaction method according to an embodiment of the invention.
Fig. 9 is a flowchart of another transaction method according to an embodiment of the invention.
Fig. 10 is a schematic structural diagram of an apparatus according to an embodiment of the present invention.
Detailed Description
The present application will be described in further detail with reference to the following drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the present invention are shown in the drawings.
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
Fig. 1 is a flowchart of a transaction method according to an embodiment of the present invention. As shown in fig. 1, in this embodiment, the present invention provides a transaction method applicable to a client, including:
s120: sending first registration request information of the registration service to a server, so that the server registers transaction push service for the current user according to the first registration request information, and storing a push address of the current client;
s121: receiving channel creation notification information pushed by a server; the channel creation notification information is generated by the server from the block chain synchronization to the creation of the first channel between the current user and the second user;
s122: in response to a current user depositing in a first channel, sending a first deposit transaction to a server for the server to:
forwarding the first deposit transaction to the blockchain node for the blockchain node to perform the first deposit transaction via the first contract to transfer the first deposit transaction-specific assets to the first channel;
acquiring an execution result of the first deposit transaction from the blockchain to generate first deposit notification information and respectively pushing the first deposit notification information to a current user and a second client of a second user;
s123: receiving first deposit notification information, and updating first expendable asset limit information of a current user in a first channel according to the first deposit notification information;
s124: receiving second deposit notification information pushed by the server, and updating second expendable asset limit information of the second user in the first channel according to the second deposit notification information; the second deposit notification information is generated by the second client by the server according to the execution result of the second deposit transaction acquired by the server from the blockchain and is respectively pushed to the current user and the second client, and the second deposit transaction is generated by the second client in response to the deposit of the second user in the first channel and is sent to the blockchain node through the server so that the blockchain node can execute the second deposit transaction through the first contract to transfer a plurality of assets specified by the second deposit transaction to the first channel;
s125: responding to the account transfer of the current user to the second user in the first channel, and sending a first down-link transaction to the server, so that the server forwards the first down-link transaction to the second client, and the second client stores the first down-link transaction; the transaction amount of the first-chain transaction is the sum of the transaction amount of the previous first-chain transaction and the transaction amount to be transferred;
s126: receiving and storing a second downlink transaction sent by the server; the second link-down transaction is generated by the second client in response to the second user transferring accounts to the first user in the first channel and is sent to the server, and the transaction amount of the second link-down transaction is the sum of the transaction amount of the previous second link-down transaction and the transaction amount to be transferred;
wherein the first and second down-link transactions are used as proof of evidence of asset clearing for the first contract when the current user or the second user requests clearing of the first channel.
Specifically, only one type of asset token is operated on the blockchain, and the first channel is configured as a channel capable of processing the offline transaction of only one type of asset; assuming that the current user is a, the current client is a, the second user is B, the second client is B, the first deposit transaction is tx _ a _ deposit1(a, m1) indicating that a deposits m1 tokens in the first channel, the second deposit transaction is tx _ B _ deposit2(B, m2) indicating that B deposits m2 tokens in the first channel, the first-chain-down transaction is tx _ a _ offfchain (B, m3) indicating that a transfers m3 tokens to B in the first channel, the second-chain-down transaction is tx _ B _ offhain (a, m4) indicating that B transfers m4 tokens to a in the first channel;
in step S120, a sends first registration request information of the registration service to the server, and the server registers the transaction push service for a according to the first registration request information and stores the push address of a;
the server generates channel creation notification information after a first channel is created between a and B from the synchronization of the block chain, and pushes the channel creation notification information to A and B respectively; in step S121, a receives channel creation notification information pushed by a server;
in step S122, a sends a first deposit transaction tx _ a _ destination 1(a, m1) to the server in response to a depositing within the first channel, the server forwards tx _ a _ destination 1(a, m1) to the blockchain node, which executes tx _ a _ destination 1(a, m1) through the first contract to transfer m1 tokens into the first channel; the server acquires an execution result of tx _ a _ destination 1(a, m1) from the blockchain to generate first deposit notification information, and pushes the first deposit notification information to a and B, respectively;
in step S123, A receives the first deposit notice information, and updates a first expendable asset limit information in the first channel according to the first deposit notice information; at this time, a updates the first expendable asset limit information of a to: m 1;
meanwhile, B receives the first deposit notice information and updates a first expendable asset limit information of the first channel according to the first deposit notice information; at this time, B updates the first expendable asset limit information of a to: m 1;
b, in response to B depositing within the first channel, sending a second deposit transaction tx _ B _ dispose 2(B, m2) to the server, the server forwarding tx _ B _ dispose 2(B, m2) to the blockchain node, the blockchain node executing tx _ B _ dispose 2(B, m2) through the first contract to transfer m2 tokens to the first channel; the server acquires the execution result of tx _ B _ destination 2(B, m2) from the blockchain to generate second deposit notification information, and the server pushes the second deposit notification information to a and B respectively; in step S124, a receives second deposit notification information pushed by the server, and updates b second expendable asset limit information in the first channel according to the second deposit notification information; at this time, a updates the second expendable asset limit information of b to: m 2;
meanwhile, B receives the second deposit notice information, and updates B the second expendable asset limit information in the first channel according to the second deposit notice information; at this time, B updates the first expendable asset limit information of B to: m 2;
in step S125, a sends a first down-link transaction tx _ a _ offchain to the server in response to a transferring an account to the second user in the first channel (B, m3), the server forwards tx _ a _ offchain (B, m3) to B, which stores tx _ a _ offchain (B, m 3); the transaction amount of the first-chain transaction is the sum of the transaction amount of the previous first-chain transaction and the transaction amount to be transferred;
b sending a second down-chain transaction tx _ B _ offchain (a, m4) to the server in response to a transferring the transaction to the second user in the first lane, the server forwarding tx _ B _ offchain (a, m4) to a; in step S126, a receives and stores tx _ b _ offchain (a, m4) sent by the server; the transaction amount of the second-chain transaction is the sum of the previous transaction amount of the second-chain transaction and the transaction amount to be transferred;
the first and second down-link transactions are proof of evidence of asset clearance for the first contract when either a or b requests clearance of the first lane.
In the current embodiment, the transaction method provided by the invention is elaborated by taking the example that only one asset token is operated on a block chain, and a first channel is configured as a channel which can only process the offline transaction of one kind of assets;
in more embodiments, assuming that when multiple kinds of assets (for example, assets of kinds AAA, BBB, and CCC) are running on a blockchain, and each channel can only process one kind of assets, to achieve the same technical effect, multiple first channels need to be configured for a and b; configuring different ids for each first channel to distinguish different first channels, for example, configuring a channel id for the first channel where AAA is located as 1, configuring a channel id for the first channel where BBB is located as 2, and configuring a channel id for the first channel where CCC is located as 3; taking the deposit transaction as an example, when a and/or b deposits, the channel id is specified in the deposit transaction generated by the corresponding client (for example, if the channel id is specified to be 3 in the deposit transaction, it can be known that the current deposit transaction is depositing the asset of the CCC), and the same technical effect can be achieved.
In further embodiments, assuming that a plurality of kinds of assets (for example, assets of kinds AAA, BBB, and CCC) run on the blockchain, and only one first channel is set, and the first channel can process all kinds of assets, to achieve the same technical effect, taking a deposit transaction as an example, when a and/or b deposits, the asset type is specified in the deposit transaction generated by the corresponding client (for example, it is known that the current deposit transaction is depositing on an asset of CCC if the asset type is specified in the deposit transaction, so that the same technical effect can be achieved.
Fig. 2 is a flow chart of step S121 in a preferred embodiment of the method shown in fig. 1. As shown in fig. 2, in a preferred embodiment, step S121 includes:
s1211: sending a first channel creation transaction to a server, so that the server forwards the first channel creation transaction to a blockchain node, and the blockchain node executes the first channel creation transaction through a first contract to create a first channel between a current user and a second user;
s1212: receiving first channel creation notification information pushed by a server; the server acquires an execution result of the first channel creation transaction from the blockchain, generates the first channel creation notification information, and respectively pushes the first channel creation notification information to the current user and the second client.
Fig. 3 is a flow chart of step S125 in a preferred embodiment of the method shown in fig. 1. As shown in fig. 3, in a preferred embodiment, step S125 includes:
s1251: receiving a second downlink transaction sent by the server;
s1252: determining whether the transaction amount of the second linked transaction is not greater than a second expendable asset limit:
if yes, go to step S1253: the second downlink transaction is stored.
Specifically, the second payable asset limit of b is m2, the second under-chain transaction is tx _ b _ offchai n (a, m4), and assume m2> m 4;
in step S1251, a receives the second downlink transaction tx _ b _ offchain (a, m4) sent by the server;
in step S1252, a determines whether the transaction amount m4 of tx _ b _ offchain (a, m4) is not greater than the second expendable asset limit m 2:
since m2> m4, step S1253 is performed: a stores tx _ b _ offchain (a, m 4).
In further embodiments, the step of configuring the transaction amount of the second linked transaction to be greater than the second expendable asset limit according to actual demand may be configured as: and if not, deleting the second downlink transaction, thereby realizing the same technical effect.
In further embodiments, the step of configuring the transaction amount of the second linked transaction to be greater than the second expendable asset limit according to the actual demand and configuring the penalty mechanism, for example, to: if not, storing the second down-link transaction, marking the second down-link transaction, and calculating a first total amount of the stored marked second down-link transaction; judging whether the first total amount reaches a pre-configured value: if yes, generating a second transaction, and sending the second transaction to the server so that the server forwards the second transaction to the blockchain node so that the blockchain node executes the second transaction to deduct a plurality of assets of a second user, wherein the second transaction comprises marked second-link-down transactions; the same technical effect can be achieved.
FIG. 4 is a flow diagram of a preferred embodiment of the method shown in FIG. 1. In a preferred embodiment, as shown in FIG. 4, the first contract is configured with a first value, and the method further comprises:
s127: sending a first closed channel transaction including a first turn-back attestation to a server for the server to:
forwarding the first closed channel transaction to the blockchain node so that the blockchain node executes the first closed channel transaction through the first contract, recording the first transfer account certificate on the blockchain, and closing the first channel; wherein the first transfer proof comprises a second offline transaction with a maximum transaction amount;
acquiring an execution result of the first closed channel transaction from the block chain to generate first closed channel notification information and respectively pushing the first closed channel notification information to a current user and a second client;
s128: receiving first closing channel notification information;
s129: receiving first submission certification notification information pushed by a server; the first submission certification notification information is generated by the server after acquiring an execution result of the first submission certification transaction from the block chain and is respectively pushed to the current user and the second client, the first submission certification transaction is generated by the second client in response to the second user submitting a second transfer certification and is sent to the block chain nodes through the server, so that the block chain nodes judge whether the difference between the height of a first block of a block to be generated and the height of a second block of the block where the first closed channel transaction is located is not greater than a first value or not: if yes, executing a first submission certification transaction through the first contract, and recording a second transfer certification to the blockchain, wherein the second transfer certification comprises a first down-chain transaction with the largest transaction amount;
s130: sending a first clearing transaction of the clearing first channel to the server for the server to:
forwarding the first clearing transaction to the blockchain node for the blockchain node to execute the first clearing transaction through the first contract, and clearing assets specified by the first clearing transaction of the current user and the second user in the first channel;
acquiring an execution result of the first clearing transaction from the block chain, generating first clearing notification information and respectively pushing the first clearing notification information to the current user and the second client;
s131: first clearing notification information is received.
Specifically, assume that the first closed channel transaction is tx _ a _ close1(proof1), proof1 is the first proof of transfer, the first proof of commit transaction is tx _ b _ update1(proof2), proof2 is the second proof of transfer, and the first clearing transaction is tx _ a _ set; proof1 is the second down-link transaction with the largest transaction amount, proof2 is the first down-link transaction with the largest transaction amount;
in step S127, a sends a first close channel transaction tx _ a _ close1 including a first posting certificate to the server (proof 1);
the server forwards tx _ a _ close1(proof1) to the blockchain node, which executes tx _ a _ close1(proof1) by a first contract, records proof1 onto the blockchain and closes the first channel;
the server acquires an execution result of tx _ a _ close1(proof1) from the blockchain to generate first closed channel notification information and pushes the first closed channel notification information to a and B respectively;
in step S128, a receives first close channel notification information;
b in response to the B commit proof2, generating a first commit proof transaction tx _ B _ update1(proof2) and sending it to the block link point by the server, the block link point determining whether a difference between a first block height of the block to be generated and a second block height of the block in which tx _ a _ close1(proof1) is located is not greater than a first value: if so, then a first proof-of-submission transaction is executed via the first contract, recording proof2 on the blockchain; the server acquires an execution result of the first submission proof transaction from the blockchain, generates first submission proof notification information and respectively pushes the first submission proof notification information to a and B; in step S129, a receives the first proof of submission notification information pushed by the server;
in step S130, a sends a first clearing transaction tx _ a _ set of the clearing first channel to the server;
the server forwards the tx _ a _ set to the block chain node, the block chain node executes the tx _ a _ set through a first contract, and assets specified by the tx _ a _ set of a and b in the first channel are cleared;
the server acquires an execution result of tx _ a _ set from the block chain, generates first clearing notification information and pushes the first clearing notification information to a and B respectively;
in step S131, a receives the first liquidation notification information.
In the above embodiment, proof1 is taken as the second downlink transaction with the largest transaction amount, and proof2 is taken as the first downlink transaction with the largest transaction amount, in which after B receives the first channel-closing notification message, it needs to generate the first submission proof transaction tx _ B _ update1(proof2) and send it to the blockchain node through the server; if B does not generate the first submission certification transaction and sends the first submission certification transaction to the block chain link point through the server, or the block chain link point judges that the difference between the height of the first block of the block to be generated and the height of the second block of the block where the first closed channel transaction is located is larger than a first value when the first submission certification transaction is to be executed, proof2 cannot be recorded on the block chain, and when clearing is carried out, B cannot obtain the asset to be obtained;
in further embodiments, proof1 may be configured as a first down-link transaction with a maximum transaction amount and a second down-link transaction with a maximum transaction amount, proof2 providing a first down-link transaction with a maximum transaction amount and a second down-link transaction with a maximum transaction amount when b considers proof1 to be incorrect; assuming that proof1 is tx _ a _ offchain (b, m3) and tx _ b _ offchain (a, m4), proof2 is tx _ a _ offchain (b, m5) and tx _ b _ offchain (a, m6), when a block link point performs a first clearing transaction, asset clearing is performed based on a first under-chain transaction of tx _ a _ offchain (b, m3) and tx _ a _ offchain (b, m5) in which the transaction amount is larger, and based on a second under-chain transaction of tx _ b _ offchain (a, m4) and tx _ b _ offchain (a, m6) in which the amount is larger.
Preferably, a sub-channel with asset type as a unit is configured in the first channel, and the first deposit transaction, the second deposit transaction, the first down-chain transaction, the second down-chain transaction, the first closing channel transaction, the first submission certification transaction and the first clearing transaction are all configured with asset type parameters, and the asset type is used for designating the sub-channel.
Specifically, assuming that multiple kinds of assets run on the blockchain, for example, assets of AAA, BBB, and CCC kinds run, an AAA subchannel, a BBB subchannel, and a CCC subchannel are configured in the first channel; taking the first down-link transaction as an example, the first down-link transaction is tx _ a _ offchain (b, m3, CCC), which means that the first down-link transaction is within the CCC subchannel, and a transfers m3 number of CCC assets to b.
In the above mechanism, a client lifts a deposit transaction to transfer assets into a first channel, the assets in the first channel cannot be taken out before a clearing transaction is performed; the problems caused by the above mechanism can be solved by the data acquisition method of the following preferred embodiment;
preferably, the method further comprises:
the server acquires the block height of each block from the block chain and pushes the block height to the first client and the second client.
Preferably, the method further comprises:
in response to the withdrawal of the first user, the first client sends a first withdrawal request to the server, and the server forwards the first withdrawal request to the second client;
the second client receives the first withdrawal request, verifies whether the requested amount of the first withdrawal request is below a preconfigured first threshold:
if yes, signing the first withdrawal request, freezing a plurality of assets specified by the first withdrawal request in the first channel and sending the assets to the server, and forwarding the signed first withdrawal request to the first client by the server;
the first client generates a first withdrawal transaction according to the signed first withdrawal request and sends the first withdrawal transaction to the server, the server forwards the first withdrawal transaction to the block link node, the block link node executes the first withdrawal transaction through a first contract, and an asset specified by the first withdrawal transaction of the first user in the first channel is transferred to the first user;
the server acquires an execution result of the first withdrawal transaction from the blockchain to generate first withdrawal notification information and pushes the first withdrawal notification information and the second withdrawal notification information to the first client and the second client respectively; wherein, the first threshold value is calculated according to the first expendable asset limit information;
and the first client and the second client update the first expendable asset limit information of the current user in the first channel according to the first withdrawal notification information.
In a preferred embodiment, the first withdrawal transaction is configured with a first effective block height, the block link points perform the first withdrawal transaction via a first contract, and transferring assets specified by the first withdrawal transaction of the first user in the first lane to the first user comprises:
the block link point judges whether the current block height is not larger than the first effective block height through a first contract:
if so, executing the first withdrawal transaction, and transferring the assets specified by the first withdrawal transaction of the first user in the first channel to the first user.
In a preferred embodiment, if the first withdrawal transaction fails to execute, the second client fails to receive the first withdrawal notification message within the first effective altitude, and the second client defrosts the assets specified by the first withdrawal request in the frozen first channel.
FIG. 5 is a flow diagram of another preferred embodiment of the method shown in FIG. 1. In a preferred embodiment, as shown in FIG. 5, the first contract is configured with a first value, and the method further comprises:
s135: receiving second closing channel notification information pushed by the server; the second channel closing notification information is generated by the server by obtaining an execution result of a second channel closing transaction from the blockchain and is respectively pushed to a current user and a second client, the second channel closing transaction comprises a second account transfer certificate, the second client sends the second channel closing transaction to the server for the server to forward the second channel closing transaction to the blockchain node so that the blockchain node executes the second channel closing transaction through a first contract, the second account transfer certificate is recorded on the blockchain and closes the first channel, and the second account transfer certificate comprises a first under-chain transaction with the largest transaction amount;
s136: in response to a current user submitting a first transfer certificate, sending a second submission certificate transaction to the server for the server to:
forwarding the second submission proof transaction to the block chain node, so that the block chain node judges that the difference between the first block height of the block to be generated and the third block height of the block where the second closed channel transaction is located is larger than a first numerical value: if yes, executing a second submission certification transaction through the first contract, recording the first submission certification on the block chain, and closing the first channel;
acquiring an execution result of the second submission proof transaction from the blockchain to generate second submission proof notification information and respectively pushing the second submission proof notification information to the current user and the second client;
s137: receiving second submission confirmation notification information;
s138: receiving second clearing notification information pushed by the server; the second clearing notification information is generated by the server by acquiring an execution result of the second clearing transaction from the blockchain and is respectively pushed to the current user and the second client, the second clearing transaction is sent to the server by the second client, so that the server forwards the second clearing transaction to the blockchain node, the blockchain node executes the second clearing transaction through the first contract, and assets specified by the second clearing transaction of the current user and the second user in the first channel are cleared.
The difference between the above-mentioned embodiment and the method shown in fig. 4 is that in the method shown in fig. 4, a first closed channel transaction is sent to the server by a, B generates a first submission certification transaction and sends the first submission certification transaction to the server in response to B submitting a second transfer certification, and a sends a clearing transaction to the server, whereas in the current embodiment, a second closed channel transaction is sent to the server by B, a generates a second submission certification transaction and sends the second submission certification transaction to the server in response to a submitting the first transfer certification, and B sends a clearing transaction to the server, and the transaction principles are the same, and are not described herein again.
In further embodiments, a may be configured to send a first close channel transaction to the server, B generates a first commit certification transaction and sends the first commit certification transaction to the server in response to B submitting the second transfer certification, B sends a clearing transaction to the server, or B sends a second close channel transaction to the server, a generates a second commit certification transaction and sends the second commit certification transaction to the server in response to a submitting the first transfer certification, and a sends the clearing transaction to the server.
Preferably, a sub-channel with asset type as a unit is configured in the first channel, and the first deposit transaction, the second deposit transaction, the first down-chain transaction, the second down-chain transaction, the first closing channel transaction, the first submission certification transaction and the first clearing transaction are all configured with asset type parameters, and the asset type is used for designating the sub-channel.
Preferably, the method further comprises:
the server acquires the block height of each block from the block chain and pushes the block height to the first client and the second client.
Preferably, the method further comprises:
the second client responds to the second user for withdrawing money, the second client sends a second withdrawal request to the server, and the server forwards the second withdrawal request to the first client;
the first client receives the second withdrawal request, verifies whether the requested amount of the second withdrawal request is below a preconfigured second threshold:
if yes, signing the second withdrawal request, freezing a plurality of assets specified by the second withdrawal request in the first channel and sending the assets to the server, and forwarding the signed second withdrawal request to the second client by the server;
the second client generates a second withdrawal transaction according to the signed second withdrawal request and sends the second withdrawal transaction to the server, the server forwards the second withdrawal transaction to the block link node, the block link node executes the second withdrawal transaction through the first contract, and an asset specified by the second withdrawal transaction of the second user in the first channel is transferred to the second user;
the server acquires an execution result of the second withdrawal transaction from the blockchain to generate second withdrawal notification information and pushes the second withdrawal notification information to the first client and the second client respectively; wherein the second threshold value is calculated according to the second expendable asset limit information;
and the first client and the second client update the second expendable asset limit information of the second user in the first channel according to the second withdrawal notification information.
In a preferred embodiment, the second withdrawal transaction is configured with a second effective block height, the block link point performing the second withdrawal transaction via the first contract, and transferring the asset specified by the second withdrawal transaction for the second user in the first lane to the second user comprises:
the block link point judges whether the current block height is not larger than the second effective block height through a first contract:
if so, a second withdrawal transaction is performed, and the asset specified by the second withdrawal transaction for the second user in the first channel is transferred to the second user.
In a preferred embodiment, if the second withdrawal transaction fails to execute, the first client fails to receive the second withdrawal notification message within the first effective altitude, and the first client unfreezes the assets specified by the second withdrawal request in the frozen first channel.
Fig. 6 is a flowchart of another transaction method according to an embodiment of the invention. As shown in fig. 6, in this embodiment, the present invention provides a transaction method applicable to a server, where each user registers a transaction push service with the server, and the method includes:
s220: receiving a first channel creation transaction sent by a first client of a first user or a second client of a second user, and forwarding the first channel creation transaction to a block chain node, so that the block chain node executes the first channel creation transaction through a first contract to create a first channel of the first user and the second user;
s221: acquiring an execution result of the first channel creation transaction from the blockchain to generate first channel creation notification information, and pushing the first channel creation notification information to the first client and the second client respectively;
s222: receiving a deposit transaction sent by a first client or a second client, and forwarding the deposit transaction to a blockchain node so that the blockchain node executes the deposit transaction through a first contract to transfer a plurality of assets specified by the deposit transaction to a first channel; wherein the deposit transaction is generated by the first client in response to the first user depositing in the first channel, or the second client in response to the second user depositing in the first channel;
s223: acquiring an execution result of a first deposit transaction from a block link point to generate deposit notification information, and pushing the deposit notification information to a first client and a second client respectively so that the first client and the second client can update the expendable asset limit information of a corresponding user in a first channel;
s224: receiving a first downlink transaction sent by a first client, and forwarding the first downlink transaction to a second client so that the second client can store the first downlink transaction; the first-chain transaction is generated by a first client responding to the first user to transfer accounts to a second user in a first channel;
s225: receiving a second downlink transaction sent by a second client, and forwarding the second downlink transaction to the first client so that the first client can store the second downlink transaction; the transaction amount of the second-chain transaction is the sum of the transaction amount of the previous second-chain transaction and the transaction amount to be transferred, and the second-chain transaction is generated by the second client responding to the second user to transfer accounts to the first user in the first channel;
wherein the first and second down-link transactions are used to certify the proof of compliance for the asset clearing as the first contract when the first or second user requests the clearing of the first channel.
The transaction principle of the above embodiment can refer to the method shown in fig. 1, and is not described herein again.
FIG. 7 is a flow chart of a preferred embodiment of the method shown in FIG. 6. In a preferred embodiment, as shown in FIG. 7, the first contract is configured with a first value, and the method further comprises:
s226: receiving a first channel closing transaction which is sent by a first client and comprises a first transfer certificate, forwarding the first channel closing transaction to a block chain node so that the block chain node executes the first channel closing transaction through a first contract, recording the first transfer certificate on a block chain, and closing the first channel; wherein the first transfer proof comprises a second offline transaction with a maximum transaction amount;
s227: acquiring an execution result of the first closed channel transaction from the block chain to generate first closed channel notification information, and pushing the first closed channel notification information to the first client and the second client respectively;
s228: receiving a first submission certification transaction which is sent by a second client and comprises a second transfer certification, and forwarding the first submission certification transaction to a block chain node so that the block chain node can judge whether the difference between the height of a first block of a block to be generated and the height of a second block of the block where the first closed channel transaction is located is not greater than a first value: if yes, executing a first submission proof transaction through the first contract, and recording a second transfer proof to the block chain; wherein the second transfer proof comprises a first down-link transaction with a maximum transaction amount, and the first submission proof transaction is generated by the first client in response to the second user submitting the second transfer proof;
s229: acquiring an execution result of the first submission proof transaction from the blockchain to generate first submission proof notification information, and pushing the first submission proof notification information to the first client and the second client respectively;
s230: receiving a first clearing transaction of a clearing first channel sent by a first client or a second client, forwarding the first clearing transaction to a block link node, so that the block link node executes the first clearing transaction through a first contract, and clearing assets specified by the first clearing transaction of a first user and a second user in the first channel;
s231: and acquiring an execution result of the first clearing transaction from the blockchain to generate first clearing notification information, and respectively pushing the first clearing notification information to the first client and the second client.
The transaction principle of the above embodiment can refer to the method shown in fig. 4, and is not described herein again.
Preferably, a sub-channel with asset type as a unit is configured in the first channel, and the deposit transaction, the first down-link transaction, the second down-link transaction, the first closed channel transaction, the first submission certification transaction and the first clearing transaction are all configured with asset type parameters, and the asset type is used for designating the sub-channel.
Preferably, the first contract is configured with a first value, the method further comprising:
receiving a second channel closing transaction which is sent by a second client and comprises a second transfer certificate, forwarding the second channel closing transaction to the blockchain node so that the blockchain node can execute the second channel closing transaction through the first contract, recording the second transfer certificate on the blockchain, and closing the first channel; wherein the second proof of transfer comprises a first down-link transaction with a maximum transaction amount;
acquiring an execution result of the second channel closing transaction from the block chain to generate second channel closing notification information, and pushing the second channel closing notification information to the first client and the second client respectively;
receiving a first submission certification transaction which is sent by a first client and comprises a second transfer certification, and forwarding the second submission certification transaction to a block chain node so that the block chain node can judge whether the difference between the height of a first block of a block to be generated and the height of a third block of the block where the second closed channel transaction is located is not greater than a first value: if yes, executing a second submission certification transaction through the first contract, and recording the first submission certification on the block chain; wherein the first transfer proof comprises a first down-link transaction with a maximum transaction amount, and the second proof-of-submission transaction is generated by the second client in response to the first user submitting the second transfer proof;
acquiring an execution result of the second submission proof transaction from the blockchain to generate second submission proof notification information, and pushing the second submission proof notification information to the first client and the second client respectively;
receiving a first clearing transaction of a clearing first channel sent by a first client or a second client, forwarding the first clearing transaction to a block link node, so that the block link node executes the first clearing transaction through a first contract, and clearing assets specified by the first clearing transaction of a first user and a second user in the first channel;
and acquiring an execution result of the first clearing transaction from the blockchain to generate first clearing notification information, and respectively pushing the first clearing notification information to the first client and the second client.
The difference between the above-mentioned embodiment and the method shown in fig. 7 is that in the method shown in fig. 7, a first client sends a first channel closing transaction to a server, a second client generates a first submission certification transaction and sends the first submission certification transaction to the server in response to a second transfer certification submitted by a second user, and the first client sends a clearing transaction to the server, whereas in the current embodiment, a second channel closing transaction is sent by the second client to the server, a second submission certification transaction is generated by the first client in response to a first transfer certification submitted by the first user and sent to the server, and a clearing transaction is sent by the second client to the server.
Preferably, the method further comprises:
the server acquires the block height of each block from the block chain and pushes the block height to the first client and the second client.
Preferably, the method further comprises:
in response to the withdrawal of the first user, the first client sends a first withdrawal request to the server, and the server forwards the first withdrawal request to the second client;
the second client receives the first withdrawal request, verifies whether the requested amount of the first withdrawal request is below a preconfigured first threshold:
if yes, signing the first withdrawal request, freezing a plurality of assets specified by the first withdrawal request in the first channel and sending the assets to the server, and forwarding the signed first withdrawal request to the first client by the server;
the first client generates a first withdrawal transaction according to the signed first withdrawal request and sends the first withdrawal transaction to the server, the server forwards the first withdrawal transaction to the block link node, the block link node executes the first withdrawal transaction through a first contract, and an asset specified by the first withdrawal transaction of the first user in the first channel is transferred to the first user;
the server acquires an execution result of the first withdrawal transaction from the blockchain to generate first withdrawal notification information and pushes the first withdrawal notification information and the second withdrawal notification information to the first client and the second client respectively; wherein, the first threshold value is calculated according to the first expendable asset limit information;
and the first client and the second client update the first expendable asset limit information of the current user in the first channel according to the first withdrawal notification information.
In a preferred embodiment, the first withdrawal transaction is configured with a first effective block height, the block link points perform the first withdrawal transaction via a first contract, and transferring assets specified by the first withdrawal transaction of the first user in the first lane to the first user comprises:
the block link point judges whether the current block height is not larger than the first effective block height through a first contract:
if so, executing the first withdrawal transaction, and transferring the assets specified by the first withdrawal transaction of the first user in the first channel to the first user.
In a preferred embodiment, if the first withdrawal transaction fails to execute, the second client fails to receive the first withdrawal notification message within the first effective altitude, and the second client defrosts the assets specified by the first withdrawal request in the frozen first channel.
Preferably, the method further comprises:
the second client responds to the second user for withdrawing money, the second client sends a second withdrawal request to the server, and the server forwards the second withdrawal request to the first client;
the first client receives the second withdrawal request, verifies whether the requested amount of the second withdrawal request is below a preconfigured second threshold:
if yes, signing the second withdrawal request, freezing a plurality of assets specified by the second withdrawal request in the first channel and sending the assets to the server, and forwarding the signed second withdrawal request to the second client by the server;
the second client generates a second withdrawal transaction according to the signed second withdrawal request and sends the second withdrawal transaction to the server, the server forwards the second withdrawal transaction to the block link node, the block link node executes the second withdrawal transaction through the first contract, and an asset specified by the second withdrawal transaction of the second user in the first channel is transferred to the second user;
the server acquires an execution result of the second withdrawal transaction from the blockchain to generate second withdrawal notification information and pushes the second withdrawal notification information to the first client and the second client respectively; wherein the second threshold value is calculated according to the second expendable asset limit information;
and the first client and the second client update the second expendable asset limit information of the second user in the first channel according to the second withdrawal notification information.
In a preferred embodiment, the second withdrawal transaction is configured with a second effective block height, the block link point performing the second withdrawal transaction via the first contract, and transferring the asset specified by the second withdrawal transaction for the second user in the first lane to the second user comprises:
the block link point judges whether the current block height is not larger than the second effective block height through a first contract:
if so, a second withdrawal transaction is performed, and the asset specified by the second withdrawal transaction for the second user in the first channel is transferred to the second user.
In a preferred embodiment, if the second withdrawal transaction fails to execute, the first client fails to receive the second withdrawal notification message within the first effective altitude, and the first client unfreezes the assets specified by the second withdrawal request in the frozen first channel.
Fig. 8 is a flowchart of another transaction method according to an embodiment of the invention. As shown in fig. 8, in this embodiment, the present invention provides a transaction method applicable to a blockchain node, where each user registers a transaction push service with a server, and a first contract is configured with a first numerical value, where the method includes:
s310: receiving a first channel creation transaction forwarded by a server, executing the first channel creation transaction through a first contract to create a first channel between a first user and a second user, so that the server can generate first creation channel notification information after acquiring an execution result of the first channel creation transaction and respectively push the first creation channel notification information to a first client of the first user and a second client of the second user; the first channel creation transaction is generated by the first client or the second client and is sent to the server;
s311: receiving the deposit transaction forwarded by the server, executing the deposit transaction through a first contract to transfer a plurality of assets specified by the deposit transaction to a first channel, so that the server can acquire the execution result of the deposit transaction to generate deposit notification information and respectively push the deposit notification information to a first client or a second client; wherein the deposit transaction is generated by the first client in response to the first user depositing in the first channel, or the second client in response to the second user depositing in the first channel and sent to the server;
s312: receiving a first closed channel transaction which is forwarded by a server and comprises a first transfer certificate, executing the first closed channel transaction through a first contract, recording the first transfer certificate on a block chain, and closing the first channel, so that the server acquires an execution result of the first closed channel transaction from the block chain to generate first closed channel notification information and respectively pushes the first closed channel notification information to a first client and a second client; the first transfer certification comprises a second down-link transaction with the largest transaction amount, the second down-link transaction is generated by a second client in response to the fact that a second user transfers accounts to the first user in a first channel and is sent to the server, the transaction amount of the second down-link transaction is the sum of the transaction amount of the previous down-link transaction and the transaction amount to be transferred, and the first closed channel transaction is sent to the server by the first client;
s313: receiving a first submission certification transaction which is forwarded by the server and comprises a second transfer certification, and judging whether the difference between the height of a first block of a block to be generated and the height of a second block of the block where the first closed channel transaction is located is not larger than the first numerical value: if so, executing a first submission certification transaction through a first contract, and recording a second transfer certification on the blockchain, so that the server acquires an execution result of the first submission certification transaction from the blockchain to generate first submission certification notification information and respectively pushes the first submission certification notification information to the first client and the second client; the first submission certification transaction is generated by the first client in response to the second user submitting a second transfer certification, the second transfer certification comprises a first down-link transaction with the largest transaction amount, the first down-link transaction is sent to the server by the first client in response to the first user transferring accounts to the second user in the first channel, the transaction amount of the first down-link transaction is the sum of the transaction amount of the first down-link transaction at the previous time and the transaction amount to be transferred, and the first submission certification transaction is sent to the server by the second client;
s314: receiving a first clearing transaction of a clearing first channel forwarded by a server, executing the first clearing transaction through a first contract, clearing assets specified by the first clearing transaction of a first user and a second user in the first channel, and enabling the server to acquire an execution result of the first clearing transaction from a blockchain to generate first clearing notification information and push the first clearing notification information to a first client and a second client respectively; wherein the first clearing transaction is sent by the first client or the second client to the server.
The transaction principle of the above embodiment can refer to the method shown in fig. 4, and is not described herein again.
Preferably, a sub-channel with asset type as a unit is configured in the first channel, and the deposit transaction, the first down-link transaction, the second down-link transaction, the first closed channel transaction, the first submission certification transaction and the first clearing transaction are all configured with asset type parameters, and the asset type is used for designating the sub-channel.
Preferably, the method further comprises:
the server acquires the block height of each block from the block chain and pushes the block height to the first client and the second client.
Preferably, the method further comprises:
in response to the withdrawal of the first user, the first client sends a first withdrawal request to the server, and the server forwards the first withdrawal request to the second client;
the second client receives the first withdrawal request, verifies whether the requested amount of the first withdrawal request is below a preconfigured first threshold:
if yes, signing the first withdrawal request, freezing a plurality of assets specified by the first withdrawal request in the first channel and sending the assets to the server, and forwarding the signed first withdrawal request to the first client by the server;
the first client generates a first withdrawal transaction according to the signed first withdrawal request and sends the first withdrawal transaction to the server, the server forwards the first withdrawal transaction to the block link node, the block link node executes the first withdrawal transaction through a first contract, and an asset specified by the first withdrawal transaction of the first user in the first channel is transferred to the first user;
the server acquires an execution result of the first withdrawal transaction from the blockchain to generate first withdrawal notification information and pushes the first withdrawal notification information and the second withdrawal notification information to the first client and the second client respectively; wherein, the first threshold value is calculated according to the first expendable asset limit information;
and the first client and the second client update the first expendable asset limit information of the current user in the first channel according to the first withdrawal notification information.
In a preferred embodiment, the first withdrawal transaction is configured with a first effective block height, the block link points perform the first withdrawal transaction via a first contract, and transferring assets specified by the first withdrawal transaction of the first user in the first lane to the first user comprises:
the block link point judges whether the current block height is not larger than the first effective block height through a first contract:
if so, executing the first withdrawal transaction, and transferring the assets specified by the first withdrawal transaction of the first user in the first channel to the first user.
In a preferred embodiment, if the first withdrawal transaction fails to execute, the second client fails to receive the first withdrawal notification message within the first effective altitude, and the second client defrosts the assets specified by the first withdrawal request in the frozen first channel.
Preferably, the method further comprises:
the second client responds to the second user for withdrawing money, the second client sends a second withdrawal request to the server, and the server forwards the second withdrawal request to the first client;
the first client receives the second withdrawal request, verifies whether the requested amount of the second withdrawal request is below a preconfigured second threshold:
if yes, signing the second withdrawal request, freezing a plurality of assets specified by the second withdrawal request in the first channel and sending the assets to the server, and forwarding the signed second withdrawal request to the second client by the server;
the second client generates a second withdrawal transaction according to the signed second withdrawal request and sends the second withdrawal transaction to the server, the server forwards the second withdrawal transaction to the block link node, the block link node executes the second withdrawal transaction through the first contract, and an asset specified by the second withdrawal transaction of the second user in the first channel is transferred to the second user;
the server acquires an execution result of the second withdrawal transaction from the blockchain to generate second withdrawal notification information and pushes the second withdrawal notification information to the first client and the second client respectively; wherein the second threshold value is calculated according to the second expendable asset limit information;
and the first client and the second client update the second expendable asset limit information of the second user in the first channel according to the second withdrawal notification information.
In a preferred embodiment, the second withdrawal transaction is configured with a second effective block height, the block link point performing the second withdrawal transaction via the first contract, and transferring the asset specified by the second withdrawal transaction for the second user in the first lane to the second user comprises:
the block link point judges whether the current block height is not larger than the second effective block height through a first contract:
if so, a second withdrawal transaction is performed, and the asset specified by the second withdrawal transaction for the second user in the first channel is transferred to the second user.
In a preferred embodiment, if the second withdrawal transaction fails to execute, the first client fails to receive the second withdrawal notification message within the first effective altitude, and the first client unfreezes the assets specified by the second withdrawal request in the frozen first channel.
Fig. 9 is a flowchart of another transaction method according to an embodiment of the invention. As shown in fig. 9, in this embodiment, the present invention provides a transaction method applicable to a blockchain node, where each user registers a transaction push service with a server, and a first contract is configured with a first numerical value, where the method includes:
s410: receiving a first channel creation transaction forwarded by a server, executing the first channel creation transaction through a first contract to create a first channel between a first user and a second user, so that the server can generate first creation channel notification information after acquiring an execution result of the first channel creation transaction and respectively push the first creation channel notification information to a first client of the first user and a second client of the second user; the first channel creation transaction is generated by the first client or the second client and is sent to the server;
s411: receiving the deposit transaction forwarded by the server, executing the deposit transaction through a first contract to transfer a plurality of assets specified by the deposit transaction to a first channel, so that the server can acquire the execution result of the deposit transaction to generate deposit notification information and respectively push the deposit notification information to a first client or a second client; wherein the deposit transaction is generated by the first client in response to the first user depositing in the first channel, or the second client in response to the second user depositing in the first channel and sent to the server;
s412: receiving a second channel closing transaction which is forwarded by the server and comprises a second transfer certificate, executing the second channel closing transaction through a first contract, recording the second transfer certificate on the block chain, and closing the first channel, so that the server can acquire an execution result of the second channel closing transaction from the block chain to generate second channel closing notification information and respectively push the second channel closing notification information to the first client and the second client; the second account transfer certification comprises a first down-link transaction with the largest transaction amount, the first down-link transaction is generated by a first client in response to the fact that a first user transfers accounts to a second user in a first channel and is sent to a server, the transaction amount of the first down-link transaction is the sum of the transaction amount of the first down-link transaction which is carried out last time and the transaction amount to be transferred, and the second closed-channel transaction is sent to the server by the second client;
s413: receiving a second submission certification transaction which is forwarded by the server and comprises a first transfer certification, and judging whether the difference between the height of a first block of a block to be generated and the height of a third block of a block where the second closed channel transaction is located is not larger than the first numerical value: if so, executing a second submission certification transaction through the first contract, and recording the first submission certification on the blockchain, so that the server can acquire an execution result of the second submission certification transaction from the blockchain to generate second submission certification notification information and respectively push the second submission certification notification information to the first client and the second client; the second submission certification transaction is generated by the second client in response to the first user submitting the second transfer certification, the first transfer certification comprises a second down-link transaction with the largest transaction amount, the second down-link transaction is sent to the server by the second client in response to the second user transferring accounts to the first user in the first channel, the transaction amount of the second down-link transaction is the sum of the transaction amount of the previous second down-link transaction and the transaction amount to be transferred, and the second submission certification transaction is sent to the server by the first client;
s414: receiving a first clearing transaction of a clearing first channel forwarded by a server, executing the first clearing transaction through a first contract, clearing assets specified by the first clearing transaction of a first user and a second user in the first channel, and enabling the server to acquire an execution result of the first clearing transaction from a blockchain to generate first clearing notification information and push the first clearing notification information to a first client and a second client respectively; wherein the first clearing transaction is sent by the first client or the second client to the server.
The difference between the above-mentioned embodiment and the method shown in fig. 8 is that in the method shown in fig. 8, a first client sends a first channel closing transaction to a server, a second client generates a first submission certification transaction and sends the first submission certification transaction to the server in response to a second transfer certification submitted by a second user, and the first client sends a clearing transaction to the server, whereas in the current embodiment, a second channel closing transaction is sent by the second client to the server, a second submission certification transaction is generated by the first client in response to a first transfer certification submitted by the first user and sent to the server, and a clearing transaction is sent by the second client to the server.
Preferably, a sub-channel with asset type as a unit is configured in the first channel, and the deposit transaction, the first down-link transaction, the second down-link transaction, the first closed channel transaction, the first submission certification transaction and the first clearing transaction are all configured with asset type parameters, and the asset type is used for designating the sub-channel.
Preferably, the method further comprises:
the server acquires the block height of each block from the block chain and pushes the block height to the first client and the second client.
Preferably, the method further comprises:
in response to the withdrawal of the first user, the first client sends a first withdrawal request to the server, and the server forwards the first withdrawal request to the second client;
the second client receives the first withdrawal request, verifies whether the requested amount of the first withdrawal request is below a preconfigured first threshold:
if yes, signing the first withdrawal request, freezing a plurality of assets specified by the first withdrawal request in the first channel and sending the assets to the server, and forwarding the signed first withdrawal request to the first client by the server;
the first client generates a first withdrawal transaction according to the signed first withdrawal request and sends the first withdrawal transaction to the server, the server forwards the first withdrawal transaction to the block link node, the block link node executes the first withdrawal transaction through a first contract, and an asset specified by the first withdrawal transaction of the first user in the first channel is transferred to the first user;
the server acquires an execution result of the first withdrawal transaction from the blockchain to generate first withdrawal notification information and pushes the first withdrawal notification information and the second withdrawal notification information to the first client and the second client respectively; wherein, the first threshold value is calculated according to the first expendable asset limit information;
and the first client and the second client update the first expendable asset limit information of the current user in the first channel according to the first withdrawal notification information.
In a preferred embodiment, the first withdrawal transaction is configured with a first effective block height, the block link points perform the first withdrawal transaction via a first contract, and transferring assets specified by the first withdrawal transaction of the first user in the first lane to the first user comprises:
the block link point judges whether the current block height is not larger than the first effective block height through a first contract:
if so, executing the first withdrawal transaction, and transferring the assets specified by the first withdrawal transaction of the first user in the first channel to the first user.
In a preferred embodiment, if the first withdrawal transaction fails to execute, the second client fails to receive the first withdrawal notification message within the first effective altitude, and the second client defrosts the assets specified by the first withdrawal request in the frozen first channel.
Preferably, the method further comprises:
the second client responds to the second user for withdrawing money, the second client sends a second withdrawal request to the server, and the server forwards the second withdrawal request to the first client;
the first client receives the second withdrawal request, verifies whether the requested amount of the second withdrawal request is below a preconfigured second threshold:
if yes, signing the second withdrawal request, freezing a plurality of assets specified by the second withdrawal request in the first channel and sending the assets to the server, and forwarding the signed second withdrawal request to the second client by the server;
the second client generates a second withdrawal transaction according to the signed second withdrawal request and sends the second withdrawal transaction to the server, the server forwards the second withdrawal transaction to the block link node, the block link node executes the second withdrawal transaction through the first contract, and an asset specified by the second withdrawal transaction of the second user in the first channel is transferred to the second user;
the server acquires an execution result of the second withdrawal transaction from the blockchain to generate second withdrawal notification information and pushes the second withdrawal notification information to the first client and the second client respectively; wherein the second threshold value is calculated according to the second expendable asset limit information;
and the first client and the second client update the second expendable asset limit information of the second user in the first channel according to the second withdrawal notification information.
In a preferred embodiment, the second withdrawal transaction is configured with a second effective block height, the block link point performing the second withdrawal transaction via the first contract, and transferring the asset specified by the second withdrawal transaction for the second user in the first lane to the second user comprises:
the block link point judges whether the current block height is not larger than the second effective block height through a first contract:
if so, a second withdrawal transaction is performed, and the asset specified by the second withdrawal transaction for the second user in the first channel is transferred to the second user.
In a preferred embodiment, if the second withdrawal transaction fails to execute, the first client fails to receive the second withdrawal notification message within the first effective altitude, and the first client unfreezes the assets specified by the second withdrawal request in the frozen first channel.
Fig. 10 is a schematic structural diagram of an apparatus according to an embodiment of the present invention. As shown in fig. 10, as another aspect, the present application also provides an apparatus 1000 including one or more Central Processing Units (CPUs) 1001 which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)1002 or a program loaded from a storage section 1008 into a Random Access Memory (RAM) 1003. In the RAM1003, various programs and data necessary for the operation of the apparatus 1000 are also stored. The CPU1001, ROM1002, and RAM1003 are connected to each other via a bus 1004. An input/output (I/O) interface 1005 is also connected to bus 1004.
The following components are connected to the I/O interface 1005: an input section 1006 including a keyboard, a mouse, and the like; an output section 1007 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 1008 including a hard disk and the like; and a communication section 1009 including a network interface card such as a LAN card, a modem, or the like. The communication section 1009 performs communication processing via a network such as the internet. The driver 1010 is also connected to the I/O interface 1005 as necessary. A removable medium 1011 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 1010 as necessary, so that a computer program read out therefrom is mounted into the storage section 1008 as necessary.
In particular, according to an embodiment of the present disclosure, the transaction method described in any of the above embodiments may be implemented as a computer software program. For example, embodiments of the present disclosure include a computer program product comprising a computer program tangibly embodied on a machine-readable medium, the computer program comprising program code for performing a transaction method. In such an embodiment, the computer program may be downloaded and installed from a network through the communication part 1009 and/or installed from the removable medium 1011.
As yet another aspect, the present application also provides a computer-readable storage medium, which may be the computer-readable storage medium included in the apparatus of the above-described embodiment; or it may be a separate computer readable storage medium not incorporated into the device. The computer readable storage medium stores one or more programs for use by one or more processors in performing the transaction methods described herein.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units or modules described in the embodiments of the present application may be implemented by software or hardware. The described units or modules may also be provided in a processor, for example, each of the described units may be a software program provided in a computer or a mobile intelligent device, or may be a separately configured hardware device. Wherein the designation of a unit or module does not in some way constitute a limitation of the unit or module itself.
The above description is only a preferred embodiment of the application and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention herein disclosed is not limited to the particular combination of features described above, but also encompasses other arrangements formed by any combination of the above features or their equivalents without departing from the spirit of the present application. For example, the above features may be replaced with (but not limited to) features having similar functions disclosed in the present application.
Claims (15)
1. A transaction method applicable to a client, the method comprising:
sending first registration request information of registration service to a server, so that the server sends registration transaction push service to a current user and a third party according to the first registration request information, and stores a push address of a current client;
receiving channel creation notification information pushed by the server; the channel creation notification information is generated by the server from block chain synchronization to the time when a first channel is created between the current user and the second user;
in response to a current user depositing in the first channel, sending a first deposit transaction to the server for the server to:
forwarding the first deposit transaction to a blockchain node for the blockchain node to perform the first deposit transaction via a first contract to transfer a number of assets specified by the first deposit transaction to the first channel;
acquiring an execution result of the first deposit transaction from the blockchain to generate first deposit notification information and respectively pushing the first deposit notification information to a current user and a second client of the second user;
receiving the first deposit notification information, and updating first expendable asset limit information of the current user in the first channel according to the first deposit notification information;
receiving second deposit notification information pushed by the server, and updating second expendable asset limit information of the second user in the first channel according to the second deposit notification information; the second deposit notification information is generated by the second client by the server by obtaining an execution result of a second deposit transaction from the blockchain and is respectively pushed to the current user and the second client, and the second deposit transaction is generated by the second client in response to the second user depositing in the first channel and is sent to the blockchain node through the server so that the blockchain node can execute the second deposit transaction through the first contract to transfer a plurality of assets specified by the second deposit transaction to the first channel;
receiving the third deposit notification information, and updating third expendable asset limit information of the current user in the first channel according to the third deposit notification information; wherein,
the third deposit notification information is generated by the third client by the server by obtaining an execution result of a third deposit transaction from the blockchain and is respectively pushed to the current user, a third party client and the second client, the third deposit transaction is generated by the third client in response to the third party allocating available deposits within a first time limit for the current user in the first channel and is sent to the blockchain node through the server, so that the blockchain node executes the third deposit transaction through the first contract to transfer a plurality of assets specified by the third deposit transaction to the first channel;
receiving the fourth deposit notification information, and updating fourth expendable asset limit information of the second user in the first channel according to the fourth deposit notification information; wherein,
the fourth deposit notification information is generated by the fourth client by the server obtaining an execution result of a fourth deposit transaction from the blockchain and is respectively pushed to the current user, the third client and the second client, the fourth deposit transaction is generated by the third client in response to the third party allocating available deposits within a second time limit to the second user in the first channel and is sent to the blockchain node through the server, so that the blockchain node executes the fourth deposit transaction through the first contract to transfer a plurality of assets specified by the fourth deposit transaction to the first channel;
in response to the current user transferring money to the second user in the first channel, sending a first down-link transaction to the server for the server to forward the first down-link transaction to the second client for the second client to store the first down-link transaction; the transaction amount of the first-chain transaction is the sum of the transaction amount of the previous first-chain transaction and the transaction amount to be transferred;
receiving and storing a second downlink transaction sent by the server; the second down-link transaction is generated by the second client in response to the second user transferring the money to the first user in the first channel and is sent to the server, and the transaction amount of the second down-link transaction is the sum of the transaction amount of the previous second down-link transaction and the transaction amount to be transferred;
wherein the first and second down-link transactions are proof of compliance for asset clearance as the first contract when the current user or the second user requests clearance of the first channel.
2. The method of claim 1, wherein the receiving the channel creation notification information pushed by the server comprises:
sending a first channel creation transaction to the server for the server to forward the first channel creation transaction to the blockchain node for the blockchain node to execute the first channel creation transaction through the first contract to create a first channel between the current user and the second user;
receiving first channel creation notification information pushed by the server; the server acquires an execution result of the first channel creation transaction from the blockchain, generates the first channel creation notification information, and respectively pushes the first channel creation notification information to the current user, the third client and the second client.
3. The method of claim 1, wherein receiving and storing the second downlink transaction sent by the server comprises:
receiving a second downlink transaction sent by the server;
judging whether the transaction amount of the second downlink transaction is not greater than the second expendable asset limit and a fourth expendable asset limit:
if so, the second downlink transaction is stored.
4. The method of any of claims 1-3, wherein the first contract is configured with a first numerical value, the method further comprising:
sending a first closed channel transaction including a first turn-back attestation to the server for the server to:
forwarding the first closed channel transaction to the blockchain node, so that the blockchain node executes the first closed channel transaction through the first contract, records the first transfer account certificate on the blockchain, and closes the first channel; wherein the first transfer proof comprises the second offline transaction with the largest transaction amount;
acquiring an execution result of the first closed channel transaction from the block chain to generate first closed channel notification information and respectively pushing the first closed channel notification information to a current user and the second client;
receiving the first closing channel notification information;
receiving first submission certification notification information pushed by the server; the first submission certification notification information is generated by the server after obtaining an execution result of the first submission certification transaction from a block chain and is respectively pushed to a current user, a third client and the second client, the first submission certification transaction is generated by the second client in response to the second user submitting a second transfer certification and is sent to the block chain node through the server, so that the block chain node can judge whether a difference between a first block height of a block to be generated and a second block height of a block where the first closed channel transaction is located is not greater than a first numerical value: if yes, executing the first submission proof transaction through the first contract, and recording the second transfer proof to a block chain, wherein the second transfer proof comprises the first off-chain transaction with the largest transaction amount;
sending a first clearing transaction to the server clearing the first channel for the server to:
forwarding the first clearing transaction to the blockchain node for the blockchain node to execute the first clearing transaction via the first contract, clearing assets specified by the first clearing transaction for the current user and the second user within the first channel;
acquiring an execution result of the first clearing transaction from the block chain, generating first clearing notification information, and respectively pushing the first clearing notification information to a current user, a third client and the second client; receiving the first clearing notification information.
5. The method of claim 4, wherein a subchannel in units of an asset type is configured within the first channel, and wherein the first deposit transaction, the second deposit transaction, the first down-link transaction, the second down-link transaction, the first close channel transaction, the first proof-of-submission transaction, and the first clear transaction are each configured with an asset type parameter, the asset type being used to designate a subchannel.
6. The method of any of claims 1-3, wherein the first contract is configured with a first numerical value, the method further comprising:
receiving second closing channel notification information pushed by the server; the second channel closing notification information is generated by the server obtaining an execution result of a second channel closing transaction from a block chain and is respectively pushed to a current user and the second client, the second channel closing transaction comprises a second transfer certificate, the second client sends the second channel closing transaction to the server so that the server can forward the second channel closing transaction to the block chain node, the block chain node executes the second channel closing transaction through the first contract, the second transfer certificate is recorded on the block chain and closes the first channel, and the second transfer certificate comprises the first under-chain transaction with the largest transaction amount;
in response to a current user submitting a first turn-out attestation, sending a second turn-out attestation transaction to the server for the server to:
forwarding the second commit transaction to the block link node for the block link node to determine whether a difference between a first block height of the block to be generated and a third block height of the block in which the second close channel transaction is located is not greater than the first value: if yes, executing the second submission proof transaction through the first contract, recording the first submission proof to a block chain, and closing the first channel;
obtaining an execution result of the second submission proof transaction from the blockchain to generate second submission proof notification information and respectively pushing the second submission proof notification information to the current user, a third client and the second client; receiving the second proof of submission notification information; receiving second clearing notification information pushed by the server; the second clearing notification information is generated by the server obtaining an execution result of a second clearing transaction from the blockchain and is respectively pushed to the current user, a third client and the second client, the second clearing transaction is sent to the server by the second client, so that the server forwards the second clearing transaction to a blockchain node, the blockchain node executes the second clearing transaction through the first contract, and assets specified by the second clearing transaction of the current user and the second user in the first channel are cleared.
7. The method of claim 6, wherein a subchannel in units of an asset type is configured within the first channel, and wherein the first deposit transaction, the second deposit transaction, the first down-link transaction, the second close channel transaction, the second proof-of-submission transaction, and the second clear transaction are each configured with an asset type parameter, the asset type specifying a subchannel.
8. The method of claim 6,
when the transaction amount of the first under-link transaction is larger than the first expendable asset amount and smaller than the sum of the first expendable asset amount and the third expendable asset amount, the part of the transaction amount of the first under-link transaction, which needs to be deducted by the third expendable asset amount, is frozen by the fourth party; when the second party pays the procedure time of the specified proportion to the fourth party, the third expendable asset limit is unfrozen by the fourth party frozen part, and the unfrozen part of the asset enters the second expendable asset limit of the second party;
when the transaction amount of the second chain transaction is larger than the second expendable asset amount and smaller than the sum of the second expendable asset amount and the fourth expendable asset amount, the part of the transaction amount of the second chain transaction, which needs to be deducted by the fourth expendable asset amount, is frozen by the fourth party; when the first party pays the specified proportion of procedure time to the fourth party, the fourth expendable asset limit is unfrozen by the fourth party frozen part, and the unfrozen part of the asset enters the first expendable asset limit of the first party.
9. A transaction method is characterized in that the method is suitable for a server side, and each user registers transaction push service with the server respectively, and the method comprises the following steps:
receiving a first channel creation transaction sent by a first client of a first user or a second client of a second user, and forwarding the first channel creation transaction to the blockchain node, so that the blockchain node executes the first channel creation transaction through the first contract to create a first channel between the first user and the second user;
acquiring an execution result of the first channel creation transaction from a blockchain to generate first channel creation notification information, and respectively pushing the first channel creation notification information to the first client and the second client;
receiving a deposit transaction sent by the first client or the second client, and forwarding the deposit transaction to a block chain node so that the block chain node executes the deposit transaction through a first contract to transfer a plurality of assets specified by the deposit transaction to the first channel; wherein the deposit transaction is generated by the first client in response to a first user depositing within the first channel, or the second client in response to a second user depositing within the first channel;
acquiring an execution result of a first deposit transaction from the block link point to generate deposit notification information, and pushing the deposit notification information to the first client and the second client respectively so that the first client and the second client can update the expendable asset limit information of the corresponding user in the first channel;
receiving a first downlink transaction sent by the first client, and forwarding the first downlink transaction to the second client so that the second client can store the first downlink transaction; the transaction amount of the first-chain transaction is the sum of the transaction amount of the previous first-chain transaction and the transaction amount to be transferred, and the first-chain transaction is generated by the first client in response to the first user transferring accounts to the second user in the first channel;
receiving a second downlink transaction sent by the second client, and forwarding the second downlink transaction to the first client so that the first client can store the second downlink transaction; the transaction amount of the second down-link transaction is the sum of the transaction amount of the previous second down-link transaction and the transaction amount to be transferred, and the second down-link transaction is generated by the second client in response to the second user transferring accounts to the first user in the first channel;
wherein the first and second down-link transactions are used to certify proof of compliance for asset clearing as the first contract when the first or second user requests clearing of the first channel.
10. The method of claim 9, wherein the first contract is configured with a first numerical value, the method further comprising:
receiving a first channel closing transaction which is sent by the first client and comprises a first transfer account certificate, forwarding the first channel closing transaction to the blockchain node so that the blockchain node can execute the first channel closing transaction through the first contract, recording the first transfer account certificate on the blockchain, and closing the first channel; wherein the first transfer proof comprises the second offline transaction with the largest transaction amount;
acquiring an execution result of the first channel closing transaction from a block chain to generate first channel closing notification information, and pushing the first channel closing notification information to the first client and the second client respectively;
receiving a first submission certification transaction which is sent by the second client and comprises a second transfer certification, and forwarding the first submission certification transaction to the block chain node so that the block chain node can judge whether the difference between the first block height of the block to be generated and the second block height of the block where the first closed channel transaction is located is not larger than the first value: if yes, executing the first submission proof transaction through the first contract, and recording the second transfer proof to a block chain; wherein the second proof of transfer comprises the first down-link transaction having the largest transaction amount, the first proof of transfer transaction generated by the first client in response to the second user submitting a second proof of transfer;
obtaining an execution result of the first submission proof transaction from a blockchain to generate first submission proof notification information, and pushing the first submission proof notification information to the first client and the second client respectively;
receiving a first clearing transaction of clearing the first channel sent by the first client or the second client, forwarding the first clearing transaction to the blockchain node, so that the blockchain node executes the first clearing transaction through the first contract, and clearing assets specified by the first clearing transaction of the first user and the second user in the first channel;
and acquiring an execution result of the first clearing transaction from a blockchain to generate first clearing notification information, and respectively pushing the first clearing notification information to the first client and the second client.
11. The method of claim 9 or 10, wherein a sub-channel is configured in the first channel in units of asset type, and wherein the deposit transaction, the first down-link transaction, the second down-link transaction, the first close channel transaction, the first proof-of-submission transaction, and the first clearing transaction are each configured with asset type parameters, the asset type being used to specify the sub-channel.
12. A transaction method applicable to a blockchain node, each user respectively registering a transaction push service with a server, a first contract configured with a first value, the method comprising:
receiving a first channel creation transaction forwarded by a server, executing the first channel creation transaction through a first contract to create a first channel of a first user and a second user, so that the server generates first creation channel notification information after acquiring an execution result of the first channel creation transaction and respectively pushes the first creation channel notification information to a first client of the first user and a second client of the second user; wherein the first channel creation transaction is generated by the first client or the second client and sent to the server;
receiving the deposit transaction forwarded by the server, executing the deposit transaction through a first contract to transfer a plurality of assets specified by the deposit transaction to the first channel, so that the server can obtain the execution result of the deposit transaction to generate deposit notification information and respectively push the deposit notification information to the first client or the second client; wherein the deposit transaction is generated by the first client in response to the first user depositing within the first channel, or the second client in response to the second user depositing within the first channel and sent to the server;
receiving a first closed channel transaction which is forwarded by a server and comprises a first transfer certificate, executing the first closed channel transaction through the first contract, recording the first transfer certificate on a block chain, and closing the first channel, so that the server acquires an execution result of the first closed channel transaction from the block chain to generate first closed channel notification information and respectively pushes the first closed channel notification information to the first client and the second client; the first transfer certification comprises a second down-link transaction with the largest transaction amount, the second down-link transaction is generated by the second client in response to the second user transferring accounts to the first user in the first channel and is sent to the server, the transaction amount of the second down-link transaction is the sum of the transaction amount of the previous second down-link transaction and the transaction amount to be transferred, and the first closed-channel transaction is sent to the server by the first client;
receiving a first submission certification transaction which is forwarded by the server and comprises a second transfer certification, and judging whether the difference between the height of a first block of a block to be generated and the height of a second block of the block where the first closed channel transaction is located is not larger than the first numerical value: if so, executing the first submission certification transaction through the first contract, and recording the second transfer certification on a blockchain, so that the server acquires an execution result of the first submission certification transaction from the blockchain to generate first submission certification notification information and respectively pushes the first submission certification notification information to the first client and the second client; wherein the first proof of submission transaction is generated by the first client in response to the second user submitting a second proof of transfer, the second proof of transfer including a first down-link transaction with a maximum transaction amount, the first down-link transaction being sent by the first client to the server in response to the first user transferring the account to the second user in the first channel, the transaction amount of the first down-link transaction being the sum of the transaction amount of the previous first down-link transaction and the transaction amount to be transferred, the first proof of submission transaction being sent by the second client to the server;
receiving a first clearing transaction of clearing the first channel forwarded by a server, executing the first clearing transaction through the first contract, clearing assets specified by the first clearing transaction of the first user and the second user in the first channel, so that the server obtains an execution result of the first clearing transaction from a blockchain to generate first clearing notification information and pushes the first clearing notification information to the first client and the second client respectively; wherein the first clearing transaction is sent by the first client or the second client to the server.
13. The method of claim 12, wherein a sub-channel is configured within the first channel in units of an asset type, and wherein the deposit transaction, the first down-link transaction, the second down-link transaction, the first closed channel transaction, the first proof-of-submission transaction, and the first clearing transaction are each configured with asset type parameters, the asset type specifying a sub-channel.
14. An apparatus, characterized in that the apparatus comprises:
one or more processors;
a memory for storing one or more programs,
the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method recited in any of claims 1-13.
15. A storage medium storing a computer program, characterized in that the program, when executed by a processor, implements the method according to any one of claims 1-13.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010099007.9A CN111325625A (en) | 2020-02-18 | 2020-02-18 | Transaction method, device and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010099007.9A CN111325625A (en) | 2020-02-18 | 2020-02-18 | Transaction method, device and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111325625A true CN111325625A (en) | 2020-06-23 |
Family
ID=71172802
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010099007.9A Pending CN111325625A (en) | 2020-02-18 | 2020-02-18 | Transaction method, device and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111325625A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112132583A (en) * | 2020-08-14 | 2020-12-25 | 中信银行股份有限公司 | Transaction processing method and device of block chain, electronic equipment and readable storage medium |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103873558A (en) * | 2014-01-15 | 2014-06-18 | 北京奇虎科技有限公司 | Processing method and system for business object based on third-party platforms |
WO2019035573A1 (en) * | 2017-08-16 | 2019-02-21 | 김용태 | Blockchain-based trading system and method therefor |
CN110443609A (en) * | 2019-07-04 | 2019-11-12 | 杭州复杂美科技有限公司 | Multi-signature method of commerce, equipment and storage medium |
CN110494877A (en) * | 2017-02-06 | 2019-11-22 | 北方信托公司 | For issuing the system and method with track digital token in distributed network node |
CN110796549A (en) * | 2019-11-06 | 2020-02-14 | 杭州复杂美科技有限公司 | Transaction method, apparatus and storage medium |
-
2020
- 2020-02-18 CN CN202010099007.9A patent/CN111325625A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103873558A (en) * | 2014-01-15 | 2014-06-18 | 北京奇虎科技有限公司 | Processing method and system for business object based on third-party platforms |
CN110494877A (en) * | 2017-02-06 | 2019-11-22 | 北方信托公司 | For issuing the system and method with track digital token in distributed network node |
WO2019035573A1 (en) * | 2017-08-16 | 2019-02-21 | 김용태 | Blockchain-based trading system and method therefor |
CN110443609A (en) * | 2019-07-04 | 2019-11-12 | 杭州复杂美科技有限公司 | Multi-signature method of commerce, equipment and storage medium |
CN110796549A (en) * | 2019-11-06 | 2020-02-14 | 杭州复杂美科技有限公司 | Transaction method, apparatus and storage medium |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112132583A (en) * | 2020-08-14 | 2020-12-25 | 中信银行股份有限公司 | Transaction processing method and device of block chain, electronic equipment and readable storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110796549B (en) | Transaction method, apparatus and storage medium | |
KR102254809B1 (en) | Distributed computing resources sharing system and computing apparatus thereof providing reward based on block chain | |
CN110474940B (en) | Request scheduling method, device, electronic equipment and medium | |
CN109859043B (en) | Transaction clearing method and transaction clearing system | |
CN110083745B (en) | Data query method, device and storage medium | |
CN109104368B (en) | Connection request method, device, server and computer readable storage medium | |
CN109005208B (en) | Method and device for pushing information | |
CN109739601A (en) | A kind of popularization resource exhibition method | |
CN109529357A (en) | Troop's data processing method and device | |
CN109739684A (en) | The copy restorative procedure and device of distributed key value database based on vector clock | |
CN111325625A (en) | Transaction method, device and storage medium | |
CN110062044A (en) | Distributed application program downloads verification method, equipment and storage medium | |
CN110852748A (en) | Group transaction method, device and storage medium | |
CN110351362A (en) | Data verification method, equipment and computer readable storage medium | |
CN111310242B (en) | Method and device for generating device fingerprint, storage medium and electronic device | |
CN115834600B (en) | Multi-cloud nanotube data synchronization method and device, electronic equipment and storage medium | |
CN110516006B (en) | Parallel chain block generation method, device and storage medium | |
CN110557661A (en) | Method, device, equipment and medium for determining delivery grade | |
CN109389271B (en) | Application performance management method and system | |
CN109417566B (en) | Constraint-based controlled seed propagation | |
CN110795288B (en) | Data acquisition method, device and storage medium | |
US12002043B2 (en) | Method for enabling efficient evaluation of transactions in a distributed ledger network | |
CN112819625A (en) | Parallel chain arbitration consensus method, computer device and storage medium | |
CN111383057A (en) | Advertisement putting method, device and storage medium | |
CN111524011A (en) | Parallel chain consensus confirming method, equipment and 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 | ||
WD01 | Invention patent application deemed withdrawn after publication | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20200623 |