Skip to content

Instantly share code, notes, and snippets.

@sshmatrix
Last active April 4, 2023 03:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sshmatrix/59fccb1279ffe5f0d548f31c5c544246 to your computer and use it in GitHub Desktop.
Save sshmatrix/59fccb1279ffe5f0d548f31c5c544246 to your computer and use it in GitHub Desktop.
Set LUD-06 identifier on ENS domain and receive BTC over ⚡ Lightning Network

Receive BTC over ⚡ Lightning Network to .eth LUD-06 identifier via RFC 8615 .well-known standard

author(s): 0xc0de4c0ffee, sshmatrix

Disclaimer: Only tested with ln.tips Lightning wallet

Pre-requisites:

a) Your ENS domain mydomain.eth accessible via a public gateway, e.g. .limo. Your LUD-06 identifier then reads like username@mydomain.eth.limo

b) A Lightning wallet to receive BTC via mydomain.eth.limo

  • Pro Tip 1: Try ln.tips by pinging @LightningTipBot on Telegram. Your Lightning wallet name should then be username@ln.tips on Telegram. This is where you will receive your BTC sent over Lightning network to mydomain.eth.limo
  • Pro Tip 2: Typical wallet name format used by Lightning providers is username@lightning.wallet

c) Another Lightning wallet to send BTC to mydomain.eth.limo

Set Records on ENS :

Once you have the prerequisites ready, follow these steps:

d) Create a directory myfolder anywhere and the following folders inside it: myfolder/.well-known/lnurlp/

e) Create a file named username (without any extension) inside the newly created folder myfolder/.well-known/lnurlp/, and populate it with content using the following template:

{
  "status":"OK",
  "callback":"https://lightning.wallet/.well-known/lnurlp/username",
  "tag":"payRequest",
  "maxSendable":45000000,
  "minSendable":1000,
  "commentAllowed":150,
  "metadata":"[[\"text/plain\", \"Pay to username@mydomain.eth\"], [\"text/identifier\", \"username@lightning.wallet\"]]"
}

Please replace the value of username, mydomain.eth and lightning.wallet appropriately.

f) Upload folder myfolder/ to IPFS and host your mydomain.eth content over IPNS instead of IPFS. This is critical in implementing RFC 8615 standard (example)

  • Pro Tip 5: Use dWebServices to pin your IPNS key for free. Populate your IPNS key with the IPFS hash of hosted directory myfolder/ (example)
  • Pro Tip 6: Use Pinata to host your directory for free and get its IPFS hash (example)

🥳 Voila! This should work. You should now be able to receive ⚡ Lightning BTC with your LUD-06 identifier username@mydomain.eth.limo 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment