NUT-XX: Get quotes by pubkeys - #341
Conversation
robwoodgate
left a comment
There was a problem hiding this comment.
The signature scheme is a bit worrying, but otherwise just some nit/questions for clarity.
Co-authored-by: Rob Woodgate <robwoodgate@users.noreply.github.com>
Co-authored-by: Rob Woodgate <robwoodgate@users.noreply.github.com>
| @@ -0,0 +1,60 @@ | |||
| # NUT-29: Mint Quote Lookup by Public Key | |||
There was a problem hiding this comment.
This needs a new NUT number, NUT-29 is already defined in NUT-29: Batched Minting
There was a problem hiding this comment.
Generally we us XX and just define before merge
|
|
||
| ```json | ||
| { | ||
| "29": { |
There was a problem hiding this comment.
This needs a new NUT number, NUT-29 is already defined in NUT-29: Batched Minting
Same thing here
|
I've opened a PR with the updated signature logic and test vectors here: #363 |
I support @a1denvalu3 's approach in #363 - using a timestamp also allows a mint to prevent reuse of the signature after xx minutes too. It would be even better with a domain prefix, in case a similar scheme is used later on elsewhere: But with a timestamp max age specified, the reuse window would be minimal in any case. |
|
Thanks for opening this — it's great to see this direction being taken seriously. I'm building an ESP32-based captive portal (TollGate) that provides WiFi access in exchange for ecash payments. My use case: a mining proxy on the ESP32 connects to a hashpool translator via SV1 stratum. The translator mints ehash tokens for the miner's locking pubkey and currently pushes them downstream via a custom This NUT ("Get quotes by pubkeys") would let me eliminate the translator middleman — the ESP32 could directly query the mint for quotes attributed to its pubkey, receive tokens without the push notification hack. This is especially important for resource-constrained devices where running a full translator is impractical. The domain-separated signature scheme in #363 (timestamp + mint pubkey) looks solid. I'm really looking forward to using this functionality — happy to test with my ESP32 implementation once the spec stabilizes. |
|
How it's going? |
|
To hopefully move this forward, I've proposed some amendments in the PR below, which gives us time-bounded replay protection. It is intended to be merged into this PR. |
NUT-XX: replay-protect pubkey quote lookup signatures
|
@ye0man - this looks ready for implementations to build on it |
|
This still vulnerable by replay attacks, why removed |
replay can't be fully prevented without a mint state or perfectly synchronized clocks (i.e. time windows to compensate), so we dropped it |
|
ACK |
To prevent replay attack, we can make a request before everything to setup some nonce that can be used for validate the I suggested it before: |
| } | ||
| ``` | ||
|
|
||
| Where `MintQuoteResponse` is the quote response type defined in [NUT-04][04]. |
There was a problem hiding this comment.
Presumably, each quote will be the shape specified for the method it represents? So maybe a better wording is something like:
| Where `MintQuoteResponse` is the quote response type defined in [NUT-04][04]. | |
| Where `MintQuoteResponse` is the quote response type defined in [NUT-04][04], or an extension of it based on the method the quote relates to. |
|
|
||
| ## Request | ||
|
|
||
| To query quotes assigned to a public key, the wallet makes a `POST /v1/mint/quote/{method}/pubkey` request. |
There was a problem hiding this comment.
Do we NEED a {method} now quotes have method in their structs (#387)?
The endpoint could return quotes for ANY method?
| To query quotes assigned to a public key, the wallet makes a `POST /v1/mint/quote/{method}/pubkey` request. | |
| To query quotes assigned to a public key, the wallet makes a `POST /v1/mint/quote/pubkey` request. |
There was a problem hiding this comment.
IMO we don't need to separate those request.
Concept ACK for this suggestion
There was a problem hiding this comment.
I think we should keep it. It is more inline with batch minting and the responses are still different shapes so I would prefer to return the uniform response of a list of one response type.
Implementations
supersedes #329
Get NUT-20 quotes by
pubkeys. Requires signatures to prove possession of the corresponding private keys.