Magma
A lightning liquidity marketplace for interoperable buying and selling of channels.
Introduction
Magma is a liquidity marketplace for the bitcoin lightning network. Users can buy or sell channels from other participants in the magma marketplace. Magma is intended to be simple to use for any lightning node operator without restrictions on the implementation (LND, CLN, Eclair, etc.).
Magma uses "HODL" invoices to create simple smart contracts. This technology enables channel sellers to receive lightning payments only if they open the channel that they agreed to open within a very short timeframe. Additionally, this technology allows Magma to facilitate the transaction without ever taking custody of user funds. Using HODL invoices comes with a few tradeoffs, but the result is that channels need to be opened and confirmed quickly, making this a very responsive market to liquidity needs. For more information, see the section About HODL invoices.
Notifications about the status of Magma offers and orders are provided through @theambossbot on telegram.
Magma Workflow
Compare Offers (buyer)
Create Offer (seller)
Create Order (buyer)
Approve Offer (seller)
Generate Invoice (seller)
Pay Invoice (buyer)
Open Channel (seller)
Additional Topics
Channel Monitoring
Reputation Scores
About HODL Invoices
Compare Offers (shop for channels)
There are many settings available to customize channel sale offers. With each setting, there are tradeoffs: some offers are better for consumers and some are better for merchants.
To simplify options and make it easier to compare offers, we've created a new statistic that compresses several data points into a single figure while making a few assumptions. We're calling our new statistic the LNR or Lightning Network Rate.
Components of the LNR
In short, the LNR is the cost to a merchant for purchasing a channel over a 1 year period (about 52,560 blocks). Here's the calculation:
$$ \textrm{LNR} = \frac{b+mC}{Ct} \times 52,560 $$
$b$=Channel Sale Base Fee (sats)\
$m$=Channel Sale Fee Rate (unitless)\
$C$=Capacity (sats)\
$t$=time (blocks)
The base fee and fee rate are based on the channel sale and DO NOT take into account the routing fee promises. This LNR value can be considered the cost to the merchant.
The minimum and the maximum channel sizes are currently used for the capacity values, providing a range of APRs to be displayed in Magma.
Amboss Fee
Amboss includes a 1% fee for non-subscribers, 0.75% for Node Runners, 0.25% for Builders and all higher tiers have a 0% fee. You can view the pricing (opens in a new tab) page for more details.
Create Offer (sell channels)
Creating an offer means that you are willing to open lightning channels to other magma participants in exchange for lightning payments. A single offer may be used for multiple channel opens or for a single channel open.
A channel seller (channelmonger) can specify the maximum and minimum size channels that they are willing to open to control how many channels will be opened as part of an offer. They can also specify the price at which they will sell the channels.
Channels larger than 0.1677260 BTC (Wumbo) will require that both the seller and receiver have wumbo channels enabled in their configuration files.
To create an offer, the following information is always required:
- Offer Size - How much bitcoin the seller is willing to put on the lightning network as part of this offer.
- Min Size - The smallest channel size that the seller is willing to open.
- Channel Duration - This is the amount of time that the seller promises to keep the channel open. The duration is measured in blocks, which happen about 10 minutes apart, on average. The minimum channel duration is 288 blocks or about 48 hours. Violating this promise will negatively impact the reputation of the buyer and seller.
Optional specifications in the offer:
- Max Size - The largest channel size that the seller is willing to open. See note about Wumbo channels.
- Fee Rate - This is the price that the seller will charge per million sats of capacity in the sold channel. Default is zero.
- Base Fee - This is the sat price that the seller will charge per channel created. Default is zero.
- Max Fee Rate - This is the price that the seller promises not to exceed for routing payments to the buyer. Default is 100 ppm. Violating this promise will negatively impact the reputation of the channel seller.
- Max Base Fee - This is the price that the seller promises not to exceed for routing each payment to the buyer. Default is 100 sats. Violating this promise will negatively impact the reputation of the channel seller.
Create Order (buy channels)
Creating an order means that you are willing to pay a lightning invoice in exchange for a new lightning channel being opened to your node. Multiple concurrent orders may be created at once.
To create an order, review the offer and ensure all the offer details are acceptable. Then, Create an Order.
Next, add the seller's node as a peer to ensure that the seller can open a channel to you. This is especially important if your node is running on Tor.
Then, specify the size of the channel to order subject to the minimum and maximum channel size limitations by the channel seller.
Verify that the total cost estimate is acceptable and create the channel order.
Once the channel order has been created, a notification will be sent to the channel seller to either approve or reject the order.
A notification is sent to the channel seller with a link to approve or reject the order.
Approve Offer (seller)
Channel sellers will receive a notification that an order is waiting to be approved. Review the order details and add the node as a peer, if possible. If it's not possible to connect to the node, reject the offer or contact the node operator to coordinate a connection.
The time between receiving an order being created and accepting or rejecting is recorded for reputation. Responsive node operators are appreciated!
If you accept an offer and aren't able to open the requested channel, your node's reputation will be impacted.
If a seller rejects a buyer, their offers are also excluded from any automated liquidity purchases for that buyer for the next 2 days.
Generate Invoice (seller)
To approve the order, create an invoice that requests the exact amount instructed with an expiry greater than 48 hours (288 blocks). The order summary includes details about the components of the order costs.
Amboss Fee
Amboss includes a 1% fee for non-subscribers, 0.75% for Node Runners, 0.25% for Builders and all higher tiers have a 0% fee. You can view the pricing (opens in a new tab) page for more details.
Routing Fee
The routing fee is the fee that Amboss estimates will be required to forward the order payment to the channel seller. Amboss probes the route to estimate the cost of forwarding the payment and deducts the cost from the channel sale earnings.
Generating an Invoice Using Thunderhub
Generating an invoice can be done using Thunderhub, an open source node manager application. From the Home screen in Thunderhub, click Receive with the lightning bolt symbol.
Set the amount to receive according to the Magma instruction. Include a description to assist with recordkeeping. Set an expiry for the invoice that is greater than 48 hours.
Paste the generated invoice into the Magma dialog to accept the offer.
Once the offer is accepted, a notification will be sent to the buyer.
Pay Invoice (buyer)
Use a lightning wallet of choice to pay the lightning invoice. The payment will hang and will not appear to complete because the payment will be held until the seller opens the requested channel. This is normal. The payment attempt will continue in the background for Thunderhub and the payment dialog can be closed. Once the payment has been initiated, a notification will be sent to the channel seller.
The destination of the lightning payment will show as Amboss.Space node, but the ultimate destination of the payment will be to the channel seller's requested destination. Amboss will force the payment to remain pending until either the time limit expires or the channel is successfully confirmed in the blockchain and validated in the lightning network graph.
Pay Invoice using Thunderhub
To pay the invoice using Thunderhub, navigate to the Home screen and click the Send button with the lightning symbol.
Copy the invoice from Magma into the request dialog. Once the payment has initiated, a notification will be sent to the channel seller. The Thunderhub dialog does not need to remain open and can be safely closed while the payment completes in the background.
The payment will hang when paying this HODL invoice. This is normal. The payment dialog can be closed after the payment is initiated.
Open Channel (seller)
Now that the buyer has a pending lightning payment, it is time to open the requested channel of the given amount. Open the channel using either of the Addresses listed, either the IPv4/6 or the Tor Address and ensure that the size of the channel matches exactly the request as shown in Magma.
The channel must be confirmed before the HODL invoice expires, which is dependent on the payment route. Select a fee rate so that the purchased channel opens quickly; this will also increase the reputation score.
Report Transaction ID and Output (TxID:output)
Once the channel opening transaction has been broadcasted, report the transaction ID and output into Magma. The transaction ID can be found in the pending channel details and may require a browser refresh to be shown.
The transaction output is an additional number after the transaction ID and after a colon that points to the exact output of a transaction. The transaction outputs are integer numbered, beginning with zero.
<Transaction ID>:<Output Number>
To ensure that you've selected the right output number, verify using mempool.space. Adding a colon and an output number to the mempool.space URL will highlight the output.
With a colon and output number added to the mempool.space URL, the selected output number will be highlighted (output 1).
Once the transaction ID and output have been entered, an initial check will be done by Amboss and both the seller and buyer will be notified. When the channel open transaction has received 3 confirmations, Amboss will check the transaction and validate the channel in the lightning network graph. The HODL invoice will typically be processed within 10 minutes of the third confirmation.
Monitor Channel (Magma)
To keep the marketplace fair and honest, Amboss will monitor channels sold in the Magma marketplace. The results of the monitoring will affect each user's reputation.
Channels are monitored for the following characteristics:
- Routing fee rate
- Routing base fee
- Channel open status
- Channel disabled
- Channel peer disabled
Magma Reputation
Reputation is determined by measurable performance in three categories: Reliability, Speed, and Track Record. For more information see the page dedicated to Reputation:
About HODL invoices
Using HODL invoices comes with a few tradeoffs: purchased channels must be confirmed before the HODL invoice expires. HODL invoices have an expiration that depends on the route they take. The HODL invoice must be canceled by Magma or the channels will force close.
HODL invoices will use an HTLC slot while they are open. Each lightning channel can hold a maximum of 483 concurrent HTLCs before the lightning channel becomes non-functional (griefing attack).