Efficient detection method and system for payment channel network fund ratio
By deploying the detection nodes in the payment channel network, the proportion of funds of each node to detect and optimize the payment path, solve the problem of imbalance in funds in the payment channel network, and increase the use of payment success rates and edge nodes.
Patent Information
- Application Number
- CN202411452263.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-17
- Publication Date
- 2025-01-24
AI Technical Summary
There is a problem of fund imbalance in the payment channel network, which leads to frequent participation in payments by central nodes, idle edge nodes, reduced payment efficiency, waste of resources, exhaustion of channels and high payment failure rates.
By deploying the detection node, using a flexible and variable detection strategy to detect the proportion of funds of various channels and channels of each node. Based on the detection results, the path screening is given priority. Balance.
The emergence of the problem of imbalance of funds, reducing additional over time, increasing the success rate of payment, and enhancing the utilization rate and payment efficiency of marginal nodes.
Smart Images

Figure CN119359298A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of electronic payment, and in particular to an efficient detection method and system for payment channel network fund ratio. Background Art
[0002] Blockchain technology is widely used in many fields, especially in the financial field. Decentralization is the most significant feature of blockchain, which is suitable for payment scenarios in finance. Traditional payment networks such as credit cards Visa can support up to 47,000 payments per second, but blockchain cannot efficiently process frequent payments of existing funds.
[0003] In order to cope with such complex and numerous fund change scenarios, it is urgent to improve the scalability of blockchain. The most effective proposal is the Payment Channel Network (PCN), which transfers payments to the off-chain. When users make payments, they can choose to establish a payment channel with another user or company account. Both parties lock a certain amount of funds as collateral through smart contracts. No matter how many payments are made later, the funds will only change in the channel. Finally, when both parties no longer trade, the channel will be closed and the fund information will be put on the chain. In this process, no matter how many payments are made in the middle, they can be completed quickly, and the entire process in the middle does not need to be recorded on the blockchain. Only the starting state and the final state of the funds need to be put on the chain, which is much more efficient than traditional blockchain payment technology.
[0004] In the case of multiple users, multiple channels will be established, which form a payment channel network. Payments can occur between any two users, and even if they are not connected, they can find a path to make payments. At present, the more complete payment channel networks are the Lightning Network (The bitcoin lightning network: Scalable off-chain instant payments, 2016) and the Raiden network (A review on scalability of blockchain, 2020). Both improve the scalability of the blockchain, allowing users to make fast and multiple payments at low or negligible costs. In the design of the Lightning Network, the capacity of each payment channel, that is, the total amount of mortgage funds and the IP address of each node in the payment channel network, are made public, but the balance of each node in its own channel is private. This design is to protect the privacy of users, improve payment efficiency, and not disclose the balance of users' funds. The onion routing protocol is used in the entire payment process. Onion routing is a technology for anonymous communication on a computer network. In an onion routing network, messages are encrypted layer by layer into onion-like data packets and sent through a series of network nodes called onion routers. Each onion router decrypts the outermost layer of the data packet until the destination, where the last layer is decrypted. The destination can then obtain the original message. Because of this series of encrypted packaging, each network node (including the destination) can only know the location of the previous node, but cannot know the entire sending path and the address of the original sender. In other words, no matter how many intermediary users there are between the payer and the payee, they will not know who pays whom. They only know that the previous user has received the payment and that the payment should be forwarded to the next user. Considering that there is still a small amount of fees for intermediary users, most routing algorithms use the shortest path algorithm.
[0005] However, there are certain defects in the current research on payment channel networks. Although the changes in funds do not need to be put on the chain, the initial and final fund statuses need to be put on the chain. Due to the frequent and uncertain changes in funds, if a user needs a large amount of funds to pay, the funds in his channel will quickly become unbalanced. The most direct solution to the imbalance problem is to close and re-establish the channel, which takes a lot of time and money. In short, the payment channel network has the following problems: 1. The payment path generally adopts the shortest path algorithm, which makes the nodes in the center frequently used for fund payment. The nodes at the edge will be idle, which will lead to a decrease in payment efficiency and waste of resources.
[0006] 2. Central nodes frequently participate in payments. Unbalanced fund payments will lead to the problem of payment channel exhaustion, that is, the total amount of funds flows to one party of the channel, and the other party holds less or even close to 0 funds. At this time, if the payment direction from the party with less funds to the party with more funds is chosen, it is very easy to cause delivery failure. If the proportion of channel exhaustion in the payment channel network is high, a large number of payments cannot be completed smoothly.
[0007] 3. For privacy protection, the balance of users in the channel is not public, that is, it is impossible to know the selected path and whether the intermediate users have enough funds to pay. The shortest path algorithm only considers the number of channels, and the planned path may be insufficient, resulting in a decrease in the payment success rate.
[0008] In response to these problems, many studies have made certain improvements, such as using funds transfer to solve the imbalance problem (Shaduf: Non-Cycle Payment Channel Rebalancing, 2020). Although these methods solve the imbalance problem to a certain extent, they also bring additional time overhead and require re-chaining and re-enacting smart contracts. In addition, these rebalancing methods can only solve the imbalance problem, and issues such as edge node utilization, efficiency, and payment success rate remain to be resolved. To solve these problems, the imbalance problem should be avoided from the source, rather than waiting for the imbalance problem to occur before solving it. Summary of the invention
[0009] The present invention provides an efficient detection method and system for the capital ratio of a payment channel network, which can avoid imbalance problems by detecting them in advance, thereby reducing extra time expenditure and improving the success rate of payment by avoiding imbalance problems.
[0010] An efficient detection method for the capital ratio of a payment channel network, comprising: In the deployment phase, users are used as central nodes to establish channels between users to form a payment channel network. The number of detection nodes is set according to the size of the network. The detection nodes establish payment channels with the selected nodes. In the detection phase, the detection node selects a detection strategy to detect the capital ratio of each node and each channel; During the path processing phase, based on the shortest path algorithm, path screening is performed according to the funding ratio of each channel, and channels with balanced funding ratios are prioritized to maintain the balance of the payment channel.
[0011] The core principle of the present invention is to use detection nodes to adopt flexible and variable strategies to detect channel funds, select paths based on the detected results, avoid nodes with insufficient funds, and thus greatly improve the payment success rate.
[0012] During the deployment phase, the central node has multiple channels and participates in a large number of payment processes; the detection node knows the information of all other detection nodes, and the detection node prioritizes establishing payment channels with nodes that have more channels and more total channel funds.
[0013] During the deployment phase, after the user successfully establishes a payment channel, its legitimacy is verified. The verification content includes the user's identity, whether the amount of funds is correct, and whether the channel is operating normally. When these verification conditions are met, it enters the detection phase.
[0014] During the detection phase, detection nodes continuously initiate false payments (i.e. invalid payments) to each other to see if the payments can reach the payee for verification. During this detection process, the detection strategy is configured according to the specific scenario, and the amount of false payments is gradually increased to quickly detect the proportion of funds in the channel.
[0015] When false payments are made between detection nodes, the detection payment will fail by returning an incorrect ciphertext or exceeding the set time to ensure that the funds of the payer and the payee will not change.
[0016] Exploration strategies include linear growth, binary search, and progressive binary search; Among them, the linear growth strategy is suitable for situations where the capital range is not large and the channels are relatively balanced (that is, the capital of a single channel is less than 1,000 and more than 80% of the channels are balanced); the binary search strategy is suitable for situations where the capital range is large and the channels are unbalanced (the capital of a single channel is greater than 10,000 and at least 50% of the channels are unbalanced), thereby reducing the number of detections; the progressive binary strategy is a combination of the two. First, the linear growth strategy is used to determine whether the channel funds are unbalanced. If balanced, the binary search strategy is used to quickly find the channel's capital ratio.
[0017] During the path processing stage, if a channel with a balanced capital ratio cannot be found, the party with a larger capital ratio will be selected as the payee, and the party with a smaller capital ratio will be selected as the payee.
[0018] After path screening, the path information needs to be updated to the payment channel network. After the payment is initiated, it is completed through the screened path, thereby maintaining a balanced payment channel network in real time.
[0019] An efficient detection system for payment channel network fund ratio includes a memory and one or more processors, wherein the memory stores executable code, and when the one or more processors execute the executable code, they are used to implement the above-mentioned efficient detection method.
[0020] Compared with the prior art, the present invention has the following beneficial effects: 1. By introducing detection nodes, the proportion of funds in the payment channel can be known in advance without delaying the payment of other central nodes. When the proportion of funds is known, the optimal path selection is made to maintain the balance of the overall channel without spending time and money on rebalancing.
[0021] 2. Taking the balance of the channel into consideration, all nodes will participate in the payment, solving the problem of unchanged funds at edge nodes. Edge nodes will also participate in the payment when the central node is unbalanced, thereby increasing the participation of nodes.
[0022] 3. Since the channel fund ratio is detected in advance, the selected path fund ratio must meet the payment needs, which greatly improves the success rate of payment. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 The present invention is a flow chart of an efficient detection method for payment channel network fund ratio.
[0024] Figure 2 The present invention is a schematic diagram of an efficient detection system for payment channel network fund ratio. DETAILED DESCRIPTION
[0025] The present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be pointed out that the embodiments described below are intended to facilitate the understanding of the present invention and do not have any limiting effect on the present invention.
[0026] like Figure 1 As shown, an efficient detection method for the capital ratio of the payment channel network is provided, wherein step ① is to detect nodes, select nodes and establish payment channels, step ② is to authenticate and join the payment channel network, step ③ is to perform channel detection, step ④ is to perform path screening based on the detected information, and the last step ⑤ is path optimization processing.
[0027] Specifically, the whole process includes the following steps: Step 1: First, the detection node establishes a payment channel with the selected node and puts the funds of the channel on the chain. In order to detect as many channels as possible in the future, the payment channel should be established with the node with more channels and more funds.
[0028] Step 2: After the user successfully establishes the payment channel, the legitimacy is verified. The verification content includes the user's identity, whether the amount of funds is correct, and whether the channel is operating normally. Only when these conditions are met can the next step of detection be carried out.
[0029] Step 3. When the above preparations are completed, the detection node can start working. The detection nodes will continuously send false payments to each other. This payment will not cause changes in funds, that is, the funds of the payer and the payee will not change. However, if the payment fails in the middle channel, it means that the funds in the middle channel are lower than the amount of false payment. This method can be used to detect the approximate fund ratio of the channel. During this detection process, the detection strategy can be flexibly configured: linear growth, binary search, and progressive growth. The detection strategy refers to how to gradually increase the amount of false payments to quickly detect the fund ratio of the channel.
[0030] Step 4: When the detection node completes the detection work, the capital ratio of the payment channel can be detected. Based on the shortest path algorithm, the path is screened according to the capital ratio of each channel, and balanced channels, that is, channels with a more even capital ratio, are prioritized. If a balanced channel cannot be found, a channel that will become more balanced after payment is selected, that is, the channel with a larger capital ratio is the payer, and the channel with a smaller capital ratio is the payee.
[0031] Step 5: After path screening, the path information needs to be updated to the payment channel network. Payments are initiated through these optimized paths, so that a payment channel network that is as balanced as possible can be maintained in real time.
[0032] The present invention aims to solve the problem of channel fund imbalance in the payment channel network. The difference is that the problem is solved by preventing imbalance, rather than waiting for imbalance to occur before balancing funds. By deploying detection nodes, the detection nodes will be connected to nodes with a large number of channels and a lot of funds, and a variety of detection strategies are suitable for different scenarios. Linear growth corresponds to the scenario where the node scale is small and the funds are not much, while the binary search corresponds to the scenario where the node scale is large and the funds are large and the imbalance state is less, and the final progressive binary search corresponds to the scenario where the node scale is large and the funds are large and the imbalance state is more. The main reason for the imbalance of channel funds is that in the absence of knowing the proportion of channel funds, multiple payments are constantly made from a certain payer of the channel to the payee, and this payment is always one-way, resulting in the rapid depletion of the payee's funds. The detection method of the present invention can detect the proportion of channel funds, and on this basis, perform path optimization, and give priority to the channel direction from more to less funds, thereby balancing the proportion of channel funds. At the same time, due to path optimization, edge nodes will also participate in the payment, thereby increasing the participation rate of nodes. Payments in the payment channel network may fail due to an imbalance in the proportion of channel funds. However, after the proportion of channel funds is ascertained, the selected channel funds must meet the payment requirements, thereby increasing the success rate of payment.
[0033] An embodiment of the present invention also provides an efficient detection system for payment channel network fund allocation, including a memory and one or more processors, wherein executable code is stored in the memory, and when one or more processors execute the executable code, the efficient detection method of the above embodiment is implemented.
[0034] Specifically, the present invention uses Go language to implement this detection system, such as Figure 2 As shown, the system is mainly divided into three modules: deployment module, detection module and path module, which correspond to the three stages of design respectively.
[0035] The deployment module is mainly used to distinguish and deploy nodes. When a new user joins the payment channel, it will be marked as central, which means that normal payment will be made according to the optimized path. The detection work is handed over to the pseudo nodes created by the system. These nodes are marked as detective and have a certain life cycle. When the detection work is completed, these pseudo nodes will be cancelled. It is worth noting that the detection nodes are created by the detection system, so they can know each other's information, which is convenient for payment channel detection.
[0036] The detection module uses the detection nodes provided by the deployment module to detect the proportion of funds in the channel. After selecting the appropriate detection node, false payments will be made continuously. The payer and the payee will make payments through the channel of the middle user. The payment path will be paid according to the smart contract HTLC (hash time lock). The hash time lock mainly consists of two parts: the hash lock, which uses the hash function of asymmetric encryption to convert a string of input ciphertext into a 256-bit fixed-length output. The correct ciphertext must be entered when paying to unlock the funds; the time lock is to set an alarm in the payment script, and the private key must be used to unlock the funds after the set time. Therefore, when transactions are conducted between detection nodes, we can make the detection payment fail by returning the wrong ciphertext or exceeding the set time to ensure that the funds in the detection channel do not change. The key attribute of the detection payment is the fee, that is, the payment fee. The fee can be changed by setting the detection strategy: linear growth, binary search, and progressive binary search to quickly detect the proportion of channel funds.
[0037] The three detection strategies for false payments set by the present invention will be marked as linear, binary and re-binary in the detection, and both detection nodes will perform detection according to the strategy. There may be multiple channels between two nodes, and multiple false payments will be gradually detected.
[0038] The path module performs path screening and path optimization based on the channel fund ratio information provided by the detection module. Existing work mostly uses the shortest path for path screening. The biggest problem with this method is that the selected path may have insufficient channel funds, resulting in payment failure. Based on the detected channel fund ratio, the path module uses the optimal path to screen the path, that is, to select a path that is as short as possible and has balanced channels in the path. If such a path does not exist, a channel with a more balanced fund ratio after payment is selected. The path screened in this way will be used as an optimized path for subsequent payments.
[0039] Analyze the actual system overhead and payment success rate. Since detection will not actually interfere with normal payment, this part of the time overhead will not cause any impact. As shown in Table 1, after testing, the average proportion of channels discovered is 90.42%, which means that most channels can be discovered, while a small number of channels are at the edge, with few transactions and little change in the proportion of funds. The time complexity of detection is between O(log n) and O(n), which is in line with expectations, and the payment success rate has also been greatly improved.
[0040] Table 1
[0041] The embodiments described above provide a detailed description of the technical solutions and beneficial effects of the present invention. It should be understood that the above are only specific embodiments of the present invention and are not intended to limit the present invention. Any modifications, supplements and equivalent substitutions made within the scope of the principles of the present invention should be included in the protection scope of the present invention.
Claims
1. An efficient detection method for the capital ratio of a payment channel network, characterized in that: include: In the deployment phase, users are used as central nodes to establish channels between users to form a payment channel network, and the number of detection nodes is set according to the size of the network; The detection node establishes a payment channel with the selected node; In the detection phase, the detection node selects a detection strategy to detect the capital ratio of each node and each channel; During the path processing phase, based on the shortest path algorithm, path screening is performed according to the funding ratio of each channel, and channels with balanced funding ratios are prioritized to maintain the balance of the payment channel.
2. The efficient detection method for payment channel network fund ratio according to claim 1 is characterized in that: During the deployment phase, the detection node will prioritize establishing payment channels with nodes that have more channels and more total channel funds.
3. The efficient detection method for payment channel network fund ratio according to claim 1 is characterized in that: During the deployment phase, after the user successfully establishes a payment channel, its legitimacy is verified. The verification content includes the user's identity, whether the amount of funds is correct, and whether the channel is operating normally. When these verification conditions are met, it enters the detection phase.
4. The efficient detection method for payment channel network fund ratio according to claim 1 is characterized in that: During the detection phase, detection nodes continuously initiate false payments to each other to see if the payments can reach the payee for verification. During this detection process, the detection strategy is configured according to the specific scenario, and the proportion of funds in the channel is quickly detected by gradually increasing the amount of false payments.
5. The efficient detection method for payment channel network fund ratio according to claim 1 is characterized in that: When false payments are made between detection nodes, the detection payment will fail by returning an incorrect ciphertext or exceeding the set time to ensure that the funds of the payer and the payee will not change.
6. The efficient detection method for payment channel network fund ratio according to claim 1 is characterized in that: Exploration strategies include linear growth, binary search, and progressive binary search; Among them, the linear growth strategy is suitable for the situation where the funds of a single channel are less than 1,000 and more than 80% of the channels are balanced; the binary search strategy is suitable for the situation where the funds of a single channel are greater than 10,000 and at least 50% of the channels are unbalanced, thereby reducing the number of detections; the progressive binary strategy is a combination of the two. First, the linear growth strategy is used to determine whether the channel funds are unbalanced. If balanced, the binary search strategy is used to quickly find the channel's fund ratio.
7. The efficient detection method for payment channel network fund ratio according to claim 1 is characterized in that: During the path processing stage, if a channel with a balanced capital ratio cannot be found, the party with a larger capital ratio will be selected as the payee, and the party with a smaller capital ratio will be selected as the payee.
8. The efficient detection method for payment channel network fund ratio according to claim 1 is characterized in that: After path screening, the path information needs to be updated to the payment channel network. After the payment is initiated, it is completed through the screened path, thereby maintaining a balanced payment channel network in real time.
9. An efficient detection system for payment channel network capital ratio, characterized in that: It comprises a memory and one or more processors, wherein the memory stores executable codes, and when the one or more processors execute the executable codes, they are used to implement the efficient detection method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Path selection method of block chain payment channel network
CN110223055A
Off-chain payment center routing method and system based on block chain, medium and equipment
CN112258171A
Method, node and system for exposing balance of lightning network payment channel
CN113869897A
Deterministic routing algorithm and system for high-concurrency payment channel network
CN117459446A
Method and system for preventing network imbalance of payment channel based on reinforcement learning
CN117495364A