mirror of
https://github.com/aljazceru/nutshell.git
synced 2025-12-21 02:54:20 +01:00
52 lines
1.5 KiB
Markdown
52 lines
1.5 KiB
Markdown
# NUT-3: Request mint
|
|
|
|
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.
|
|
|
|
## Example
|
|
|
|
Request of `Alice`:
|
|
|
|
```http
|
|
GET https://mint.host:3338/mint&amount=1000
|
|
```
|
|
|
|
With curl:
|
|
|
|
```bash
|
|
curl -X GET https://mint.host:3338/mint&amount=1000
|
|
```
|
|
|
|
Response of `Bob`:
|
|
|
|
```json
|
|
{
|
|
"pr": "lnbc100n1p3kdrv5sp5lpdxzghe5j67q...",
|
|
"hash": "67d1d9ea6ada225c115418671b64a..."
|
|
}
|
|
```
|
|
|
|
with `pr` being the bolt11 payment request and `hash` the hash of the invoice. 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 #4 - Minting tokens [TODO: Link to #4].
|
|
|
|
[00]: 00.md
|
|
[01]: 01.md
|
|
[02]: 02.md
|
|
[03]: 03.md
|
|
[04]: 04.md
|
|
[05]: 05.md
|
|
[06]: 06.md
|
|
[07]: 07.md
|
|
[08]: 08.md
|
|
[09]: 09.md
|
|
[10]: 10.md
|
|
[11]: 11.md
|
|
[12]: 12.md
|
|
[13]: 13.md
|
|
[14]: 14.md
|
|
[15]: 15.md
|
|
[16]: 16.md
|
|
[17]: 17.md
|
|
[18]: 18.md
|
|
[19]: 19.md
|
|
[20]: 20.md |