Skip to content

Adds API route for retrieving quote IDs#2

Merged
vnprc merged 2 commits intovnprc:hashpool2from
machuPikacchuBTC:hashpool2
Jun 4, 2025
Merged

Adds API route for retrieving quote IDs#2
vnprc merged 2 commits intovnprc:hashpool2from
machuPikacchuBTC:hashpool2

Conversation

@machuPikacchuBTC
Copy link

@machuPikacchuBTC machuPikacchuBTC commented May 27, 2025

Description

This PR adds a new GET endpoint to support fetching quote IDs for a given set of share hashes in HashPool. Currently, the pool, mint, and translator proxies are sharing state via Redis but since miners in general will not have access to Redis directly we need a standard way for them to share the quote UUID <-> share hash mapping.


Notes to the reviewers

The redis client is initialized on each request which is ok for local development and testing but in a production environment we will want to reuse the connection, consider reconnect logic, etc. I wasn't sure the best way to handle that in its current state.


Suggested CHANGELOG Updates

CHANGED

ADDED

Adds a /v1/mint/quote-ids/share route for looking up quote IDs from share hashes.

REMOVED

FIXED


Checklist

pub struct QuotesSharesResponse {
/// Share hash -> quote ID mapping
pub quote_ids: HashMap<String, String>,
}
Copy link
Author

Choose a reason for hiding this comment

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

Moved these out of cdk-axum since the wallet needed the objects as well and it would've been a circular import. The other common structs are defined in their respective nut file but since these don't fit in that paradigm I put them in cdk-common. Not sure if it's the right spot.

Copy link
Owner

Choose a reason for hiding this comment

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

Yeah great point. I don't know what the right answer is. I think this is fine, we can get feedback from the cdk community when this makes its way into a PR there. Soon.

@machuPikacchuBTC machuPikacchuBTC marked this pull request as ready for review May 29, 2025 14:11
@machuPikacchuBTC
Copy link
Author

machuPikacchuBTC commented May 29, 2025

@vnprc something to consider is explicitly limiting the number of share hashes the client can request at a time to prevent a DoS from someone requesting an unreasonable number of quote IDs.

@vnprc
Copy link
Owner

vnprc commented Jun 4, 2025

Good point! Cashu can do blinded auth tokens. I intend to rate limit every DoSable pool resource with an HTTP 402 ecash flow. I believe this is how all paid APIs will work in the future. We could also place a limit on the number of quotes you can request in a single API call.

I think we should hold off on building this infrastructure until the need arises. Keep it simple for as long as possible. Make it complex only when you have to.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants