diff --git a/20.md b/20.md index b5fb5b7..3ef6595 100644 --- a/20.md +++ b/20.md @@ -2,6 +2,8 @@ `optional` +`depends on: NUT-19` + --- Similar to [NUT-04][04], which covers minting via BOLT11 invoices, minting via [BOLT12](https://github.com/lightning/bolts/blob/master/12-offer-encoding.md) is also a two-step process: requesting a mint quote and minting tokens. This document describes both steps, focusing on BOLT12-specific considerations. @@ -22,11 +24,17 @@ The wallet of `Alice` includes the following `PostMintQuoteBolt12Request` data i "unit": , "description": , "expiry": , - "single_use": + "single_use": , + "pubkey": } ``` -The `amount` field is optional and specifies the amount to mint. The `unit` field is mandatory. An optional `description` can be passed if the mint signals support for it in `MintMethodSetting`. If `single_use` is false, the offer can be paid multiple times. The optional `expiry` field specifies the unix timestamp when the offer expires it **MUST** be before the `max_expiry` in the `MintMethodSettings` if one is given. +The `amount` field is optional and specifies the amount to mint. The `unit` field is mandatory. An optional `description` can be passed if the mint signals support for it in `MintMethodSetting`. If `single_use` is false, the offer can be paid multiple times. The optional `expiry` field specifies the unix timestamp when the offer expires it **MUST** be before the `max_expiry` in the `MintMethodSettings` if one is given. `pubkey` is the public key that will be required for signature verification during the minting process. The mint will only mint ecash after receiving a valid signature from the corresponding private key in the `PostMintRequest`. + +> **Note:** While a pubkey is optinal as per [NUT-19][19] for [NUT-04][04] it is required in this NUT and the mint **MUST NOT** issue a mint quote if one is not included. + + +> **Privacy:** To prevent linking multiple mint quotes together, wallets **SHOULD** generate a unique public key for each mint quote request The mint `Bob` then responds with a `PostMintQuoteBolt12Response`: @@ -36,7 +44,8 @@ The mint `Bob` then responds with a `PostMintQuoteBolt12Response`: "request": , "expiry": , "amount_paid": , - "amount_issued": + "amount_issued": , + "pubkey": } ``` @@ -60,7 +69,8 @@ Response of `Bob`: "request": "lno1qcp...", "expiry": 1701704757, "amount_paid": 0, - "amount_issued": 0 + "amount_issued": 0, + "pubkey": "03d56ce4e446a85bbdaa547b4ec2b073d40ff802831352b8272b7dd7a4de5a7cac" } ``` @@ -82,6 +92,11 @@ Example request of `Alice` with curl: curl -X GET http://localhost:3338/v1/mint/quote/bolt12/DSGLX9kevM... ``` +#### Witness + +In order to mint ecash the wallet **MUST** include a signature as defined in [NUT-19][19]. + + # Minting tokens After requesting a mint quote and paying the request, the wallet proceeds with minting new tokens by calling `POST /v1/mint/bolt12`. @@ -95,11 +110,12 @@ The wallet `Alice` includes the following `PostMintBolt12Request` data in its re ```json { "quote": , - "outputs": + "outputs": , + "witness": } ``` -The `quote` is the quote ID from the previous step and `outputs` are `BlindedMessages` (see [NUT-00][00]) that the wallet requests signatures on. The sum of the outputs must equal the amount that can be minted (`amount_paid` - `amount_issued`). +The `quote` is the quote ID from the previous step and `outputs` are `BlindedMessages` (see [NUT-00][00]) that the wallet requests signatures on. The sum of the outputs must equal the amount that can be minted (`amount_paid` - `amount_issued`). `witness` is the signature on the mint quote id as defined above. The mint `Bob` then responds with a `PostMintBolt12Response`: @@ -175,3 +191,4 @@ Example `MintMethodSetting`: [10]: 10.md [11]: 11.md [12]: 12.md +[19]: 19.md