mandatory
author: calle
Minting tokens is a two-step process: requesting a mint and minting the tokens. Here, we describe the first step. A wallet requests the minting of tokens in exchange for paying a bolt11 Lightning invoice (typically generated by the mint to add funds to its reserves, and typically paid with another Lightning wallet).
To request the minting of tokens, a wallet Alice
sends a GET /mint?amount=<amount_sat>
request with the requested amount <amount_sat>
in satoshis. The mint Bob
then responds with a Lightning invoice.
Request of Alice
:
GET https://mint.host:3338/mint?amount=1000
With curl:
curl -X GET https://mint.host:3338/mint?amount=1000
Response of Bob
:
{
"pr": "lnbc100n1p3kdrv5sp5lpdxzghe5j67q...",
"hash": "67d1d9ea6ada225c115418671b64a..."
}
with pr
being the bolt11 payment request and hash
is a random hash generated by the mint to internally look up the invoice state. Note: hash
MUST NOT be the bolt11 invoice hash as it needs to be a secret between mint and user. This is to prevent a third party who knows the bolt11 invoice from stealing the tokens when the invoice is paid (See NUT-04). hash
MUST be url-safe since we use it in a URL as described in NUT-04.
A wallet MUST store the hash
and amount_sat
in its database to later request the tokens upon paying the invoice. A wallet SHOULD then present the payment request (for example via QR code) to the user such that they can pay the invoice with another Lightning wallet. After the user has paid the invoice, a wallet MUST continue with NUT-04 (minting tokens).