Rebalancing method and device applied to payment channel network

BFlow protocol solves the problem of imbalance and insufficient privacy protection by generating a rebalancing requirement graph and a recurrent transaction sequence by anonymous identity participants, improves the stability and efficiency of the payment network, and achieves efficient rebalancing and privacy. Protect.

CN119313327AActive Publication Date: 2025-01-14ZHEJIANG NORMAL UNIV
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202411845026.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-16
Publication Date
2025-01-14
Estimated Expiration
2044-12-16

AI Technical Summary

Technical Problem

The rebalancing algorithm of existing payment channel networks has problems such as low efficiency and insufficient privacy protection, resulting in increased network imbalance and decreased payment success rate.

Method used

A rebalancing protocol called BFlow is proposed, which invites participants to generate a rebalancing requirement graph through anonymous identity, constructs a recurrent transaction sequence, and performs amount allocation and transaction payment to achieve rebalancing of funds in the payment channel.

Benefits of technology

It improves the stability and efficiency of the payment network, enhances privacy protection, effectively controls network imbalance, and maintains a high payment success rate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119313327A_ABST
    Figure CN119313327A_ABST
Patent Text Reader

Abstract

The invention provides a rebalancing method and device applied to a payment channel network, and the method comprises the steps: enabling an initiating user in the payment channel network to initiate an invitation, obtaining a user participating in the rebalancing operation, and generating a subgraph of the payment channel network according to the participating user; a user connected with each payment channel in the sub-graph negotiates according to own payment capability to generate a maximum rebalance demand as a value of a corresponding edge in the sub-graph, and a rebalance demand graph is obtained; obtaining a loop from the rebalance demand graph, and constructing a circular transaction sequence according to the loop; and performing amount distribution on the transactions in the circular transaction sequence, executing the transactions along the loop direction according to the distributed amount, and completing the rebalancing operation. The invention provides an on-demand rebalance protocol BFlow, which is used for improving the payment success rate, improving the user experience and providing more privacy protection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of blockchain technology, and in particular to a rebalancing method and device applied to a payment channel network. Background Art

[0002] Payment Channel Networks (PCNs) are an off-chain expansion method designed to improve the efficiency of blockchain transactions and have become one of the most promising strategies in the field of decentralized digital payments. Payment channel networks are based on technologies such as hash time lock contracts and revocable expiration sequence contracts, which enable nodes to establish off-chain payment channels with locked assets on the chain. PCNs is essentially a two-layer solution, where layer1 is the underlying blockchain protocol or base layer, and layer2 is a protocol or solution built on the basis of the underlying blockchain. Layer1 requires steps such as transaction creation, transaction broadcasting, and consensus verification, which takes a lot of time. Layer2 only needs to conduct transactions off-chain after the transaction parties build a channel, eliminating steps such as consensus, realizing fast and low-cost circulation of assets off-chain, saving a lot of time, and greatly improving the throughput of the blockchain. By establishing a channel, the two parties to the transaction can avoid the tedious operation of putting each transaction on the chain, thereby solving the problem of high handling fees for small payments.

[0003] The imbalance of the payment channel refers to the deviation of the channel funds caused by the two nodes that establish the channel off-chain as the PCNs transaction proceeds. Rebalancing is the process of restoring the balance of the unbalanced payment channel by transferring the balance of the two nodes that establish the channel. It is an improvement measure to deal with the increasing imbalance of the payment channel network. Rebalancing can solve the problem of decreased payment success rate caused by the deviation of channel capacity, thereby maintaining the continuous operation of the payment channel network and enhancing the overall stability of the network.

[0004] At present, the rebalancing algorithms of payment channel networks are mainly divided into dynamic rebalancing and on-demand rebalancing. Although some routing algorithms such as Spider algorithm and GCBRS_PCNs (Greedy Channel Balanced Routing Strategy of Payment Channel Networks) consider the imbalance of channels in a dynamic rebalancing way, the effect is not obvious. Considering the imbalance of channels from the perspective of routing has great limitations. Routing algorithms can give priority to low-load nodes during transactions to alleviate this situation, but as transactions continue, it will eventually lead to the exhaustion of funds in a certain channel, making the paths related to the channel unusable, which is a waste of resources. Because according to the principle of the payment channel network, if the funds of the off-chain channel are exhausted, it is necessary to reopen the channel to transfer the funds on the chain to the off-chain. The payment channel network needs a spontaneous mechanism to make up for this situation as much as possible and improve the imbalance of the network to the greatest extent. Khalil first proposed the active rebalancing solution Revive, but it has limited privacy protection. Summary of the invention

[0005] The present invention provides a rebalancing method and device applied to a payment channel network, so as to solve the defects of the prior art that the rebalancing algorithm of the payment channel network has great limitations and limited privacy protection, and proposes a new on-demand rebalancing protocol BFlow to improve the payment success rate, improve the user experience, and provide more privacy protection.

[0006] The present invention provides a rebalancing method applied to a payment channel network, comprising:

[0007] An initiating user in the payment channel network initiates an invitation, obtains users participating in the rebalancing operation, and generates a subgraph of the payment channel network according to the participating users;

[0008] Users connected to each payment channel in the subgraph negotiate according to their own payment capabilities, generating a maximum rebalancing demand as a value on a corresponding edge in the subgraph, thereby obtaining a rebalancing demand graph;

[0009] Obtaining a loop from the rebalancing demand graph, and constructing a cyclic transaction sequence according to the loop;

[0010] The amount of transactions in the cyclic transaction sequence is allocated, and the transactions are executed along the loop direction according to the allocated amount to complete the rebalancing operation.

[0011] According to a rebalancing method applied to a payment channel network provided by the present invention, the initiating user in the payment channel network initiates an invitation to obtain users participating in the rebalancing operation, including:

[0012] Assigning an anonymous identity to the initiating user who initiates the invitation, and the initiating user broadcasts the invitation information with the anonymous identity, wherein the invitation information includes a maximum number of hops and a maximum number of invitations;

[0013] After receiving the invitation information, the receiving user in the payment channel network sends an acceptance message or a rejection message to the sending user who sent the invitation information;

[0014] If the receiving user sends an acceptance message, a new anonymous identity is assigned to the receiving user, the receiving user is added to the participant set of the receiving user, and the receiving user propagates the invitation information to the neighboring nodes of the receiving user with the new anonymous identity according to the maximum number of hops and the maximum number of invitations;

[0015] The participant set of the receiving user is merged into the participant set of the corresponding sending user, and the final participant set after the participant set of the initiating user is merged includes all users participating in the rebalancing operation.

[0016] According to a rebalancing method applied to a payment channel network provided by the present invention, a loop is obtained from the rebalancing demand graph, comprising:

[0017] Randomly elect a leader from the rebalancing demand graph;

[0018] The leader sends a transaction request to the outgoing edge corresponding to the leader;

[0019] The receiving user who receives the transaction request processes and forwards the transaction request according to the transaction request, and gradually builds a path sequence;

[0020] When it is determined that a loop exists according to the path sequence, a loop set is constructed, and the maximum balance requirement of each edge of the loop is recorded in the loop set.

[0021] According to a rebalancing method applied to a payment channel network provided by the present invention, the receiving user receiving the transaction request processes and forwards the transaction request according to the transaction request, and gradually constructs a path sequence, including:

[0022] After the receiving user receives the transaction request, the anonymous identity tag in the transaction request is locally stored in a tag set;

[0023] If the receiving user has no outgoing user, sending a failure message to the incoming user of the receiving user;

[0024] If the receiving user has an outgoing user, the anonymous identity tag of the outgoing user is added to the path sequence in the transaction request, and the transaction request is forwarded to the outgoing user after the anonymous identity tag of the receiving user is added to the transaction request.

[0025] According to a rebalancing method applied to a payment channel network provided by the present invention, when it is determined that a loop exists according to the path sequence, a loop set is constructed, including:

[0026] If the anonymous identity tag of the receiving user exists in both the path sequence received by the receiving user and the locally stored tag set, it is determined that a loop exists in the path sequence;

[0027] The loop set is constructed according to the tag set stored locally by the receiving user.

[0028] According to a rebalancing method for a payment channel network provided by the present invention, the amount of transactions in the cyclic transaction sequence is allocated, including:

[0029] The leader in the loop starts to send the required amount information in the reverse direction of the loop, and when the required amount information received by the user is greater than the required amount information corresponding to the user in the local information table, the local information table is updated;

[0030] In the case that the user has multiple outbound users, the multiple required amount information received by the user are equally distributed;

[0031] When the user receives multiple required amount information from the same user, the user chooses to pay the maximum value of the multiple required amount information.

[0032] According to a rebalancing method applied to a payment channel network provided by the present invention, when the user has multiple outgoing users, multiple required amount information received by the user is equally distributed, including:

[0033] In the case that the user has multiple outbound users, calculating the sum of multiple required amount information received by the user;

[0034] If the maximum rebalancing demand corresponding to the incoming user of the user is greater than or equal to the sum, forwarding the multiple demand amount information to the incoming user of the user;

[0035] If the maximum rebalancing demand corresponding to the incoming user of the user is less than the total, the quotient of the maximum rebalancing demand and the number of the outgoing users is used as the single allocation amount, and the remainder is used as the remaining amount of the maximum rebalancing demand. The allocation amount for each demand amount information is determined based on the single allocation amount and the remaining amount, and the remaining amount to be allocated for each demand amount information is updated after each allocation.

[0036] According to a rebalancing method applied to a payment channel network provided by the present invention, the transaction is executed along the loop direction according to the allocated amount to complete the rebalancing operation, including:

[0037] If the required amount information sent by the leader is different from the actual bill amount to be paid according to the allocated amount, the leader broadcasts the actual bill amount to be paid along the loop direction;

[0038] If all users in the loop agree on the allocation plan of the amount, transactions are executed along the loop direction starting from the leader to complete the rebalancing operation.

[0039] The present invention also provides a rebalancing device applied to a payment channel network, comprising:

[0040] An acquisition module, configured to initiate an invitation from an initiating user in the payment channel network, acquire users participating in the rebalancing operation, and generate a subgraph of the payment channel network according to the participating users;

[0041] A generating module, configured to generate a maximum rebalancing demand as a value on a corresponding edge in the subgraph through negotiation by users connected to each payment channel in the subgraph according to their own payment capabilities, thereby obtaining a rebalancing demand graph;

[0042] A construction module, configured to obtain a loop from the rebalancing demand graph and construct a cyclic transaction sequence according to the loop;

[0043] The transaction module is used to allocate amounts to transactions in the cyclic transaction sequence, execute transactions along the loop direction according to the allocated amounts, and complete the rebalancing operation.

[0044] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the rebalancing method applied to a payment channel network as described in any one of the above methods is implemented.

[0045] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the above-described rebalancing methods applied to a payment channel network.

[0046] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any of the above-described rebalancing methods applied to a payment channel network.

[0047] The present invention provides a rebalancing method and device for a payment channel network. A privacy-protecting rebalancing protocol BFlow is proposed. The BFlow protocol allows participants to participate anonymously and find a suitable rebalancing loop to achieve rebalancing operations. The BFlow protocol consists of three parts, namely, the generation of a rebalancing demand graph, the construction of a cyclic transaction sequence, and the allocation of funds for loop transactions and transaction payments, thereby achieving rebalancing of payment channel funds and improving the stability and efficiency of the payment network. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0049] Figure 1 It is a flow chart of a rebalancing method applied to a payment channel network provided by the present invention;

[0050] Figure 2 It is a schematic diagram of a model of a payment channel network of a rebalancing method applied to a payment channel network provided by the present invention;

[0051] Figure 3 The rebalancing method provided by the present invention for the payment channel network is based on Figure 2 Rebalancing demand diagram;

[0052] Figure 4 It is a schematic diagram of a flow chart of generating a rebalancing demand graph in a rebalancing method applied to a payment channel network provided by the present invention;

[0053] Figure 5 It is a flow chart of constructing a cyclic transaction sequence in a rebalancing method applied to a payment channel network provided by the present invention;

[0054] Figure 6 It is a schematic diagram of a process of constructing a cyclic transaction sequence in a rebalancing method applied to a payment channel network provided by the present invention;

[0055] Figure 7 It is a flow chart of fund allocation and transaction payment of loop transactions in the rebalancing method applied to the payment channel network provided by the present invention;

[0056] Figure 8 It is a schematic diagram of the funds allocation process of the loop in the rebalancing method applied to the payment channel network provided by the present invention;

[0057] Fig. 9 It is the number of transactions and the network imbalance G in the rebalancing method applied to the payment channel network provided by the present invention. mean Schematic diagram of the relationship between

[0058] Fig.10 It is a schematic diagram of the relationship between the number of transactions and the payment success rate in the rebalancing method applied to the payment channel network provided by the present invention;

[0059] Fig.11 It is a structural schematic diagram of a rebalancing device applied to a payment channel network provided by the present invention;

[0060] Fig.12 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0061] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0062] Combine the following Figure 1 A rebalancing method of the present invention applied to a payment channel network is described, comprising:

[0063] Step 101, an initiating user in the payment channel network initiates an invitation, obtains users participating in the rebalancing operation, and generates a subgraph of the payment channel network according to the participating users;

[0064] Step 102: Users connected to each payment channel in the subgraph negotiate according to their own payment capabilities, generate a maximum rebalancing demand as a value on a corresponding edge in the subgraph, and obtain a rebalancing demand graph;

[0065] Step 103, obtaining a loop from the rebalancing demand graph, and constructing a cyclic transaction sequence according to the loop;

[0066] Step 104, allocating amounts to the transactions in the cyclic transaction sequence, executing transactions along the loop direction according to the allocated amounts, and completing the rebalancing operation.

[0067] Payment channel networks PCNs are defined as an undirected multi-edge graph with finite nodes. , each node represents a user in the payment channel network. and There is an undirected edge between Represented as a payment channel, let the payment capability of the node be , indicating a node In the payment channel right Maximum payment amount, channel The capacity balance is expressed as .

[0068] The rebalancing protocol is essentially the process of mobilizing funds in the payment channel network. It is necessary to ensure the security of funds, so it is necessary to ensure the conservation of the balance in the channel, that is, the balance of an honest user remains unchanged before and after the rebalancing operation. As shown in formula (1):

[0069]

[0070] Among them, among them, Expressed as The balance of the payment channel between users.

[0071] During the rebalancing operation, the amount of funds that can be adjusted between any two nodes must not exceed the maximum payment capacity allowed by the node in the payment channel, as shown in formula (2):

[0072]

[0073] Figure 2 The diagram shows an example of a payment channel network model. There are four users in the diagram, and there is an undirected edge between the users, which represents the payment channel. The number on the right side of the undirected edge represents the user's payment ability in this payment channel, that is, For example, the maximum amount that node A can pay to node D is 12 coins.

[0074] As can be seen from the figure, the amount of money in the network is unevenly distributed. For example, a transaction is generated between node D and node A, which eventually causes the amount of node D to flow to node A. If node D does not transfer the funds on the chain to the off-chain, then no transactions will occur in the channel between node A and node D.

[0075] For the entire payment channel network, as many payment channels as possible will increase the payment success rate. Every node has the possibility of acting as a routing node, so rebalancing measures are needed to improve the imbalance of the payment channel network in order to reduce the possibility of channels being unusable prematurely due to running out of funds.

[0076] First, generate a directed weighted rebalancing demand graph , Represents the user who participated in the rebalancing operation. Represented as the edge in the rebalancing operation A collection of is the subgraph of G that represents the maximum rebalancing demand between nodes. The maximum rebalancing demand from user m to n is expressed as , Negotiated between two users.

[0077] Figure 3 Shown Figure 2 The rebalancing demand diagram assumes that all users participate in the rebalancing operation. For example, if there is a 7-coin difference between user A and user D, user A needs to pay 7 coins to user D, and nodes A and D are balanced. However, since users B and C have the same payment ability, they are balanced at this time and there is no need for rebalancing.

[0078] The rebalancing demand graph generation process first starts with a user in the graph G = (V, E) initiating an invitation, communicating with nearby users to find other users who are interested in participating in the rebalancing operation, generating a subgraph consisting of participating users, and then the users connected by the payment channel negotiate to finally generate a directed rebalancing demand graph.

[0079] The process of constructing a cyclic trading sequence is to obtain the rebalancing demand graph Afterwards, according to Get a suitable loop and then build a cyclic transaction sequence, which is the payment sequence of the user in the loop.

[0080] The capital allocation and transaction process of the loop is based on the constructed cyclic transaction sequence, allocating the most suitable amount for these cyclic transactions so that the rebalancing needs can be met to the greatest extent, and finally executing the transaction to complete the rebalancing operation.

[0081] In decentralized payment networks (such as the Lightning Network), users conduct transactions through peer-to-peer payment channels. As transactions proceed, the funds in some payment channels may become unbalanced, causing some channels to become depleted or overly abundant, affecting the overall efficiency of the payment network. The BFlow protocol achieves the rebalancing of channel funds by anonymous participants looking for a suitable rebalancing loop, thereby improving the stability and efficiency of the payment network.

[0082] This embodiment proposes a privacy-protecting rebalancing protocol BFlow. The BFlow protocol allows participants to participate anonymously and find suitable rebalancing loops to achieve rebalancing operations. The BFlow protocol consists of three parts, namely, the generation of a rebalancing demand graph, the construction of a cyclic transaction sequence, and the allocation of funds and transaction payments for loop transactions, thereby achieving rebalancing of payment channel funds and improving the stability and efficiency of the payment network.

[0083] Based on the above embodiment, in this embodiment, the initiating user in the payment channel network initiates an invitation to obtain users who participate in the rebalancing operation, including:

[0084] Assigning an anonymous identity to the initiating user who initiates the invitation, and the initiating user broadcasts the invitation information with the anonymous identity, wherein the invitation information includes a maximum number of hops and a maximum number of invitations;

[0085] After receiving the invitation information, the receiving user in the payment channel network sends an acceptance message or a rejection message to the sending user who sent the invitation information;

[0086] If the receiving user sends an acceptance message, a new anonymous identity is assigned to the receiving user, the receiving user is added to the participant set of the receiving user, and the receiving user propagates the invitation information to the neighboring nodes of the receiving user with the new anonymous identity according to the maximum number of hops and the maximum number of invitations;

[0087] The participant set of the receiving user is merged into the participant set of the corresponding sending user, and the final participant set after the participant set of the initiating user is merged includes all users participating in the rebalancing operation

[0088] The generation process of the rebalancing demand graph is as follows Figure 4 As shown, the following steps are included:

[0089] 1. Initialization: The initiating user of the BFlow protocol Assign a randomly generated anonymous identity C M , and through all its adjacent edges E M Broadcast invitation information, which includes the maximum number of hops , Maximum number of invitations And the anonymous identity C generated by the node M . Represents the maximum distance that a user can invite. Every time a user sends an invitation message, The value decreases by 1 when When it is 0, no invitation message will be sent. Indicates the maximum number of invitation messages that a user can send. and Control the number of participating users U and the size of the network.

[0090] 2. Processing of invitation information: The current user N receives the invitation from the previous user When an invitation message is broadcast, you need to reply to it.

[0091] (1) If the user does not want to participate in the BFlow protocol for rebalancing operations, a rejection message can be sent to the user And end the processing.

[0092] (2) If the current user Willing to participate in the BFlow protocol and current users Currently not participating in invitations initiated by other users, assign a new anonymous identity to the current user And add to the participating users collection , record the edge receiving the information as the parent edge .

[0093] (3) If the user has not sent an invitation yet and Greater than 0, if the number of neighbors of the user is greater than 0, the user The updated invitation information will be broadcasted to its neighbor nodes except the parent node (i.e. minus 1). If the above conditions are not met, that is, is 0 or the number of adjacent edges is 0, the user Will reply acceptance information to the user .

[0094] 3. Processing of acceptance and rejection information: The user updates the participant set based on the acceptance or rejection information received, and the final initiator Collect all participating users and broadcast the complete set. Send to user When the user receives a reply after receiving the message, The child node user The set of participants Join The set of participants ,side Add to The set of edges that received the receive message.

[0095] As users accept the invitation With the initiator Getting closer, its participants gather This is similar to the idea of ​​divide and conquer, that is, as the number of divisions decreases, the similarity between each sub-problem and the original problem increases. Send acceptance information to the parent node user, to get a more complete set of participants , the final initiator You will get a set of all participating users. If a rejection message is received, this edge will be removed from the invitation set and the user will no longer participate in the BFlow protocol.

[0096] 4. Broadcast Participant Collection :When the initiator When all replies are received, Get the parameters in and The set of all users willing to participate in the BFlow protocol under restrictions In order to ensure the security of the protocol, all participating users need to know the complete set , which makes it easier to identify the real participating users. The participant set can be broadcasted using a breadth-first search traversal method To all participating users.

[0097] 5. Negotiate to generate a rebalancing demand graph: Based on the above subgraph, user m and its connected user n negotiate based on their own payment capabilities in the payment channel, and finally obtain the maximum balance demand from m to n. . It is directional, so after negotiation among all connected users in the subgraph, a directed maximum balance demand graph can be obtained. .

[0098] Based on the above embodiment, in this embodiment, obtaining a loop from the rebalancing demand graph includes:

[0099] Randomly elect a leader from the rebalancing demand graph;

[0100] The leader sends a transaction request to the outgoing edge corresponding to the leader;

[0101] The receiving user who receives the transaction request processes and forwards the transaction request according to the transaction request, and gradually builds a path sequence;

[0102] When it is determined that a loop exists according to the path sequence, a loop set is constructed, and the maximum balance requirement of each edge of the loop is recorded in the loop set.

[0103] On the basis of the above embodiment, the receiving user who receives the transaction request in this embodiment processes and forwards the transaction request and gradually builds a path sequence, including:

[0104] After the receiving user receives the transaction request, the anonymous identity tag in the transaction request is locally stored in a tag set;

[0105] If the receiving user has no outgoing user, sending a failure message to the incoming user of the receiving user;

[0106] If the receiving user has an outgoing user, the anonymous identity tag of the outgoing user is added to the path sequence in the transaction request, and the transaction request is forwarded to the outgoing user after the anonymous identity tag of the receiving user is added to the transaction request.

[0107] The construction process of the cyclic transaction sequence is as follows Figure 5 As shown, the specific steps include:

[0108] 1. Leader election: By sorting the participant set to generate a list, the leader is randomly elected to prevent interference from malicious nodes. Unlike the Revive protocol, which has a fixed ID value of the smaller leader node, the BFlow protocol has a fixed ID value of the participant set. Generate a list after sorting All users have the potential to be leaders and a new leader must be elected each time the protocol is started. This prevents malicious nodes from intentionally generating a user with a smaller ID value to become a leader and disrupt the normal operation of the BFlow protocol.

[0109] 2. Transaction request: The leader sends a transaction request to the outgoing edge, and the user processes and forwards it according to the request, gradually building a path sequence.

[0110] (1) By the leader Outward Send a transaction request , the request contains the leader's anonymous identity token , User sequence on the path and maximum balance requirements If the number of outgoing edges of the leader is 0, it will directly wait for the next round to re-elect the leader.

[0111] (2) After receiving the request, the user marks the anonymous identity in the request Store in The user who received the request If there is no outgoing edge, add the incoming edge Send a failed message and return. If there are outgoing edges, mark the anonymous identity of each edge Add to , and then forward the transaction request through each outgoing edge .

[0112] (3) If the user Newly received sequence and a locally stored collection of tags By comparison, we find that there are new users. Need to go out to it Added update message , synchronize the newly added users to .

[0113] 3. Loop search: The user determines whether there is a loop based on the path sequence, constructs a loop set, and records the maximum balance demand information.

[0114] On the basis of the above embodiment, in this embodiment, when it is determined that a loop exists according to the path sequence, a loop set is constructed, including:

[0115] If the anonymous identity tag of the receiving user exists in both the path sequence received by the receiving user and the locally stored tag set, it is determined that a loop exists in the path sequence;

[0116] The loop set is constructed according to the tag set stored locally by the receiving user.

[0117] In the process of loop search, first determine the path sequence of the anonymous identity tag received and the user's locally stored tag collection Does the intersection of contains the user's tag? If it does, it means that the sent label returns to the user, indicating that there is at least one loop. If it does not contain Then there is no loop. Finally, the user The user sequence in constructs the cycle set , Record the path information and maximum balance requirements of the loop belonging to the user etc., loop set It is a cyclical transaction sequence.

[0118] Figure 6 (a) to (d) in the figure construct three cyclic transactions, namely A→Q→E→A, A→Q→D→C→A, and A→Q→K→D→C→A.

[0119] Based on the above embodiment, in this embodiment, the amount of transactions in the cyclic transaction sequence is allocated, including:

[0120] The leader in the loop starts to send the required amount information in the reverse direction of the loop, and when the required amount information received by the user is greater than the required amount information corresponding to the user in the local information table, the local information table is updated;

[0121] In the case that the user has multiple outbound users, the multiple required amount information received by the user are equally distributed;

[0122] When the user receives multiple required amount information from the same user, the user chooses to pay the maximum value of the multiple required amount information.

[0123] The fund allocation and transaction payment process of the loop transaction is as follows Figure 7 As shown, the following steps are included:

[0124] 1. Send the required amount information: Starting from the loop leader, send the required amount information in the reverse direction of the loop and update the local information table.

[0125] (1) Based on the loops that have been searched during the construction phase of the cyclic transaction , starting from the leader of the loop, send the required amount information in the reverse direction of the loop , Contains the actual amount requested .

[0126] (2) Local information table of loop members The real-time balance demand amount of the loop members during the protocol execution is stored as The initial value defaults to 0. When the user receives the amount message , if not the leader or the actual amount requested , then update value.

[0127] (3) If a user has multiple outgoing edges, the received request amounts need to be distributed equally.

[0128] (4) When receiving multiple amount information from the same user , then choose the edge with the largest payment demand.

[0129] 2. Equal distribution of amount: For multiple outbound situations, an equal distribution algorithm is used to ensure that the needs of all parties are met as much as possible. In this process, it is necessary to handle the situation where a user has multiple outbound sides, that is, the user receives multiple demand amount information. After the list is created, the amount of money required needs to be sent to the next user through the same edge. If the next edge's demand is the amount to be allocated , continue to press List information forwards amount information. If the amount to be allocated Less than the sum of the required amounts , the amount must be distributed equally.

[0130] 3. Payment of circular transactions: The leader collects and confirms the payment plan, executes the transaction along the loop direction, and completes the rebalancing operation.

[0131] On the basis of the above embodiment, in this embodiment, when the user has multiple outbound users, multiple required amount information received by the user is equally distributed, including:

[0132] In the case that the user has multiple outbound users, calculating the sum of multiple required amount information received by the user;

[0133] If the maximum rebalancing demand corresponding to the incoming user of the user is greater than or equal to the sum, forwarding the multiple demand amount information to the incoming user of the user;

[0134] If the maximum rebalancing demand corresponding to the incoming user of the user is less than the total, the quotient of the maximum rebalancing demand and the number of the outgoing users is used as the single allocation amount, and the remainder is used as the remaining amount of the maximum rebalancing demand. The allocation amount for each demand amount information is determined based on the single allocation amount and the remaining amount, and the remaining amount to be allocated for each demand amount information is updated after each allocation.

[0135] This embodiment proposes an algorithm for equally distributing the amount so that the needs of all parties can be met as much as possible. , the algorithm steps are as follows:

[0136] (1) Set an initial value to 0, and Lists of the same length Used to store the amount allocated to each requirement. Each requirement in , and also set a Exactly the same temporary list It is used to indicate the amount of remaining unallocated demand. The amount allocated once is the amount to be allocated. and total demand | The quotient of | is , the remaining amount is recorded as .

[0137] (2) If there is still money to be distributed, , for each requirement The amount to be allocated is , Is a single allocation amount and the remaining amount to be allocated for current demand The minimum of the two, which needs to be updated after each allocation .

[0138] (3) If there is still money left to be distributed after the previous distribution , the remaining will be allocated in the smallest unit .

[0139] Figure 8 (a) to (d) in the figure show examples of demand amount allocation. Since the edge weight of user Q is only 15, but the amount to be allocated comes from the circular transactions of users D and E, and the sum of the demands is 16+8=24. According to the allocation algorithm 15 / 2=7......1, since 7<16, 7<8, 7 coins are allocated to each path first, and the remaining 1 coin will be allocated to one of the users D or E. Therefore, the demand allocation algorithm needs to be used to balance the allocation amount for both loops. Finally, the amount allocated to the loop A→Q→D→C→A is 8 coins, and the amount allocated to the loop A→Q→E→A is 7 coins.

[0140] The minimum unit is the lowest unit value of the currency, and the default value is 1 coin. If there are three demands of 30 each, according to the allocation algorithm 80 / 3=26....2, since 26 is less than 30, each demand will be allocated 26 first; in the end, there will be 4 left for each of the three demands, because 1 is less than 4, and finally the first two demands will be allocated 1 coin each. So the allocation amounts for the three demands are 27, 27, and 26 respectively.

[0141] If the minimum value of the user's value in step (2) is , which also indicates that the user's payment request has been completed. The maximum amount allocated each time is 1. For example, if the remaining demand is (1.2, 0, 1.5, 3, 5), =6, then after the first cycle it is (0.2, 0, 0.5, 2, 4), After the second round of cycles, the value is (0, 0, 0, 1, 3.7).

[0142] Based on the above embodiment, the transaction is executed in the loop direction according to the allocated amount in this embodiment to complete the rebalancing operation, including:

[0143] If the required amount information sent by the leader is different from the actual bill amount to be paid according to the allocated amount, the leader broadcasts the actual bill amount to be paid along the loop direction;

[0144] If all users in the loop agree on the allocation plan of the amount, transactions are executed along the loop direction starting from the leader to complete the rebalancing operation.

[0145] When the leader of a circular transaction receives the allocated loop request message, which can also be said to be the actual payment plan, the leader has obtained the complete payment bill. After the demand is allocated, the amount may be different from the amount of the payment request bill information actually received. Different from the previous one, the leader also needs to broadcast the actual amount of the bill to be paid along the direction of the loop. If the loop member obtains the latest payment amount and agrees with the latest payment amount plan, it will continue to forward it to the next member. If all users in the loop finally agree to the latest payment plan, the leader of the circular transaction will execute the transaction along the direction of the loop, and finally complete the rebalancing operation to end the protocol.

[0146] For example, suppose the leader wants a certain path to pay him 10 coins, but some nodes do not have enough funds to complete the payment and can only complete 8 coins. At this time, the leader needs to broadcast the transaction bill information to other users on the path to tell them that they only need to pay 8 coins, and wait for them to finally complete the payment of the bill.

[0147] In the experiment, we analyzed the historical data of the real-world payment channel network to conduct experimental estimation and build a new payment channel network. In this process, we eliminated those channels that could not correspond to any nodes, and finally formed a PCNs containing 3896 nodes and 53211 channels. In order to simulate the distribution of private channel balances in the Lightning network, we adopted a strategy of randomly generating balances.

[0148] In addition, the three key processes of the BFlow protocol are implemented in the Python environment. All these experiments are completed on a desktop computer equipped with an i7-11700 CPU and 16GB of memory. In order to be closer to the workload imbalance in PCN, an exponential distribution is used to randomly determine the initiating and receiving nodes of the transaction, ensuring that some nodes play a more frequent sending or receiving role in the network. This setting is intended to deeply explore the workload imbalance within PCNs, so as to more accurately evaluate the BFlow protocol.

[0149] Study the effect of BFlow protocol on controlling the increase of imbalance and the corresponding changes in payment success rate. Fig. 9 Shows the number of transactions and the overall imbalance of the network The results show that the overall imbalance of the network increases as transactions proceed. However, the growth rate of the Baseline without the rebalancing algorithm is significantly faster than that of other algorithms. It can be seen that the rebalancing algorithm has a great effect on controlling the increase in the imbalance of the payment channel network.

[0150] Specifically, the BFlow,protocol has the best effect in controlling the increase of imbalance.,During a total of 3800 transactions, the BFlow protocol can keep the overall imbalance of the,network within 0.18.,Secondly, the Cycle algorithm and the Revive algorithm have similar,overall performance, but after the number of transactions exceeds 3300, the Cycle algorithm is slightly better,than the Revive algorithm in alleviating the increase of imbalance.

[0151] Fig.10 The relationship between the number of transactions and the payment success rate is shown. As the number of transactions increases, the payment success rate decreases accordingly. Specifically, since Baseline has no rebalancing effect, the payment success rate will decrease as the network imbalance increases. In the initial stage of the transaction, the payment success rate of each algorithm is stable at However, as the number of transactions increases, the BFlow protocol shows better performance than the Revive algorithm and the Cycle algorithm, and can keep the payment success rate above 50%. Therefore, effectively controlling the overall imbalance of the network is of great significance to improving the payment success rate.

[0152] The rebalancing device applied to the payment channel network provided by the present invention is described below. The rebalancing device applied to the payment channel network described below and the rebalancing method applied to the payment channel network described above can be referred to each other.

[0153] like Fig.11 As shown, the device includes an acquisition module 1101, a generation module 1102, a construction module 1103 and a transaction module 1104, wherein:

[0154] The acquisition module 1101 is used for initiating an invitation by an initiating user in the payment channel network, acquiring users participating in the rebalancing operation, and generating a subgraph of the payment channel network according to the participating users;

[0155] The generating module 1102 is used for generating a maximum rebalancing demand as a value on a corresponding edge in the subgraph through negotiation by users connected to each payment channel in the subgraph according to their own payment capabilities, thereby obtaining a rebalancing demand graph;

[0156] The construction module 1103 is used to obtain a loop from the rebalancing demand graph and construct a cyclic transaction sequence according to the loop;

[0157] The transaction module 1104 is used to allocate amounts to the transactions in the cyclic transaction sequence, execute transactions along the loop direction according to the allocated amounts, and complete the rebalancing operation.

[0158] This embodiment proposes a privacy-protecting rebalancing protocol BFlow. The BFlow protocol allows participants to participate anonymously and find suitable rebalancing loops to achieve rebalancing operations. The BFlow protocol consists of three parts, namely, the generation of a rebalancing demand graph, the construction of a cyclic transaction sequence, and the allocation of funds and transaction payments for loop transactions, thereby achieving rebalancing of payment channel funds and improving the stability and efficiency of the payment network.

[0159] Fig.12 An example of a physical structure diagram of an electronic device is shown in FIG. Fig.12 As shown, the electronic device may include: a processor 1210, a communication interface 1220, a memory 1230 and a communication bus 1240, wherein the processor 1210, the communication interface 1220 and the memory 1230 communicate with each other through the communication bus 1240. The processor 1210 may call the logic instructions in the memory 1230 to execute a rebalancing method applied to a payment channel network, the method comprising: an initiating user in the payment channel network initiates an invitation, obtains users participating in the rebalancing operation, and generates a subgraph of the payment channel network according to the participating users; the users connected to each payment channel in the subgraph negotiate according to their own payment capabilities, generate a maximum rebalancing demand as the value of the corresponding edge in the subgraph, and obtain a rebalancing demand graph; obtain a loop from the rebalancing demand graph, and construct a cyclic transaction sequence according to the loop; allocate the amount of transactions in the cyclic transaction sequence, and execute transactions along the loop direction according to the allocated amount to complete the rebalancing operation.

[0160] In addition, the logic instructions in the above-mentioned memory 1230 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0161] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the rebalancing method provided by the above-mentioned methods for a payment channel network, the method including: an initiating user in the payment channel network initiates an invitation, obtains users participating in the rebalancing operation, and generates a subgraph of the payment channel network according to the participating users; users connected to each payment channel in the subgraph negotiate according to their own payment capabilities, generate a maximum rebalancing demand as the value of the corresponding edge in the subgraph, and obtain a rebalancing demand graph; obtain a loop from the rebalancing demand graph, and construct a cyclic transaction sequence according to the loop; allocate amounts for transactions in the cyclic transaction sequence, execute transactions along the loop direction according to the allocated amounts, and complete the rebalancing operation.

[0162] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the rebalancing method provided by the above-mentioned methods and applied to a payment channel network, the method comprising: an initiating user in the payment channel network initiates an invitation, obtains users participating in the rebalancing operation, and generates a subgraph of the payment channel network according to the participating users; users connected to each payment channel in the subgraph negotiate according to their own payment capabilities, generate a maximum rebalancing demand as the value of the corresponding edge in the subgraph, and obtain a rebalancing demand graph; obtain a loop from the rebalancing demand graph, and construct a cyclic transaction sequence according to the loop; allocate amounts for transactions in the cyclic transaction sequence, execute transactions along the loop direction according to the allocated amounts, and complete the rebalancing operation.

[0163] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0164] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0165] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A rebalancing method applied to a payment channel network, characterized in that: include: An initiating user in the payment channel network initiates an invitation, obtains users participating in the rebalancing operation, and generates a subgraph of the payment channel network according to the participating users; Users connected to each payment channel in the subgraph negotiate according to their own payment capabilities, generating a maximum rebalancing demand as a value on a corresponding edge in the subgraph, thereby obtaining a rebalancing demand graph; Obtaining a loop from the rebalancing demand graph, and constructing a cyclic transaction sequence according to the loop; The amount of transactions in the cyclic transaction sequence is allocated, and the transactions are executed along the loop direction according to the allocated amount to complete the rebalancing operation.

2. The rebalancing method for a payment channel network according to claim 1, characterized in that: The initiating user in the payment channel network initiates an invitation to obtain users participating in the rebalancing operation, including: Assigning an anonymous identity to the initiating user who initiates the invitation, and the initiating user broadcasts the invitation information with the anonymous identity, wherein the invitation information includes a maximum number of hops and a maximum number of invitations; After receiving the invitation information, the receiving user in the payment channel network sends an acceptance message or a rejection message to the sending user who sent the invitation information; If the receiving user sends an acceptance message, a new anonymous identity is assigned to the receiving user, the receiving user is added to the participant set of the receiving user, and the receiving user propagates the invitation information to the neighboring nodes of the receiving user with the new anonymous identity according to the maximum number of hops and the maximum number of invitations; The participant set of the receiving user is merged into the participant set of the corresponding sending user, and the final participant set after the participant set of the initiating user is merged includes all users participating in the rebalancing operation.

3. The rebalancing method for a payment channel network according to claim 1, characterized in that: Obtaining a loop from the rebalancing demand graph includes: Randomly elect a leader from the rebalancing demand graph; The leader sends a transaction request to the outgoing edge corresponding to the leader; The receiving user who receives the transaction request processes and forwards the transaction request according to the transaction request, and gradually builds a path sequence; When it is determined that a loop exists according to the path sequence, a loop set is constructed, and the maximum balance requirement of each edge of the loop is recorded in the loop set.

4. The rebalancing method for a payment channel network according to claim 3, characterized in that: The receiving user who receives the transaction request processes and forwards the transaction request, and gradually builds a path sequence, including: After the receiving user receives the transaction request, the anonymous identity tag in the transaction request is locally stored in a tag set; If the receiving user has no outgoing user, sending a failure message to the incoming user of the receiving user; If the receiving user has an outgoing user, the anonymous identity tag of the outgoing user is added to the path sequence in the transaction request, and the transaction request is forwarded to the outgoing user after the anonymous identity tag of the receiving user is added to the transaction request.

5. The rebalancing method for a payment channel network according to claim 4, characterized in that: When it is determined that a loop exists according to the path sequence, a loop set is constructed, including: If the anonymous identity tag of the receiving user exists in both the path sequence received by the receiving user and the locally stored tag set, it is determined that a loop exists in the path sequence; The loop set is constructed according to the tag set stored locally by the receiving user.

6. The rebalancing method for a payment channel network according to claim 1, characterized in that: Allocating amounts for transactions in the cyclic transaction sequence includes: The leader in the loop starts to send the required amount information in the reverse direction of the loop, and when the required amount information received by the user is greater than the required amount information corresponding to the user in the local information table, the local information table is updated; In the case that the user has multiple outbound users, the multiple required amount information received by the user are equally distributed; When the user receives multiple required amount information from the same user, the user chooses to pay the maximum value of the multiple required amount information.

7. The rebalancing method for a payment channel network according to claim 6, characterized in that: In the case that the user has multiple outbound users, the multiple required amount information received by the user is equally distributed, including: In the case that the user has multiple outbound users, calculating the sum of multiple required amount information received by the user; If the maximum rebalancing demand corresponding to the incoming user of the user is greater than or equal to the sum, forwarding the multiple demand amount information to the incoming user of the user; If the maximum rebalancing demand corresponding to the incoming user of the user is less than the total, the quotient of the maximum rebalancing demand and the number of the outgoing users is used as the single allocation amount, and the remainder is used as the remaining amount of the maximum rebalancing demand. The allocation amount for each demand amount information is determined based on the single allocation amount and the remaining amount, and the remaining amount to be allocated for each demand amount information is updated after each allocation.

8. The rebalancing method for a payment channel network according to claim 6, characterized in that: The executing of transactions along the loop direction according to the allocated amount to complete the rebalancing operation includes: If the required amount information sent by the leader is different from the actual bill amount to be paid according to the allocated amount, the leader broadcasts the actual bill amount to be paid along the loop direction; If all users in the loop agree on the allocation plan of the amount, transactions are executed along the loop direction starting from the leader to complete the rebalancing operation.

9. A rebalancing device applied to a payment channel network, characterized in that: include: An acquisition module, configured to initiate an invitation from an initiating user in the payment channel network, acquire users participating in the rebalancing operation, and generate a subgraph of the payment channel network according to the participating users; A generation module, configured to generate a maximum rebalancing demand as a value on a corresponding edge in the subgraph through negotiation by users connected to each payment channel in the subgraph according to their own payment capabilities, thereby obtaining a rebalancing demand graph; A construction module, configured to obtain a loop from the rebalancing demand graph and construct a cyclic transaction sequence according to the loop; The transaction module is used to allocate amounts to transactions in the cyclic transaction sequence, execute transactions along the loop direction according to the allocated amounts, and complete the rebalancing operation.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the rebalancing method applied to the payment channel network as claimed in any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • Dynamic network accounting deep payment sub-accounting method and system

    CN108694573A

  • Rebalance strategy execution method for off-chain payment in block chain

    CN111724257A

  • Off-chain channel amount balancing method and system

    CN111768192A

  • Blockchain anonymous transaction method based on cross-node multi-hop payment

    CN112150144A

  • PCN optimal path routing method based on AODV

    CN116032827A