Skip to content

NUT-XX: Get quotes by pubkeys - #341

Open
callebtc wants to merge 16 commits into
mainfrom
get-quotes-by-pubkeys
Open

NUT-XX: Get quotes by pubkeys#341
callebtc wants to merge 16 commits into
mainfrom
get-quotes-by-pubkeys

Conversation

@callebtc

@callebtc callebtc commented Feb 16, 2026

Copy link
Copy Markdown
Contributor

Implementations

supersedes #329
Get NUT-20 quotes by pubkeys. Requires signatures to prove possession of the corresponding private keys.

@callebtc callebtc changed the title Get quotes by pubkeys NUT-XX: Get quotes by pubkeys Feb 16, 2026

@robwoodgate robwoodgate left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The signature scheme is a bit worrying, but otherwise just some nit/questions for clarity.

Comment thread xx.md Outdated
Comment thread xx.md Outdated
Comment thread xx.md
Comment thread xx.md Outdated
Comment thread xx.md
Comment thread xx.md Outdated
callebtc and others added 2 commits February 26, 2026 16:22
Co-authored-by: Rob Woodgate <robwoodgate@users.noreply.github.com>
Co-authored-by: Rob Woodgate <robwoodgate@users.noreply.github.com>
Comment thread xx.md Outdated
@@ -0,0 +1,60 @@
# NUT-29: Mint Quote Lookup by Public Key

@TheMhv TheMhv Mar 31, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a new NUT number, NUT-29 is already defined in NUT-29: Batched Minting

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally we us XX and just define before merge

Comment thread xx.md Outdated

```json
{
"29": {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a new NUT number, NUT-29 is already defined in NUT-29: Batched Minting

Same thing here

Comment thread xx.md Outdated
TheMhv

This comment was marked as resolved.

@a1denvalu3

Copy link
Copy Markdown
Contributor

I've opened a PR with the updated signature logic and test vectors here: #363

@robwoodgate

robwoodgate commented Apr 17, 2026

Copy link
Copy Markdown
Collaborator

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:

SHA-256( b"Cashu_NUTXX_QUOTE_v1" || pubkey || timestamp || mint_pubkey )

But with a timestamp max age specified, the reuse window would be minimal in any case.

@c03rad0r

c03rad0r commented Jun 3, 2026

Copy link
Copy Markdown

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 mining.token notification.

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.

@TheMhv

TheMhv commented Jun 17, 2026

Copy link
Copy Markdown

How it's going?

@robwoodgate

robwoodgate commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

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.

@robwoodgate
robwoodgate self-requested a review July 4, 2026 15:59

@robwoodgate robwoodgate left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK. LGTM

@robwoodgate
robwoodgate requested a review from thesimplekid July 4, 2026 16:00
@robwoodgate

Copy link
Copy Markdown
Collaborator

@ye0man - this looks ready for implementations to build on it

@robwoodgate robwoodgate added the needs implementation Needs a reference implementation label Jul 4, 2026
@TheMhv

TheMhv commented Jul 4, 2026

Copy link
Copy Markdown

This still vulnerable by replay attacks, why removed timestamp field from signed hash?

@callebtc callebtc added the ready Ready to merge label Jul 4, 2026
@callebtc

callebtc commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

This still vulnerable by replay attacks, why removed timestamp field from signed hash?

replay can't be fully prevented without a mint state or perfectly synchronized clocks (i.e. time windows to compensate), so we dropped it

@callebtc

callebtc commented Jul 4, 2026

Copy link
Copy Markdown
Contributor Author

ACK

@TheMhv

TheMhv commented Jul 4, 2026

Copy link
Copy Markdown

replay can't be fully prevented without a mint state or perfectly synchronized clocks (i.e. time windows to compensate), so we dropped it

To prevent replay attack, we can make a request before everything to setup some nonce that can be used for validate the mint_quote request.

I suggested it before:
#341 (review)

Comment thread xx.md
}
```

Where `MintQuoteResponse` is the quote response type defined in [NUT-04][04].

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presumably, each quote will be the shape specified for the method it represents? So maybe a better wording is something like:

Suggested change
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.

Comment thread xx.md

## Request

To query quotes assigned to a public key, the wallet makes a `POST /v1/mint/quote/{method}/pubkey` request.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we NEED a {method} now quotes have method in their structs (#387)?

The endpoint could return quotes for ANY method?

Suggested change
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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO we don't need to separate those request.
Concept ACK for this suggestion

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs implementation Needs a reference implementation ready Ready to merge

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

8 participants