Design an Idempotent Send Crypto API Endpoint
Last updated: November 29, 2026
Quick Overview
Design and implement the server side of a 'send crypto' endpoint so that client retries after timeouts never send funds twice, using idempotency keys, request fingerprints and clear status codes.
Coinbase
November 29, 20260
0
0 solved
Design and implement the server side of a 'send crypto' endpoint so that client retries after timeouts never send funds twice, using idempotency keys, request fingerprints and clear status codes.
Mobile clients on flaky networks retry sends, and a duplicate on-chain send cannot be reversed, so idempotency is a first-class concern in Coinbase APIs. The interviewer looks for a precise contract: what the key covers, what happens on concurrent duplicates and on key reuse with a different body.
What the Interviewer Expects
- Require an idempotency key scoped per user
- Store a fingerprint of the request and reject mismatched reuse
- Return the original response for completed duplicates
- Handle concurrent duplicates with an in-progress state and 409
- Define retention (for example 24 hours) and failure semantics
Key Topics to Cover
How to Approach This
- Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
- Choose data structures based on access patterns, not familiarity.
- Prefer immutable data and message passing over shared mutable state for concurrency.
- Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
- What should happen if the server crashes after placing the hold but before storing the response?
- How do you implement begin atomically in a SQL database?
- Why scope keys per user rather than globally?
- Should GET endpoints accept idempotency keys?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
POST /v1/accounts/{asset}/sends with an Idempotency-Key header and body (to, amount, asset). Same key and same body returns the original result. Same key with a different body is a client error. C...
High-Level Design
An idempotency table keyed by (user, key) with fingerprint, status and stored response. begin atomically inserts a row in IN_PROGRESS or returns the existing row; in SQL that is `INSERT ... ON CONFL...