CN111126988A - Block chain-based transfer method, device, equipment and computer medium - Google Patents

Block chain-based transfer method, device, equipment and computer medium Download PDF

Info

Publication number
CN111126988A
CN111126988A CN201911350651.2A CN201911350651A CN111126988A CN 111126988 A CN111126988 A CN 111126988A CN 201911350651 A CN201911350651 A CN 201911350651A CN 111126988 A CN111126988 A CN 111126988A
Authority
CN
China
Prior art keywords
transfer
node
account
core
payment channel
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
Application number
CN201911350651.2A
Other languages
Chinese (zh)
Inventor
何硕彦
周禄
张开翔
范瑞彬
刘明臻
黎宁
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
WeBank Co Ltd
Original Assignee
WeBank Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by WeBank Co Ltd filed Critical WeBank Co Ltd
Priority to CN201911350651.2A priority Critical patent/CN111126988A/en
Publication of CN111126988A publication Critical patent/CN111126988A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06QDATA PROCESSING SYSTEMS OR METHODS, SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL, SUPERVISORY OR FORECASTING PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL, SUPERVISORY OR FORECASTING PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/08Payment architectures
    • G06Q20/10Payment architectures specially adapted for electronic funds transfer [EFT] systems; specially adapted for home banking systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06QDATA PROCESSING SYSTEMS OR METHODS, SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL, SUPERVISORY OR FORECASTING PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL, SUPERVISORY OR FORECASTING PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3821Electronic credentials
    • G06Q20/38215Use of certificates or encrypted proofs of transaction rights
    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06QDATA PROCESSING SYSTEMS OR METHODS, SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL, SUPERVISORY OR FORECASTING PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL, SUPERVISORY OR FORECASTING PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/40Authorisation, e.g. identification of payer or payee, verification of customer or shop credentials; Review and approval of payers, e.g. check credit lines or negative lists
    • G06Q20/403Solvency checks

Abstract

The invention relates to the technical field of financial technology (Fintech), and discloses a block chain-based transfer method, which comprises the following steps: when a transfer request is received, acquiring a transfer-out account and a transfer-in account in the transfer request; acquiring an initial node connected with the transferred-out account and acquiring a target node connected with the transferred-in account; traversing the node list to obtain a first core node connected with the starting node and a second core node connected with the destination node; establishing connection among the roll-out account, the initiating node, the first core node, the second core node, the destination node and the roll-in account, and generating a payment channel transfer path; and performing transfer operation along the payment channel transfer path. The invention also discloses a transfer device, equipment and a computer medium based on the block chain. The invention improves the efficiency of multi-channel transfer and reduces the risk of transfer.

Description

Block chain-based transfer method, device, equipment and computer medium
Technical Field
The invention relates to the technical field of financial technology (Fintech), in particular to a block chain-based transfer method, device, equipment and computer medium.
Background
With the development of computer technology, more and more technologies are applied in the financial field, and the traditional financial industry is gradually changing to financial technology (Fintech), but due to the requirements of the financial industry on safety and real-time performance, higher requirements are also put forward on the technologies.
The current link down-link accounting technology of the block chain mainly comprises a bitcoin lightning network and an Ethernet lightning network. The main idea is to establish a payment channel, open the payment channel to process a batch of transactions, record and verify real transaction data under a chain by using mechanisms of some encryption algorithms, and finally send the transaction data into a block chain to perform actual transaction settlement and verification when the payment channel is closed; if the transfer-out account is not directly connected with the transfer-in account in the transfer mode, a payment channel path needs to be established, for example, when Alice wants to transfer money to David, but no payment channel exists between Alice and Bob, if a payment channel exists between Alice and Bob, a payment channel exists between Carol and David, Alice can borrow a plurality of channels between Bob corresponding nodes and Carol corresponding nodes to form a payment channel path to transfer assets to David, and if the payment channel path has node offline, the payment channel path cannot be smoothly established, so that the problem of transfer delay is caused; if the multiple payment channel paths are successfully established, nodes are offline in the payment process, and transfer risks also exist; and such multiple channels form a payment channel path to perform a transfer mode, and when the path formed by the multiple channels is not unique, the path selected by an account is not appropriate, so that a large number of transfer commission fees are paid.
Disclosure of Invention
The invention mainly aims to provide a transfer method, a transfer device, transfer equipment and a computer medium based on a block chain, and aims to solve the technical problems that transfer delay is easy to occur in the current multi-channel transfer, transfer risks exist, and a lot of transfer commission fees are paid due to the fact that a payment channel of the multi-channel transfer is not clear.
In order to achieve the above object, the present invention provides a block chain based transfer method, which comprises the following steps:
when a transfer request is received, acquiring a transfer-out account and a transfer-in account in the transfer request;
acquiring an initial node connected with the transferred-out account and acquiring a target node connected with the transferred-in account;
traversing the node list to obtain a first core node connected with the starting node and a second core node connected with the destination node;
establishing connection among the roll-out account, the initiating node, the first core node, the second core node, the destination node and the roll-in account, and generating a payment channel transfer path;
and performing transfer operation along the payment channel transfer path.
In an embodiment, when a transfer request is received, before the step of acquiring an account transfer-out and an account transfer-in of the transfer request, the method includes:
when a request for establishing a payment channel network structure is received, selecting a preset number of nodes from a alliance chain as core nodes, and mutually associating the core nodes to form a main payment channel;
averagely distributing nodes except the core node in the alliance chain to the core node to serve as child nodes of the core node, and establishing connection between the core node and the child nodes corresponding to the core node to form a secondary payment channel;
and forming key value pairs by the address information of the core node and the address information of the child nodes corresponding to the core node, storing the key value pairs to a node list of the core node, and completing the establishment of a payment channel network structure.
In an embodiment, the step of selecting a preset number of nodes from a federation chain as core nodes and associating the core nodes with each other to form a main payment channel when receiving a request for establishing a payment channel network structure includes:
when a request for establishing a payment channel network structure is received, selecting an initiating node from a alliance chain, and acquiring asset information of each initiating node;
arranging the initiating nodes according to the level of the pledge amount in the asset information, acquiring a preset number of initiating nodes in the top sequence as core nodes, and mutually associating the core nodes to form a main payment channel.
In an embodiment, after the step of forming key-value pairs by using the address information of the core node and the address information of the child nodes corresponding to the core node, storing the key-value pairs in a node list of the core node, and completing establishment of a network structure of a payment channel includes:
when detecting that the node exits the alliance chain, acquiring a node address of the exiting node;
writing the node address of the exit node into a cancel channel function, obtaining a core node associated with the exit node and a node list of the core node, and deleting the node address of the exit node in the node list.
In an embodiment, the step of acquiring the destination node connected to the transfer-out account includes:
acquiring an initial node connected with the transferred account, and sending a query request containing the transferred account identifier to a alliance chain;
receiving feedback information according to the query request, and taking a node which sends the feedback information in the alliance chain as a target node connected with the transferred account;
and if the feedback information according to the query request is not received, sending the query request to a server to obtain the destination node which is fed back by the server and is connected with the transferred account.
In one embodiment, the step of performing a transfer operation along the payment channel transfer path includes:
acquiring the transfer amount in the transfer request, acquiring the number of payment channels in the transfer path of the payment channel, and determining the procedure cost corresponding to the transfer path of the payment channel;
taking the transfer amount, the payment channel number and the commission charge as transmission messages, sending the transmission message signatures to the initial node, processing the transmission messages through the initial node and then forwarding the transmission messages to a first core node, processing the transmission messages through the first core node and then forwarding the transmission messages to a second core node, processing the transmission messages through the second core node and then forwarding the transmission messages to a destination node, processing the transmission messages through the destination node and then forwarding the transmission messages to a transfer-in account;
and receiving a decryption request fed back by the transferred account, decrypting the transmission message to enable the transferred account to obtain the transfer amount, and finishing the transfer operation.
In an embodiment, after the step of establishing a connection between the roll-out account, the initiating node, the first core node, the second core node, the destination node, and the roll-in account and generating a payment channel transfer path, the method includes:
obtaining the transfer amount in the transfer request, and obtaining the pledge amount of the starting node, the first core node, the second core node and the destination node in the transfer path of the payment channel;
comparing the transfer amount with each pledge amount, and judging whether the pledge amount smaller than the transfer amount exists;
if the pledge amount smaller than the transfer amount exists, outputting prompt information;
and if the pledge amount smaller than the transfer amount does not exist, executing the step of executing the transfer operation along the transfer path of the payment channel.
In addition, to achieve the above object, the present invention also provides a block chain based transfer apparatus, including:
the transfer request receiving module is used for acquiring a transfer-out account and a transfer-in account in the transfer request when the transfer request is received;
the first acquisition module is used for acquiring an initial node connected with the transferred-out account and acquiring a target node connected with the transferred-in account;
a second obtaining module, configured to traverse a node list, and obtain a first core node connected to the initiating node and a second core node connected to the destination node;
the path establishing module is used for establishing the connection among the roll-out account, the initiating node, the first core node, the second core node, the destination node and the roll-in account and generating a payment channel transfer path;
and the transfer module is used for executing transfer operation along the transfer path of the payment channel.
In addition, to achieve the above object, the present invention also provides a block chain-based transfer apparatus, including: a memory, a processor and a blockchain based transfer program stored on the memory and executable on the processor, the blockchain based transfer program when executed by the processor implementing the steps of the blockchain based transfer method as described above.
In addition, to achieve the above object, the present invention also provides a computer readable storage medium having stored thereon a block chain based transfer program, which when executed by a processor, implements the steps of the block chain based transfer method as described above.
The invention provides a block chain-based transfer method, a block chain-based transfer device, block chain-based transfer equipment and a computer medium. In the embodiment of the invention, when a transfer request is received, a transfer-out account and a transfer-in account in the transfer request are obtained; acquiring an initial node connected with the transferred-out account and acquiring a target node connected with the transferred-in account; traversing the node list to obtain a first core node connected with the starting node and a second core node connected with the destination node; establishing connection among the roll-out account, the initiating node, the first core node, the second core node, the destination node and the roll-in account, and generating a payment channel transfer path; performing a transfer operation along the payment channel transfer path; in the embodiment, a node list is preset, and after a transfer request is received and the node list is inquired to determine the nodes through which transfer passes, a transfer path of a payment channel is constructed to ensure that the nodes in the transfer path of the payment channel are online all the time, so that the delay of transfer is effectively avoided, the efficiency of multi-channel transfer is improved, and the risk of transfer is also reduced because the nodes are online all the time; meanwhile, the transfer path of the payment channel formed according to the node list is shortest, and the procedure cost of transfer operation is reduced.
Drawings
FIG. 1 is a schematic diagram of an apparatus architecture of a hardware operating environment according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart of establishment of a payment channel network structure in a first embodiment of a block chain-based transfer method according to the present invention;
FIG. 3 is a diagram illustrating a specific operation scenario in a first embodiment of a block chain-based transfer method according to the present invention;
FIG. 4 is a flowchart illustrating a first embodiment of a blockchain-based transfer method according to the present invention;
FIG. 5 is a functional block diagram of an embodiment of a blockchain-based transfer device according to the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
As shown in fig. 1, fig. 1 is a schematic device structure diagram of a hardware operating environment according to an embodiment of the present invention.
The transfer device based on the block chain in the embodiment of the invention can be a PC.
As shown in fig. 1, the block chain-based transfer apparatus may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, a communication bus 1002. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory (e.g., a magnetic disk memory). The memory 1005 may alternatively be a storage device separate from the processor 1001.
Those skilled in the art will appreciate that the configuration of the apparatus shown in fig. 1 is not intended to be limiting of the apparatus and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
As shown in fig. 1, a memory 1005, which is a kind of computer storage medium, may include therein an operating system, a network communication module, a user interface module, and a block chain-based transfer program.
In the device shown in fig. 1, the network interface 1004 is mainly used for connecting to a backend server and performing data communication with the backend server; the user interface 1003 is mainly used for connecting a client (user side) and performing data communication with the client; the processor 1001 may be configured to call the block chain based transfer program stored in the memory 1005, and execute the following operations in the block chain based transfer method, where the method implemented when the block chain based transfer program executed on the processor is executed may refer to each embodiment of the block chain based transfer method in the present invention, and details are not described here.
The current link down-link accounting technology of the block chain mainly comprises a bitcoin lightning network and an Ethernet lightning network. The main idea is to establish a payment Channel, open the payment Channel (Channel) to process a batch of transactions, record and verify the real transaction data under the chain by some encryption algorithm mechanism, and finally send the transaction data into the block chain for actual transaction settlement and verification when closing the Channel. Therefore, the number of transactions in the block chain is reduced, and the purpose of reducing transaction fee and accelerating transaction speed is achieved.
The operation steps are as follows:
the first step is as follows: an intelligent contract is deployed at an ethernet bay, with a contract deployed for an on-chain asset.
The second step is that: both parties to the channel send a certain amount of tokens to the contract address to lock and build a fund pool, until which time the channel is established.
The third step: after the channel is established, all transactions between the two parties can be performed under the chain.
The fourth step: each double-signed transfer between a and B in the chain has a sequence number, e.g. 1 for the first time and 2 for the second time, and if the path is to be terminated (if a originates), a can send the latest, i.e. the largest, information to the smart contract, while providing a lock time. If B provides an updated message before the locking time expires, it shows that the cheating contract will all lock the assets to B to punish A, if the other party does not disagree at the time of expiration, the contract calculates the final balance of the two parties according to the net increment and decrement of the last message and sends them back, the above is the single channel transfer principle of the lightning network.
The prior lightning multi-channel transfer is mainly realized by a Hash time lock technology, and the scheme is as follows: when Alice wants to transfer money to David, but there is no payment channel between the two, if Alice has a payment channel before Bob, Carol has a payment channel before Bob, and Carol has a payment channel with David. Alice can then borrow the channels between these nodes (Bob, Carol) to transfer the asset to David. The transaction on this channel will be locked using a hashed time lock until David confirms that payment has been received on the channel, and will be unlocked following Alice unlocking the hashed lock key with a decryption request (SecretRequest) before the entire transfer is completed.
Finally, each sender will send the Balance Proof to the next receiver. The final state is that everyone on the channel will have prior Proof of Balance, e.g., Bob has Balance Proof signed by Alice and Carol has Balance Proof signed by Bob, which can be used when closing a pass.
The lightning network is a more convenient solution to single-channel account transfer, but the multi-channel use still has many problems, and also influences the application of the multi-channel transfer, and the main problems of the multi-channel technology of the lightning network are as follows:
the first is the off-line problem: in the process of multi-channel transfer, if nodes in a payment channel are offline, a multi-channel path cannot be smoothly built, and in the processes of closing the channel and relaying transfer, the nodes of the payment channel are offline, so that the risk of token loss is caused.
Secondly, the path searching problem: in multi-channel transfer, it is difficult to achieve a global view for a decentralized network so as to find a corresponding multi-channel transfer path, and how to select an optimal path to reduce transfer commission is also a current problem, and meanwhile, it is also a difficult point for designing that each payment channel node in multiple channels has enough will to mortgage assets and maintain a payment channel network.
The embodiment of the invention designs a simple and effective multi-channel transfer scheme with low handling charge and no node disconnection in a scene of an alliance chain and a multi-channel transfer scene under the chain. Because the number of points of the alliance chain links is limited, each node is assigned with a payment channel management role and is kept in an always-on state like the blockchain nodes. Aiming at the problem of searching a multi-channel path, a payment channel network structure is built into a payment channel network structure, a multi-channel path intelligent contract is designed, and the registration and discovery of a route are realized through the path intelligent contract, so that a user can conveniently select the path, specifically:
based on the hardware structure, the invention provides the embodiment of the transfer method based on the block chain.
The first embodiment of the transfer method based on the block chain comprises the following steps:
when a transfer request is received, acquiring a transfer-out account and a transfer-in account in the transfer request;
acquiring an initial node connected with the transferred-out account and acquiring a target node connected with the transferred-in account;
traversing the node list to obtain a first core node connected with the starting node and a second core node connected with the destination node;
establishing connection among the roll-out account, the initiating node, the first core node, the second core node, the destination node and the roll-in account, and generating a payment channel transfer path;
and performing transfer operation along the payment channel transfer path.
The transfer method in this embodiment is applied to transfer equipment, and before the step in the first embodiment of this embodiment, the transfer equipment establishes a payment channel network structure in advance (or the transfer equipment accesses the payment channel network structure established in advance), where the payment channel network structure refers to a network in which nodes in a federation chain are connected, and a payment channel path may be determined according to the payment channel network structure during transfer operation.
Referring to fig. 2, the step of establishing the payment channel network structure of the transfer device is specifically described in this embodiment, and includes:
step S01, when receiving the request for establishing the network structure of the payment channel, selecting a preset number of nodes from the federation chain as core nodes, and associating the core nodes with each other to form a main payment channel.
The transfer equipment receives a payment channel network structure establishment request, selects nodes with a preset number (the preset number is set according to the number of nodes in an alliance chain, in the embodiment, the preset number is 3, the payment channel network structure with the preset number of 3 can be a triangular networking structure, so that a payment channel path is at most five hops, and the consumption of transfer handling fees is reduced) from the alliance chain as core nodes, and the transfer equipment associates the core nodes with one another to form a main payment channel.
For example, referring to fig. 3, the transfer device selects three blockchain nodes from an alliance chain as main payment channel core nodes, the three blockchain nodes must be initiating nodes of the alliance chain, the initiating nodes of the alliance chain cannot easily exit from a blockchain network, the nodes are guaranteed to be online all the time, transfer delay and transfer risks caused by node offline are avoided, then, the transfer device sends an initialization method for easily calling a path intelligent contract on the chain, an array with the length of 3 is used in the initialization method for storing addresses of the three core nodes, and the transfer device associates the core nodes with one another to form a main payment channel.
Specifically, step S01 includes:
step a1, when a request for establishing a payment channel network structure is received, selecting an initiating node from a alliance chain, and acquiring asset information of each initiating node;
step a2, arranging the initiating nodes according to the level of the pledge amount in the asset information, acquiring a preset number of initiating nodes in the top sequence as core nodes, and mutually associating the core nodes to form a main payment channel.
When receiving a payment channel network structure establishment request, the transfer equipment selects an initiating node from a alliance chain and acquires asset information of each initiating node; the transfer equipment arranges the initiating nodes according to the height of the pledge amount in the asset information, the transfer equipment acquires the initiating nodes with the preset number which are arranged in the front as core nodes, and the transfer equipment mutually associates the core nodes to form a main payment channel.
In this embodiment, the transfer device selects an originating node with a higher pledge amount from the federation chain as a core node, so as to further ensure the security of the transfer. It will be appreciated that the transfer device may set the core node's pledge amount to 3 times that of other regular nodes.
Step S02, evenly distributing the nodes in the federation chain except the core node to the core node as child nodes of the core node, and establishing a connection between the core node and the child nodes corresponding to the core node to form a secondary payment channel.
The transfer equipment evenly distributes nodes except the core node in the alliance chain to the core node as child nodes of the core node, the transfer equipment establishes connection between the core node and the child nodes corresponding to the core node to form a secondary payment channel, namely, the transfer equipment sequentially selects the rest nodes in the alliance chain and the core node to set a payment channel path. The principle of setting the payment channel path between the rest nodes and the core node in the alliance chain is as follows: (1) the nodes under the same mechanism are bound under the same core node as much as possible; (2) the balance of the number of the binding nodes of the three core nodes is ensured as much as possible; (3) and selecting a nearby node according to the network condition.
And step S03, forming key value pairs by the address information of the core node and the address information of the child nodes corresponding to the core node, storing the key value pairs to a node list of the core node, and completing the establishment of a payment channel network structure.
The transfer equipment combines the address information of the core node and the address information of the child node corresponding to the core node into a key value pair, the transfer equipment stores the key value pair to a node list of the core node, namely, the transfer equipment presets a path intelligent contract, the transfer equipment associates the child node with the core node to be bound through a set channel function of the preset path intelligent contract, the set channel function finds out the node list of the core node through mapping < address [ ], then, the transfer equipment associates the key as the address information of the core node and the value as the address information of the child node establishing a payment channel with the core node to form the key value pair, ensures the key value pair to the node list of the core node, and completes the establishment of a payment channel network structure.
In this embodiment, the transfer apparatus allocates a user role front (a public and private key pair) for managing the payment channel to each node, and if the channel management user of the node 0 is front0, the payment channel node is bound with the block chain node, so that the situations that the payment channel node is offline to cause fund loss and the channel is unavailable do not exist, and the payment operation is more flexible and convenient.
In addition, in this embodiment, the payment tunnel network structure may be updated according to a service scenario, for example, a new node is added, or a node exits, specifically:
when detecting that the node exits the alliance chain, acquiring a node address of the exiting node;
writing the node address of the exit node into a cancel channel function, obtaining a core node associated with the exit node and a node list of the core node, and deleting the node address of the exit node in the node list.
Namely, when the transfer equipment detects that the node exits from the alliance chain, the transfer equipment acquires the node address of the exit node; the transfer equipment writes the node address of the exit node into a cancel channel function, the cancel channel function finds the core node associated with the exit node and the node list of the core node through mapping < address, address [ ] >, and then deletes the node address of the exit node in the node list. In the embodiment, the common nodes in the payment channel network structure can be deleted flexibly, so that the payment channel network structure is flexible.
Referring to fig. 4, fig. 4 is a schematic flow chart of a first embodiment of a block chain-based transfer method according to the present invention, where the block chain-based transfer method includes:
and step S10, when receiving the transfer request, acquiring the transfer-out account and the transfer-in account in the transfer request.
The transfer device receives a transfer request, the triggering mode of the transfer request is not specifically limited, namely, the transfer request can be actively triggered by a user, the transfer device can also be automatically triggered, when the transfer device receives the transfer request, the transfer device acquires a roll-out account and a roll-in account in the transfer request, the transfer device judges whether the roll-out account and the roll-in account are directly connected, if the roll-out account and the roll-in account are directly connected, the transfer device directly executes transfer operation, if the roll-out account and the roll-in account are not directly connected, the transfer device performs transfer operation according to an established payment channel network structure, specifically:
and step S20, acquiring the starting node connected with the transferred account and acquiring the target node connected with the transferred account.
The transfer device obtains the initial node connected with the transfer account, namely, a structure going to the center in the process of an alliance chain, the transfer device can directly determine the initial node connected with the transfer account according to the source of a transfer request, but can not directly obtain the destination node connected with the transfer account, therefore, the transfer device needs to be inquired and determined, and the method specifically comprises the following steps:
step b1, acquiring the starting node connected with the transferred account, and sending the query request containing the account identification of the transferred account to a alliance chain;
step b2, receiving feedback information according to the query request, and taking the node in the alliance chain which sends the feedback information as the destination node connected with the transferred account;
step b3, if feedback information according to the query request is not received, sending the query request to a server, and acquiring the destination node which is fed back by the server and is connected with the transferred account.
Namely, the transfer equipment acquires an initial node connected with a transfer-out account, and sends a query request containing a transfer-in account identifier to an alliance chain; and the transfer equipment receives feedback information of the nodes in the alliance chain according to the query request, and the transfer equipment takes the nodes sending the feedback information in the alliance chain as destination nodes connected with the transferred account.
And if the transfer equipment does not receive the feedback information of the query request, namely the league chain does not actively feed back the destination node corresponding to the transferred account, the transfer equipment sends the query request to the server so that the server sends the destination node connected with the transferred account to the transfer equipment according to the query request.
In this embodiment, each node in the payment channel network structure needs to upload its own information to a central server at regular time. Therefore, the user can conveniently inquire the information of each node in the payment channel network structure through the transfer equipment, so that the user can comprehensively think about the network topology of the whole payment channel network structure.
Step S30, traverse the node list, and obtain the first core node connected to the starting node and the second core node connected to the destination node.
The transfer device traverses the node list of each core node in the payment channel network structure, and the transfer device acquires a first core node connected with the starting node and a second core node connected with the destination node so as to establish a payment channel path.
Step S40, establishing the connection among the transfer-out account, the initiating node, the first core node, the second core node, the destination node and the transfer-in account, and generating a payment channel transfer path.
The transfer equipment establishes connection among the roll-out account, the starting node, the first core node, the second core node, the destination node and the roll-in account, and generates a transfer path of a payment channel so that the transfer equipment can transfer money along the transfer path of the payment channel.
And step S50, executing transfer operation along the payment channel transfer path.
And the transfer equipment performs message transmission along each node in the transfer path of the payment channel and performs transfer operation, specifically, referring to fig. 3, currently, Alice wants to transfer n AAA assets to Bob, but Alice and Bob do not establish a corresponding payment channel. The method comprises the following steps that an initial node 3 of an organization where Alice is located and a destination node 7 of an organization where Bob is located are called by Alice, namely, the routing search function searches address information of the initial node 3 and address information of the destination node 7, the account transfer equipment obtains a payment channel path from the initial node 3 to the destination node 7, and the main logic of the routing search function is as follows:
the transfer equipment traverses a payment channel node list of the core node according to input payment channel node address information, finds a first core node 0 establishing a payment channel with an initial node 3 according to the address information of the initial node 3, similarly finds a second core node 2 establishing a payment channel with a target node 7 according to the address information of the target node 7, and returns a payment channel path: alice-the initiating node 3-the first core node 0-the second core node 2-the destination node 7-Bob.
It can be understood that Alice acquires a payment channel path of Alice, the initial node 03, the first core node 0, the second core node 2, the destination node 7 and the Bob through a routing lookup function, then Alice queries the pledge balance of each node in the channel through a transfer type device, evaluates whether the transfer can be successful, and executes the transfer operation after evaluating that the transfer can be successful.
The difference between the payment channel network structure and the blockchain network networking architecture in this embodiment is that the payment channel network structure in this embodiment is designed as a triangular networking architecture, which is composed of three core nodes (refer to fig. 3, node 0, node 1, and node 2), and the other blockchain nodes can select which of the three master nodes to establish a status channel according to the network condition. The structure of the triangular networking in the embodiment can realize the shortest path of the transfer, and ensures that the maximum five hops can reach the node, because the shorter the path is, the less the handling fee is.
In the embodiment, a node list is preset, and after a transfer request is received and the node list is inquired to determine the nodes through which transfer passes, a transfer path of a payment channel is constructed to ensure that the nodes in the transfer path of the payment channel are online all the time, so that the delay of transfer is effectively avoided, the efficiency of multi-channel transfer is improved, and the risk of transfer is also reduced because the nodes are online all the time; meanwhile, the transfer path of the payment channel formed according to the node list is shortest, and the procedure cost of transfer operation is reduced.
Further, on the basis of the above embodiment of the block chain based transfer method of the present invention, a second embodiment of the block chain based transfer method of the present invention is provided.
This embodiment is a refinement of step S50 in the first embodiment of the present invention, and the present embodiment is different from the above-described embodiments in that:
acquiring the transfer amount in the transfer request, acquiring the number of payment channels in the transfer path of the payment channel, and determining the procedure cost corresponding to the transfer path of the payment channel;
taking the transfer amount, the payment channel number and the commission charge as transmission messages, sending the transmission message signatures to the initial node, processing the transmission messages through the initial node and then forwarding the transmission messages to a first core node, processing the transmission messages through the first core node and then forwarding the transmission messages to a second core node, processing the transmission messages through the second core node and then forwarding the transmission messages to a destination node, processing the transmission messages through the destination node and then forwarding the transmission messages to a transfer-in account;
and receiving a decryption request fed back by the transferred account, decrypting the transmission message to enable the transferred account to obtain the transfer amount, and finishing the transfer operation.
The transfer device creates a new transfer transmission message according to the transfer request, and the change rule of the locked transfer message is as follows: transferred _ amount (amount transferred): the method comprises the steps of keeping unchanged, wherein Lock is Lock (n, hash) and expiry), Lock is a hash time Lock, n is a transfer amount, secret is a hash value, and expiry is timeout; the transfer device sets a locking amount, the locking amount locked _ amount is locked _ amount + n + n step/1000.0, step is the number of the residual channels in the transfer path of the payment channel, and locksroot is merkelroot of the new lock; the serial number nonce of each transfer is nonce + 1.
I.e. Alice signs the transaction (locked transfer message) and sends it to the initiating node 3. Note that the lock amount requires a commission on the belt (the commission is forwarded over five channels, one thousandth per channel, in the transfer path according to the payment channel). Similarly, the initiating node 3 assembles and signs a locked transfer message according to the rule, and then sends the signed transfer message to the first checking node 0; the first core node 0 assembles and signs a Lockedtransfer message according to the rule, and then sends the message to the second core node 2; the second core node 2 assembles and signs a locked transfer message according to the rule, and then sends the signed transfer message to the destination node 7; the destination node assembles and signs a locked transfer message according to the above rules, and then sends to Bob.
After receiving the signature, Bob sends a SecretRequest message to Alice to request a HashLock password; and after confirming that all the relay nodes in the channel complete the hash time locking, the Alice sends a secret disclosure message to Bob. After Bob has obtained the secret, Bob sends a message to the destination node 7 to reveal the secret, informing him that the secret information is known.
And the destination node 7 checks whether the secret is the password of the Hash time lock, and if the check is successful, the destination node sends unlocking information to Bob, updates the latest balance proof and launches to Bob. The lock will be removed from the pending lock list and the transferred _ amount, locked _ amount and locksroot values are updated.
The destination node 7 sends a message for revealing the secret to the second core node 2 of the previous hop, the second core node 2 checks whether the secret is the password of the hash time lock, and if the secret is successful, the latest balance proof is updated and sent to the destination node 7. The lock deletes the lock from the suspended lock list, and updates the transferred _ account, locked _ account and locksroot values; and so on for the first core node 0, the initiating node 3, Alice.
And finally, Alice updates the latest balance proof to send to front0, and updates transferred _ amount, locked _ amount and lockspot values, so that the multi-channel transfer is successfully finished. Because the payment channel node is bound with the block chain node, the payment channel node is always on line, and the condition that transfer cannot be carried out due to the fact that a certain node is suddenly off-line in the transfer process is avoided.
In the embodiment, the transfer equipment performs multi-channel transfer operation according to the transfer path of the payment channel, and the payment channel node is bound with the block chain node and is always on line, so that the condition that transfer cannot be performed due to the fact that a certain node is suddenly off-line in the transfer process is effectively avoided.
Further, on the basis of the above-mentioned embodiment of the block chain-based transfer method of the present invention, a third embodiment of the block chain-based transfer method of the present invention is proposed.
This embodiment is a step subsequent to step S40 in the first embodiment of the present invention, and is different from the above embodiments in that:
obtaining the transfer amount in the transfer request, and obtaining the pledge amount of the starting node, the first core node, the second core node and the destination node in the transfer path of the payment channel;
comparing the transfer amount with each pledge amount, and judging whether the pledge amount smaller than the transfer amount exists;
if the pledge amount smaller than the transfer amount exists, outputting prompt information;
and if the pledge amount smaller than the transfer amount does not exist, executing the step of executing the transfer operation along the transfer path of the payment channel.
Namely, the transfer equipment acquires the transfer amount in the transfer request, and the transfer equipment acquires the pledge amount of an initial node, a first core node, a second core node and a destination node in a transfer path of the payment channel; namely, each node in the payment channel network structure can automatically upload information such as the self-pledge amount of money locking amount to the server, and the account transfer equipment inquiry server acquires the pledge amount of each node.
The transfer equipment compares the transfer amount with each pledge amount and judges whether the pledge amount smaller than the transfer amount exists or not; if the pledge amount smaller than the transfer amount exists, the transfer equipment judges that the risk of the payment channel path is higher and does not have enough pledge amount, and the transfer equipment outputs prompt information; and if the pledge amount smaller than the transfer amount does not exist, executing the step of executing the transfer operation along the transfer path of the payment channel.
In this embodiment, after the payment channel transfer route is generated, risk assessment is performed according to the pledge amount of each payment channel in the payment channel transfer route, when the risk of the payment channel transfer route is high, prompt information is output to prompt the increase of the pledge amount, and when the risk of the payment channel transfer route is low, the payment operation is executed to improve the safety of the transfer operation.
Referring to fig. 5, an embodiment of the present invention further provides a block chain-based transfer apparatus, where the block chain-based transfer apparatus includes:
the system comprises a request receiving module 10, a transfer request receiving module and a transfer processing module, wherein the request receiving module is used for acquiring a transfer-out account and a transfer-in account in the transfer request when receiving the transfer request;
a first obtaining module 20, configured to obtain an initial node connected to the roll-out account, and obtain a destination node connected to the roll-in account;
a second obtaining module 30, configured to traverse the node list, and obtain a first core node connected to the initiating node and a second core node connected to the destination node;
a path establishing module 40, configured to establish connections between the roll-out account, the initiating node, the first core node, the second core node, the destination node, and the roll-in account, and generate a payment channel transfer path;
and a transfer module 50 for performing a transfer operation along the payment path.
In one embodiment, the block chain based transfer device includes:
the payment gateway comprises a first building module, a second building module and a payment gateway module, wherein the first building module is used for selecting a preset number of nodes from a alliance chain as core nodes when a payment gateway network structure building request is received, and mutually associating the core nodes to form a main payment gateway;
the second building module is used for evenly distributing the nodes except the core node in the alliance chain to the core node to serve as child nodes of the core node, and establishing connection between the core node and the child nodes corresponding to the core node to form a secondary payment channel;
and the data storage module is used for forming key value pairs by the address information of the core node and the address information of the child nodes corresponding to the core node, storing the key value pairs to a node list of the core node and finishing the establishment of a payment channel network structure.
In one embodiment, the first building block comprises:
the payment gateway comprises a node selection unit, a payment gateway network structure establishment unit and a payment gateway unit, wherein the node selection unit is used for selecting an initiating node from a alliance chain and acquiring asset information of each initiating node when receiving a payment gateway network structure establishment request;
and the obtaining association unit is used for arranging the initiating nodes according to the level of the pledge amount in the asset information, obtaining a preset number of initiating nodes in the top sequence as core nodes, and associating the core nodes with each other to form a main payment channel.
In one embodiment, the block chain based transfer device includes:
the detection acquisition module is used for acquiring the node address of the exit node when detecting that the node exits the alliance chain;
and the data deleting module is used for writing the node address of the exit node into a cancel channel function, obtaining a core node associated with the exit node and a node list of the core node, and deleting the node address of the exit node in the node list.
In an embodiment, the first obtaining module 20 includes:
the acquisition sending unit is used for acquiring an initial node connected with the transferred account and sending a query request containing the account identification of the transferred account to a alliance chain;
a first determining unit, configured to receive feedback information according to the query request, and use a node in the federation chain that sends the feedback information as a destination node connected to the transferred account;
and the second determining unit is used for sending the query request to a server and acquiring the destination node which is fed back by the server and is connected with the transferred account if the feedback information according to the query request is not received.
In one embodiment, the device module includes:
the acquisition unit is used for acquiring the transfer amount in the transfer request, acquiring the number of payment channels in the transfer path of the payment channel and determining the procedure cost corresponding to the transfer path of the payment channel;
the processing and forwarding unit is used for sending the transfer amount, the payment channel number and the commission charge as transmission messages, sending the transmission message signatures to the initial node, processing the transmission messages through the initial node and then forwarding the transmission messages to a first core node, processing the transmission messages through the first core node and then forwarding the transmission messages to a second core node, processing the transmission messages through the second core node and then forwarding the transmission messages to a target node, processing the transmission messages through the target node and then forwarding the transmission messages to a transfer account;
and the transfer execution module is used for receiving the decryption request fed back by the transferred account and decrypting the transmission message so as to enable the transferred account to acquire the transfer amount and finish the transfer operation.
In one embodiment, the block chain based transfer apparatus includes:
the amount obtaining unit is used for obtaining the transfer amount in the transfer request and obtaining the pledge amount of the starting node, the first core node, the second core node and the destination node in the transfer path of the payment channel;
the comparison and judgment unit is used for comparing the transfer amount with each pledge amount and judging whether the pledge amount smaller than the transfer amount exists or not;
the prompt output unit is used for outputting prompt information if the pledge amount smaller than the transfer amount exists;
and if the pledge amount smaller than the transfer amount does not exist, executing the step of executing the transfer operation along the transfer path of the payment channel.
The method executed by each program module may refer to each embodiment of the block chain-based transfer method of the present invention, and details are not described herein.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) as described above and includes instructions for enabling a server device (e.g., a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A transfer method based on a block chain is characterized by comprising the following steps:
when a transfer request is received, acquiring a transfer-out account and a transfer-in account in the transfer request;
acquiring an initial node connected with the transferred-out account and acquiring a target node connected with the transferred-in account;
traversing the node list to obtain a first core node connected with the starting node and a second core node connected with the destination node;
establishing connection among the roll-out account, the initiating node, the first core node, the second core node, the destination node and the roll-in account, and generating a payment channel transfer path;
and performing transfer operation along the payment channel transfer path.
2. A blockchain-based transfer method as recited in claim 1 wherein the step of obtaining an outward account and an inward account in the transfer request upon receipt of the transfer request is preceded by the steps of:
when a request for establishing a payment channel network structure is received, selecting a preset number of nodes from a alliance chain as core nodes, and mutually associating the core nodes to form a main payment channel;
averagely distributing nodes except the core node in the alliance chain to the core node to serve as child nodes of the core node, and establishing connection between the core node and the child nodes corresponding to the core node to form a secondary payment channel;
and forming key value pairs by the address information of the core node and the address information of the child nodes corresponding to the core node, storing the key value pairs to a node list of the core node, and completing the establishment of a payment channel network structure.
3. A block chain-based transfer method as claimed in claim 2, wherein the step of selecting a preset number of nodes from a federation chain as core nodes and associating each of the core nodes with each other to form a principal payment channel upon receiving a payment channel network configuration establishment request comprises:
when a request for establishing a payment channel network structure is received, selecting an initiating node from a alliance chain, and acquiring asset information of each initiating node;
arranging the initiating nodes according to the level of the pledge amount in the asset information, acquiring a preset number of initiating nodes in the top sequence as core nodes, and mutually associating the core nodes to form a main payment channel.
4. A blockchain-based transfer method as recited in claim 2, wherein the step of forming the address information of the core node and the address information of the corresponding child node of the core node into a key-value pair, saving the key-value pair to the node list of the core node, and completing the establishment of the payment path network structure includes:
when detecting that the node exits the alliance chain, acquiring a node address of the exiting node;
writing the node address of the exit node into a cancel channel function, obtaining a core node associated with the exit node and a node list of the core node, and deleting the node address of the exit node in the node list.
5. A blockchain-based transfer method as recited in claim 1 wherein the step of obtaining the origination node to which the transferred account is connected and obtaining the destination node to which the transferred account is connected comprises:
acquiring an initial node connected with the transferred account, and sending a query request containing the transferred account identifier to a alliance chain;
receiving feedback information according to the query request, and taking a node which sends the feedback information in the alliance chain as a target node connected with the transferred account;
and if the feedback information according to the query request is not received, sending the query request to a server to obtain the destination node which is fed back by the server and is connected with the transferred account.
6. A blockchain-based transfer method as recited in claim 1 wherein the step of performing a transfer operation along the payment channel transfer path includes:
acquiring the transfer amount in the transfer request, acquiring the number of payment channels in the transfer path of the payment channel, and determining the procedure cost corresponding to the transfer path of the payment channel;
taking the transfer amount, the payment channel number and the commission charge as transmission messages, sending the transmission message signatures to the initial node, processing the transmission messages through the initial node and then forwarding the transmission messages to a first core node, processing the transmission messages through the first core node and then forwarding the transmission messages to a second core node, processing the transmission messages through the second core node and then forwarding the transmission messages to a destination node, processing the transmission messages through the destination node and then forwarding the transmission messages to a transfer-in account;
and receiving a decryption request fed back by the transferred account, decrypting the transmission message to enable the transferred account to obtain the transfer amount, and finishing the transfer operation.
7. A blockchain-based transfer method as recited in any one of claims 1 to 6 wherein the step of establishing a connection between the transfer-out account, the originating node, the first core node, the second core node, the destination node and the transfer-in account to generate a payment channel transfer path is followed by the step of:
obtaining the transfer amount in the transfer request, and obtaining the pledge amount of the starting node, the first core node, the second core node and the destination node in the transfer path of the payment channel;
comparing the transfer amount with each pledge amount, and judging whether the pledge amount smaller than the transfer amount exists;
if the pledge amount smaller than the transfer amount exists, outputting prompt information;
and if the pledge amount smaller than the transfer amount does not exist, executing the step of executing the transfer operation along the transfer path of the payment channel.
8. A blockchain-based transfer apparatus, the blockchain-based transfer apparatus comprising:
the transfer request receiving module is used for acquiring a transfer-out account and a transfer-in account in the transfer request when the transfer request is received;
the first acquisition module is used for acquiring an initial node connected with the transferred-out account and acquiring a target node connected with the transferred-in account;
a second obtaining module, configured to traverse a node list, and obtain a first core node connected to the initiating node and a second core node connected to the destination node;
the path establishing module is used for establishing the connection among the roll-out account, the initiating node, the first core node, the second core node, the destination node and the roll-in account and generating a payment channel transfer path;
and the transfer module is used for executing transfer operation along the transfer path of the payment channel.
9. A blockchain-based transfer apparatus, the blockchain-based transfer apparatus comprising: memory, processor and a blockchain based transfer program stored on the memory and executable on the processor, the blockchain based transfer program when executed by the processor implementing the steps of the blockchain based transfer method of any of claims 1 to 7.
10. A computer-readable storage medium, having stored thereon a blockchain-based transfer program, which when executed by a processor, performs the steps of the blockchain-based transfer method of any one of claims 1 to 7.
CN201911350651.2A 2019-12-24 2019-12-24 Block chain-based transfer method, device, equipment and computer medium Pending CN111126988A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911350651.2A CN111126988A (en) 2019-12-24 2019-12-24 Block chain-based transfer method, device, equipment and computer medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911350651.2A CN111126988A (en) 2019-12-24 2019-12-24 Block chain-based transfer method, device, equipment and computer medium

Publications (1)

Publication Number Publication Date
CN111126988A true CN111126988A (en) 2020-05-08

Family

ID=70502051

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911350651.2A Pending CN111126988A (en) 2019-12-24 2019-12-24 Block chain-based transfer method, device, equipment and computer medium

Country Status (1)

Country Link
CN (1) CN111126988A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112653619A (en) * 2020-12-07 2021-04-13 布比(北京)网络技术有限公司 Multi-path route determining method and system for lightning network

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112653619A (en) * 2020-12-07 2021-04-13 布比(北京)网络技术有限公司 Multi-path route determining method and system for lightning network

Similar Documents

Publication Publication Date Title
Sompolinsky et al. Secure high-rate transaction processing in bitcoin
CN109472572B (en) Contract system based on block chain main chain and parallel multiple sub-chains
Di Stasi et al. Routing payments on the lightning network
US20190108364A1 (en) Management of cryptographic transactions
CN111385246B (en) Secure route identification method and device
JP2020516109A (en) Accelerating transaction delivery in blockchain networks using transaction resubmission
Harris et al. Flood & loot: A systemic attack on the lightning network
CN109493052B (en) Cross-chain contract system based on main chain and parallel multiple sub-chains
CN112953821B (en) Message transmission method and device
CN111801925A (en) Block chain based system and method for propagating data in a network
CN107577700A (en) The processing method and processing device of database disaster tolerance
Werman et al. Avoiding deadlocks in payment channel networks
CN111126988A (en) Block chain-based transfer method, device, equipment and computer medium
US20210192446A1 (en) Anonymity system for goods delivery
KR20200030089A (en) Cross network authentication method and system
CN111277496B (en) Block chain hierarchical data exchange method and device and computer equipment
WO2020248657A1 (en) Method and apparatus for locking account in blockchain
WO2020221085A1 (en) Relay method for quantum key, device, system, apparatus, and storage medium
WO2020248656A1 (en) Method and apparatus for unlocking account in block chain
KR102399632B1 (en) Method and apparatus for transmitting and receiving data based on blockchain in a wireless communication system
CN105282198B (en) The data processing method and device of task based on P2P network
van Schie ‘Routing scalable bitcoin payments
WO2021048056A1 (en) A method and system for executing fast and safe transactions involving a high-latency blockchain
CN113259463B (en) Cross-chain interaction method and block chain system
CN113259461B (en) Cross-chain interaction method and block chain system

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