First thing’s first, I want to thank Jack Chakany for putting me onto this method in the first place with his initial writeup. I wouldn’t have explored this simple method at all without reading that initial post.
I have improved upon it in three main areas:
- Applying it to NIP-05 as well as Lightning Addresses
- Support for multiple Lightning Addresses
- Support for multiple NIP-05 identities
This only involves some small tweaks to the initial method, but I will provide a full tutorial for both here as it’s quite a simple process. If the structure of the URLs confuses you, refer to the original post which goes into a little more detail into the “decontructed” addresses.
As with the initial guide, the only things you need are your own domain and the ability to connect that domain to Cloudflare. And… that’s it.
Lightning Addresses
So you got a Lightning address like xanny@getalby.com
which is cool and everything but what if you also own a domain and would rather it pointed to that? And furthermore, what if a friend sees you flexing it and asks if they can have theirs under your awesome domain too? I got you covered on both counts!
Fire up Cloudflare Dashboard and choose the domain you wanna use. Now hit the little arrow next to “rules” and hit “redirect rules” and make a new one.
Name it whatever you want, but probably best to make it something descriptive.
Now on the first section under “When incoming requests match…” you just do this:
- Change “Field” to “URI Path”
- Change “Operator” to “equals”
- Change “Value” to
/.well-known/lnurlp/[your wallet name]
You must make sure the last part matches your wallet’s username (the first half before the @
) perfectly. Since in my case it’s xanny@getalby.com
I put /.well-known/lnurlp/xanny
.
Now under the second section with the “Then…” header:
- Change “Type” to “Static”
- Change “URL” to
https://[the domain your wallet is at now]/.well-known/lnurlp/[wallet username]
- Change “Status code” to “307”
- Tick “Preserve query string”
Again, I can’t stress this enough, make sure the domain and username both match exactly! To use my own as an example again, the URL is https://getalby.com/.well-known/lnurlp/xanny
because the Lightning Address is xanny@getalby.com
- this must match EXACTLY or it won’t work and could even point to someone else’s wallet!
Hit deploy and you’re done! Your new address is [wallet username]@yourowndomain.tld
, in my case xanny@xanny.family
.
Make sure to test it out before publishing it! Either get a friend to zap a small amount of sats to the new address or send some sats to ln.tips which operates through a Telegram bot, or another wallet you might have setup, or your own node if you run one, then send them back to your new LN address.
If it all works as normal, you’re gucci! If there’s a problem, double check the settings and make sure you put everything in exactly right!
How is this better than the original method? Because you defined the exact username to redirect in the first step, you can set this up in the exact same way for other wallets as well!
Nostr NIP-05 Identity Verification
As above, go to “redirect rules” under the domain you wanna use and make a new rule.
Now on that first section that says “When incoming requests match…” here’s what you’ll wanna do:
- Change “Field” to “URI Query String”
- Change “Operator” to “equals”
- Change “Value” to
name=[your NIP-05 username]
So in my case it’s of course name=xanny
- make sure it matches the username you registered on your existing service you wanna redirect exactly.
Now under the second section that says “Then…” just change set it like this:
- “Type” as “Static”
- “URL” as
https://[your existing NIP-05 provider]/.well-known/nostr.json?name=[your NIP-05 username]
- “Status code” as “307”
- Make sure “Preserve query string” is ticked
Done, hit deploy and change the domain portion on your Nostr profile to your own one and watch it verify successfully!
As with the LN address, you can repeat this process with either alt accounts or your friends’ Nostr accounts if they wanna use your domain!
That’s all folks!
Hope you found this useful! Feel free to follow me on Nostr and zap me some sats if you’re feeling generous!
Here’s my npub if you wanna paste it into your favourite client:
npub17rlc0emedw5xljztfqrmykjaacsx6ujvdas64zznjadrnhhwlavq4jjtgg
PV!