Hermes is an asynchronous lightning address server that uses Fedimint Ecash on the backend. The protocol flow of Hermes is as follows:
Note: The Hermes server does not receive the ecash (unless it's lying and giving its own invoices and not following the protocol at all, which it might be doing if malicious or compromised. It's a Lightning Address not magic.), it is locked as a Fedimint Lightning Gateway Contract to the User's Pubkey. It doesn't even need to send you the notification, your Fedimint Client can scan for the payment on its own. The notification just makes the scan faster by telling the client to look for a specific payment or set of payments.
-
Users register their Nostr public key and username with the Hermes server. This registration process creates a lightning address for the user.
-
The registration requires a small fee in ecash or lightning.
-
Sender follows normal lnurlp protocol hitting well-known and callback endpoints.
-
Hermes server creates a Fedimint Lightning Gateway transaction based off the receiver's public key, and returns the invoice to the sender via the callback endpoint.
-
Sender pays the lightning invoice, which the lightning gateway immediately completes by locking ecash to the receiver's public key.
-
Hermes server sends a notification to the receiver that they have received a payment.
-
When the receiver's Fedimint Client next connects to their federation, they scan for the payment and reissue the pubkey locked ecash.
Current implementation is a bit different (Hermes receives the ecash and sends the notes to you), but the above is the goal to be purely a messenger vs a passthrough custodian and is pending a few changes to the Fedimint Client.
-
Clone the repository and ensure that Rust and Docker are installed on your system.
-
Start the Postgres database by running
docker compose up -d
. Remember to change the username and password in thedocker-compose.yaml
file. -
Set the environment variables in the
.env
file. Refer toexample.env
for guidance. -
Start the Hermes server by running
cargo run
.