This article was translated from Japanese with AI. Read the original (日本語) · Report a translation issue

Payments on the Lightning Network (Lightning from here on) are generally pull payments.

The recipient of the bitcoin issues an invoice and requests payment from the payer, and that request is what sets the transfer in motion.

ライトニングインボイスの中身を理解する:BOLT11の構成要素を1つずつ解説
ライトニングインボイス(BOLT11)とは何か。プレフィックス・金額・タイムスタンプ・タグ付きフィールド・署名まで、Bech32でエンコードされたインボイスの構造と読み方を初心者向けに解説します。

For more on invoices, see this article.

In contrast to pull payments, Lightning also has a more niche feature: push payments. One of these, "Keysend," requires no invoice. The payer can send funds on their own initiative using the recipient's public key.

This article looks at Keysend as one way to send payments over Lightning, covering how it works, how to use it, its use cases and its drawbacks.

How Keysend works and the payment flow

Keysend works in a very simple way. In a normal Lightning payment, the recipient generates the preimage. With Keysend, the payer generates it instead. The payer embeds the preimage in the payment data addressed to the recipient, and the recipient's node, once it receives the payment, can use that preimage to claim the bitcoin.

Here is how it looks in a diagram.

Alice is the payer and Bob is the recipient

Alice creates a preimage and embeds it in payment data that only Bob can read. The payment is locked in each channel by a locking mechanism based on the preimage, the Hashed Time-Locked Contract (HTLC). Bob ends up learning the preimage from the payment data, and by using it to unlock the funds, he completes the payment.

Lightning payment data is nested like a set of matryoshka dolls. Each routing node peels off only the outer layer of data, like peeling an onion, before passing the payment along the chain, which is why this mechanism is called "onion routing."

Thanks to onion routing, routing node A knows only the hops immediately before and after it. It cannot tell where the payment came from or where it is ultimately going, so in the diagram it has no way of knowing that Bob is the final recipient.

How to receive Keysend payments

There are several Lightning node implementations, and they differ slightly depending on their design philosophies and other factors. This article uses one of the most widely used, LND (Lightning Network Daemon), as the example for explaining how to receive and send Keysend payments.

With LND, you can turn Keysend on or off by editing the lnd.conf file as shown below.

accept-keysend=true

accept-amp=true
💡
AMP stands for Atomic Multi-Path Payments. It lets a single payment be split across multiple routes, each using a different preimage and payment hash. Only once the recipient has collected every part is the secret value (the root seed) reconstructed, and the whole payment then completes at once.

If you prefer to configure it through a GUI, it looks like this.

Advanced settings screen of an LND node

If you just want to enable Keysend itself, accept-keysend=true is all you need. If you want to improve the success rate of payments by receiving larger amounts split into multiple parts, it's a good idea to enable AMP as well.

How to send Keysend payments

In LND, you can send a Keysend payment with the following command.

lncli sendpayment --dest <destination public key> --amt <amount> --keysend

Put the recipient node's public key in destination public key and the amount, in sats, in amount.

If you need to find a Lightning node's public key, you can search for node information on amboss.space, so give it a try.

If you want to use AMP, the command is as follows.

lncli sendpayment --dest <destination public key> --amt <amount> --amp

To attach a message, use the --data flag. The --data flag takes the form <record_id>=<hex_value>, and the record ID commonly used for messages is 34349334.

For example, to attach the message "bitcoin-research," you encode it as UTF-8 bytes, convert that to hexadecimal as 626974636f696e2d7265736561726368, and build the following command.

lncli sendpayment --dest <destination public key> --amt <amount> \
--data 34349334=626974636f696e2d7265736561726368 --keysend

For more details on record IDs, see here.

Four Keysend use cases

So what can Keysend actually be used for? Here are four examples.

Tips and donations

Tips and donations are probably the most obvious use case. Not needing an invoice is very useful for creators, open source developers, streamers and others who accept tips in bitcoin.

On the other hand, because you have to handle public keys, input mistakes can happen, so in terms of UX I think Lightning Addresses have the edge.

LNURLとは?QRコードとLightning Addressでビットコイン支払いができる仕組みを解説
本記事ではLNURLやLightning Addressが使われるようになった理由や、送金・受金においてどのように内部処理が行われているかの詳細な仕組みについてを解説します。LN送金・受信のサービス提供や実装を検討している事業者やエンジニアの方は必読です。

For more on Lightning Addresses, see this article.

Advertising and promotion

It is a bit of a nuisance for recipients and the network, but Keysend is also used for advertising and promotion. Advertisers don't care who the recipients are, so Keysend, which lets you send a payment with nothing but a public key, is a perfect fit.

There are downsides: network bandwidth gets used for mysterious ads, and recipients' inbound liquidity gets used without their permission. Still, some people probably take the view that there's nothing wrong with it, since the advertisers are paying real money to run those ads.

If you don't want to receive unsolicited payments, you can simply turn off receiving in your settings, so I think it's best left up to each user.

Streaming sats (Podcasting 2.0)

I only learned about this use case myself while writing this article: there appear to be systems in which a listener automatically keeps sending small amounts of bitcoin at regular intervals while playing audio or video.

Podcasting 2.0 is an open specification led by Podcast Index. Its goal seems to be letting all the information about a show be distributed across the podcast ecosystem without being owned by any particular app or hosting company.

Keysend also supports custom records, so you can attach metadata such as the show name and playback position. I think that's what makes it such a good fit.

It can apparently be used on Fountain, which also lets you log in with Nostr, so if you're curious, give it a try.

Fountain for Podcasters
Podcast hosting, clips, social posting and analytics in one place, run from the dashboard or from Claude and ChatGPT. Connect the feed you have, or host with us.

Rebalancing

Adjusting channels whose balances have become lopsided is called rebalancing, and rebalancing by paying yourself so that liquidity moves around in a loop is called a circular rebalance.

Node operators can use Keysend to perform a circular rebalance. That said, rebalancing with Keysend isn't the usual approach; I've included it simply as one possible use case.

A normal circular rebalance is done either manually with lncli or with a dedicated tool such as BoS. For details, see the earlier article below.

LNにおけるInbound Capacityの獲得方法8選
Lightning NetworkでInbound Capacityの不足を解消したい方やルーティングノード運用者向け。チャネル購入やリバランス、PeerSwapなど具体的な獲得方法8選を解説。ノード運用スタイルに合わせた最適な流動性管理の戦略が見つかります。

Keysend limitations and security considerations

Finally, here is a brief summary of several concerns specific to Keysend.

Limitations from not having an invoice

Because the payment is sent unilaterally using a preimage the payer created, there is no formal invoice. As a result, there's no way to prove to a third party that the payment went through, and there's no receipt either.

Take, for example, buying a product from an online store.

If the store operator claims that "the payment hasn't gone through," with a normal invoice payment you can present "the invoice signed by the store" and "the preimage you received when the payment completed." Since the store sends the preimage when the payment completes, combining it with the invoice serves as proof of payment.

With Keysend, however, the sender created the preimage themselves, so they would have it in hand even if they never paid. In other words, the sender presenting the preimage is not evidence of payment, and since there's no invoice signed by the store either, there's no way to prove the payment objectively.

In addition, invoices have a mechanism for detecting input errors, but with Keysend you handle the destination public key directly, so there's nothing to catch a typo. That said, if the destination is a public key that doesn't exist or a node that doesn't support Keysend, the payment simply fails, so no funds are lost. The case to watch out for is accidentally copying the public key of a different node that does exist. In that case the payment will go through, and you can't get it back.

It consumes inbound liquidity

Inbound liquidity plays a very important role in running a routing node. Keep in mind, though, that enabling Keysend means your inbound liquidity can be consumed by payments from anyone.

Nodes with only private channels have trouble receiving Keysend payments

A Keysend payer finds a route based on publicly announced channel information. So a node that has no public channels and runs only private channels normally cannot receive Keysend payments from third parties. To pay such a node, the usual approach is for the recipient to issue an invoice that includes route hints (information about its private channels).

However, a normal invoice can be used only once, so the recipient has to issue a new one for every payment, and the payer can't send freely the way they can with Keysend. LND offers a workaround: if you issue an AMP invoice that includes route hints (lncli addinvoice --amp --private) and publish it, the same invoice can be paid any number of times until it expires, which gives you something close to Keysend (the payer also needs to support AMP).

Potential for more spam

Because payments can be sent without permission, Keysend can also be used for spam. If you're worried about unwanted payments and messages bloating your node's database, it's wise to turn off receiving in your settings.

Not part of the BOLT specifications

Keysend actually started out as an experimental feature in LND, so it has not been standardized as a BOLT, and implementations differ slightly. However, since it's used by several implementations, including Core Lightning and LDK, its specification is now documented in a bLIP, a framework that complements the BOLTs.

bLIP-3, "Keysend," has a status of Active, and it explicitly states that its purpose is to document a scheme that is already widely used, so that new implementations don't have to reverse-engineer existing ones.

blips/blip-0003.md at master · lightning/blips
Bitcoin Lightning Improvement Proposals . Contribute to lightning/blips development by creating an account on GitHub.

Summary

Keysend is a push-payment feature that lets you send funds over the Lightning Network using only a public key, without an invoice from the recipient. Reversing the usual process, the payer generates the preimage and embeds it in the payment data addressed to the recipient, and the recipient uses it to unlock the funds, completing the payment.

In LND, you can enable receiving with accept-keysend=true and send with lncli sendpayment --keysend. Use cases that take advantage of being able to send easily without an invoice include tips and donations, advertising and promotion, streaming sats (Podcasting 2.0), and circular rebalancing.

On the other hand, keep in mind that there's no receipt and no way to prove payment, that it consumes inbound liquidity, that nodes with only private channels have trouble receiving Keysend payments, that it can be used for spam, and that it isn't standardized as a BOLT, so implementations differ.