Skip to content

Latest commit

 

History

History
54 lines (38 loc) · 2.23 KB

README.md

File metadata and controls

54 lines (38 loc) · 2.23 KB

Lightning to Email

Redirect lightning payments from your email address + ".ln2.email" to your current lightning wallet.

Deployment Instructions

  1. Sign up to an email service like Amazon SES. This will be your SMTP_SERVER.
  2. Generate a random secret here. This will be your NEXTAUTH_SECRET.
  3. Configure your MongoDB URI in MONGODB_URI.
  4. Configure PROJECT_ID_VERCEL and AUTH_BEARER_TOKEN to automatically add users' email-addresses' domains as subdomains, using Vercel domains api.

Vercel + MongoDB Integration

https://vercel.com/integrations/mongodbatlas

Tech Stack

FAQ

How does ln2.email redirection work behind the scenes?

When a lightning wallet wants to pay to a lightning address like "[email protected]", it sends an HTTP request to https://somedomain.com/.well-known/lnurlp/someuser, to get technical details for how to proceed with the payment.

When a user signs in with email like "[email protected]", and configures his lightning address "[email protected]", he gets a new lightning address "[email protected]" that redirects the HTTP requests: any HTTP request to https://mailserver.com.ln2.email/.well-known/lnurlp/johndoe responds with a 307 Redirect to https://somedomain.com/.well-known/lnurlp/someuser, and the payment continues from there.

This way ln2.email never holds users' funds at any point.

Why aren't onion addresses supported?

Most lightning wallets do support paying to onion lightning addresses (that look like "[email protected]"), which are common in personal nodes whose owner don't want to buy a domain.

Unfortunately, when our server replies with a 307 Redirect to an onion address, most wallets simply break. We have decided to block this capability until most wallets will support the redirection.