Atomic Multipath Payments (AMP): Splitting Payments Across Multiple Channels

Posted 9 days ago by LN+

Atomic Multipath Payments (AMP) represent a critical advancement in the Bitcoin Lightning Network. By enabling the splitting of payments across multiple channels, AMP increases transaction success rates, improves network efficiency, and enhances scalability. This post explores the technical underpinnings of AMP, its benefits, limitations, and its role in the future of Lightning Network technology.

1. Introduction

1.1. The Lightning Network Overview
The Bitcoin Lightning Network serves as a Layer 2 solution designed to address the scalability issues inherent in Bitcoin’s base layer. By enabling off-chain transactions, the Lightning Network facilitates fast and cost-effective payments without congesting the Bitcoin blockchain. However, the success of these payments is often limited by channel capacity and routing constraints, which is where AMP comes into play.

1.2. The Need for AMP
Traditional single-path payments in the Lightning Network require a single route with sufficient liquidity to complete a transaction. As network usage grows, this approach faces scalability challenges, especially for larger transactions. Atomic Multipath Payments (AMP) solve this problem by allowing payments to be split across multiple channels, increasing the likelihood of successful transactions while utilizing available liquidity more efficiently.

2. Understanding Atomic Multipath Payments (AMP)

2.1. What is AMP?
Atomic Multipath Payments (AMP) is a protocol that enables the splitting of a single payment into smaller parts, each of which can traverse different channels in the Lightning Network. These parts are then reassembled at the receiving node, ensuring that the full amount is delivered securely and atomically.

2.2. How Does AMP Differ from Traditional Payments?
In contrast to single-path payments, AMP breaks down a payment into multiple smaller transactions, leveraging multiple channels at once. Unlike basic multipath payments, AMP guarantees atomicity, meaning either all parts of the payment succeed or none do, mitigating risks such as partial payments or stranded funds.

2.3. The Atomicity of AMP
Atomicity ensures that a payment is either fully completed or fully canceled, with no middle ground. AMP achieves this using cryptographic secrets and shared secrets derived from a base secret, making it impossible for partial payments to succeed independently. This is vital for maintaining trust in the payment system, as it ensures that users never receive incomplete transactions.

3. Technical Mechanics of AMP

Skip this section if you don't care about how AMP works under the hood.

3.1. How Does AMP Work Technically?
AMP relies on the generation of a single payment secret that is used to derive multiple child secrets. Each payment fragment uses a child secret, allowing them to be routed independently. The receiver can only claim the funds when all fragments arrive, using the aggregated secrets to reconstruct the original payment secret.

3.2. Payment Splitting Across Multiple Channels
When using AMP, a single payment is divided into multiple smaller transactions that are routed through different channels. These channels may take completely independent paths through the Lightning Network, thus increasing the chances of finding available liquidity across the network’s vast topology.

3.3. Security Mechanisms in AMP
AMP uses a combination of Hash Time-Locked Contracts (HTLCs) and a keysend mechanism with a payment secret to secure transactions. HTLCs ensure that payments cannot be released until the correct preimage is provided, while timelocks prevent stale or unresolved payments from lingering on the network, protecting both senders and receivers from risk.

4. Benefits of AMP

4.1. For Lightning Users
  • Increased Payment Reliability:  AMP increases the reliability of payments by enabling the use of multiple channels. Even if one channel lacks sufficient liquidity, the transaction can succeed through alternative paths.
  • Ability to Send Larger Payments: One of AMP’s key benefits is that it allows users to send payments larger than the capacity of any single channel. This feature directly addresses one of the main limitations of the traditional Lightning Network.
  • Reduced Transaction Fees: By utilizing more efficient routing across multiple channels, AMP can reduce overall transaction fees, as payments are split across paths with better fee structures.

4.2. For Lightning Node Operators
  • Enhanced Network Liquidity: Node operators benefit from AMP by improving liquidity management. Since payments are divided among several channels, the network’s liquidity is utilized more effectively, allowing nodes to process a larger number of transactions.
  • Increased Routing Opportunities: With AMP, node operators gain more opportunities to route payments, thereby earning additional routing fees. The division of payments opens up more potential paths, increasing node participation in the routing process.
  • Improved Channel Utilization: AMP helps optimize the use of channels, balancing liquidity across multiple channels more effectively, leading to better channel health and longevity.

5. Limitations and Challenges of AMP

5.1. Technical Limitations
While AMP represents a significant step forward, it is not without limitations. The technology still faces constraints in terms of channel balancing and the complexity of managing multiple payment parts across diverse paths.

5.2. Liquidity Requirements
To effectively use AMP, sufficient liquidity must be available across all channels involved in the transaction. If the required liquidity is not present, even AMP payments may fail.

5.3. Privacy Considerations
Splitting payments across multiple channels could expose more transaction data to network participants, raising potential privacy concerns. Ensuring that users’ payment details remain confidential while using AMP is an ongoing challenge.

5.4. Adoption and Compatibility Issues
AMP adoption is not yet universal. Different Lightning implementations and wallets are in various stages of AMP support, creating compatibility issues for some users.

6. Software and Implementations Supporting AMP

6.1. Lightning Implementations
  • LND (Lightning Network Daemon):  LND was one of the first Lightning implementations to support AMP. Its robust feature set and extensive developer community have made it a popular choice for AMP users.
  • Core Lightning (CLN):  Core Lightning, previously known as c-lightning, has integrated AMP support, offering flexibility and configurability for advanced users.
  • Eclair: Eclair has also introduced AMP capabilities, enhancing its role as a Lightning implementation aimed at mobile and lightweight node operators.

6.2. Wallets Supporting AMP
Several wallets, including Phoenix, Breez, Eclair Mobile, Muun, WOS, and Electrum now offer AMP support, making it easier for everyday users to benefit from AMP’s advantages. Thunderhub, Ride the Lightning (RTL) and other tools also support AMP.

7. Enabling AMP on Supported Platforms

Implementing AMP requires specific configurations depending on the Lightning implementation you are using. Below are detailed steps for enabling AMP on LND and Core Lightning (CLN).

7.1. Using AMP in LND
Software Requirements: Ensure that you are running LND version 0.13.0-beta or later, as AMP support was significantly improved in this release.

Configuration Settings: In your lnd.conf file, add or verify the following settings:
[protocol]
amp=1
This setting explicitly enables AMP features.

Restart LND: After updating the configuration file, restart LND to apply the changes:
sudo systemctl restart lnd

Sending AMP Payments using lncli: To send an AMP payment using lncli, use the sendpayment command with the --amp flag:
lncli sendpayment --pay_req=<invoice> --amp

Replace <invoice> with the Bolt11 invoice you wish to pay.

Receiving AMP Payments: To generate an AMP invoice, use the addinvoice command with the --amp flag:
lncli addinvoice --memo="Payment for services" --value=1000 --amp
This will create an invoice that supports AMP payments.
7.2. Using AMP (MPP) in Core Lightning (CLN)
Software Requirements: Make sure you are running Core Lightning version 0.10.1 or later.

Sending AMP Payments using lightning-cli: Core Lightning automatically attempts Multi-Part Payments (MPP) as referred to in CLN, when necessary:
lightning-cli pay <invoice>

Receiving AMP Payments: Create an invoice that supports AMP (MPP) payments by default:
lightning-cli invoice <amount_msat> <label> <description>
Replace <amount_msat>, <label>, and <description> with your desired values.

7.3. Troubleshooting Common Issues

7.3.1. Insufficient Liquidity
Solution: Check your channel balances and consider opening new channels or rebalancing existing ones to ensure sufficient outbound and inbound liquidity.

7.3.2. Incompatible Nodes
Solution: Ensure that the nodes you’re interacting with also support AMP. Compatibility issues can arise if the receiving node does not support AMP payments.

7.3.3. Incorrect Configuration
Solution: Double-check your configuration files for typos or misconfigurations. Ensure that all required flags and settings are correctly applied.

7.3.4. Network Sync Issues
Solution: Verify that your node is fully synced with the Bitcoin network and the Lightning Network graph. Use commands like lncli getinfo (LND) or lightning-cli getinfo (CLN) to check the sync status.

0 Comments

Please login to post comments.

Lightning Network Node
LightningNetwork.Plus
Rank: 8 / Gold
Capacity: 405,174,955 SAT
Channels: 115