Coinbase logo

Coinbase Software Engineer System Design Questions

54 practice questions for Coinbase Software Engineer interviews

Coinbase software engineer interviews cover algorithms, data structures, system design, and coding problems drawn from real interview rounds.

Software Engineer Backend Engineer Frontend Engineer Full Stack Engineer Mobile Engineer Data Engineer Data Scientist ML Engineer DevOps Engineer DevOps Engineer Product Manager SRE Security Engineer Engineering Manager Data Analyst UX/UI Designer QA Engineer

No verified questions yet for Coinbase.

system design Hard database #1

1. Design AssetConfigStore — versioned trading configuration with historical reads


Background
Coinbase Exchange supports many trading products, such as BTC-USD, whose operational configuration can change over time. Model an in-memory configuration component that lets trading-support tools retrieve current settings and lets incident investigators reconstruct settings at a historical timestamp. This is a practice adaptation of the reported Coinbase timestamped, two-level key-value-store exercise, not a description of Coinbase's internal implementation.
Requirements
1. Store string values under a product key and setting subkey. set creates a new version without destroying older versions. An empty string is a valid value and is different from a missing value.
2. Every mutation has an integer timestamp. Mutation timestamps must be strictly increasing across the entire store, including deletes of nonexistent entries. Reject an out-of-range or non-increasing mutation timestamp with ValueError, without changing any state.
3. Reads accept an optional timestamp. An omitted timestamp means the latest state; a supplied timestamp means the state after all mutations at or before that timestamp. Return None for a missing setting. Reads before the first mutation or after the last mutation are valid.
4. delete_subkey makes one setting absent from its timestamp onward. delete_key makes every setting under that product absent from its timestamp onward. Both preserve historical reads. A subsequent set recreates only the specified setting: it must not resurrect other deleted settings.
5. get_all returns a new dictionary containing only settings visible at the requested time. Return an empty dictionary for a product with no visible settings. Dictionary order is not significant, and modifying a returned dictionary must not change the store.
6. Use lazy product-deletion markers rather than scanning every setting during delete_key. Historical point reads must use binary search rather than scanning every version. Deletes of missing products or settings are valid mutations.
Class API
  • AssetConfigStore() — construct an empty store.

  • set(product: str, setting: str, value: str, timestamp: int) -> None — append a setting version.

  • get(product: str, setting: str, timestamp: Optional[int] = None) -> Optional[str] — retrieve the visible value at the requested time.

  • get_all(product: str, timestamp: Optional[int] = None) -> dict[str, str] — retrieve all visible settings for a product.

  • delete_subkey(product: str, setting: str, timestamp: int) -> None — append a setting-deletion marker.

  • delete_key(product: str, timestamp: int) -> None — append a product-deletion marker without visiting its settings.


Example 1:
Input sequence of method calls on a new store:
set("BTC-USD", "min_order", "0.0001", 10)
set("BTC-USD", "status", "online", 20)
set("BTC-USD", "min_order", "0.0002", 30)
get("BTC-USD", "min_order", 25)
delete_key("BTC-USD", 40)
get_all("BTC-USD", 35)
get_all("BTC-USD", 40)
set("BTC-USD", "status", "post_only", 50)
get_all("BTC-USD")

Output, one entry per call (null represents None):
[null, null, null, "0.0001", null, {"min_order": "0.0002", "status": "online"}, {}, null, {"status": "post_only"}]

Explanation: The update at 30 is not visible at 25. Deleting the product at 40 leaves its state at 35 intact. The write at 50 recreates status, but the older min_order remains deleted.
Example 2:
Input sequence of method calls on a new store:
set("ETH-USD", "notice", "", 5)
get("ETH-USD", "notice", 4)
get("ETH-USD", "notice", 5)
delete_subkey("ETH-USD", "notice", 8)
get("ETH-USD", "notice", 8)
set("ETH-USD", "notice", "maintenance", 12)
get_all("ETH-USD", 7)
get_all("ETH-USD", 10)
get_all("ETH-USD", 100)

Output:
[null, null, "", null, null, null, {"notice": ""}, {}, {"notice": "maintenance"}]

Explanation: The empty string is a present value at timestamps 5 through 7. The setting is absent from 8 through 11, then becomes maintenance at 12. A future read sees all mutations recorded so far.
Constraints
  • At most 200,000 API calls; product and setting names are nonempty strings of at most 100 characters, and values have at most 1,000 characters.

  • Supplied timestamps are integers in [0, 10^12]. Out-of-range read timestamps also raise ValueError. String arguments and argument types satisfy the stated bounds.

  • Calls execute sequentially in one process. Persistence, expiration, history compaction, and concurrency are out of scope.

  • Target amortized O(1) writes and deletions, excluding string hashing; product deletion must be independent of the number of settings. get_all may inspect every setting ever recorded for the product.
Want to practise this one?
Create a free account to open the full question and practise Coinbase questions with AI.
Sign up free
system design Senior api design #2

2. [OA] Twitter Feed — Design a user feed for Coinbase's social trading features

As Coinbase looks to integrate social features for trading, it's essential to design a system that tracks user feeds efficiently.
Problem statement: Design a class to manage a user's feed. Supports the following methods: follow(follower_id: int, followee_id: int), unfollow(follower_id: int, followee_id: int), and get_feed(user_id: int) -> List[int]. The feed should return the most recent 10 transactions from the followed users.
  • Method signatures:

- def follow(follower_id: int, followee_id: int) -> None: update the following relationship.
- def unfollow(follower_id: int, followee_id: int) -> None: remove the following relationship.
- def get_feed(user_id: int) -> List[int]: return the user feed containing transaction IDs of the most recent 10 transactions from followed users.
Example 1:
Input: manager = FeedManager()
manager.follow(1, 2)
manager.follow(1, 3)
manager.get_feed(1)
Output: [x, y, z]
Constraints:
  • 1 <= follower_id, followee_id <= 10^4

  • Transaction history size can be up to 10^5.
system design Senior caching #3

3. [OA] LRU Cache — Design a caching layer for Coinbase's API responses

In order to optimize data retrieval times and minimize database load, Coinbase requires an LRU cache to manage frequent API requests efficiently.
Problem statement: Design and implement a class that represents an LRU Cache with a fixed capacity. Supports get(key: int) -> int and put(key: int, value: int) -> void methods.
  • Method signatures:

- def get(key: int) -> int: returns the value of the key if it exists or -1.
- def put(key: int, value: int) -> None: updates the value if the key exists, otherwise, adds the key-value pair to the cache. If the cache reaches its capacity, it should invalidate the least recently used item before inserting a new item.
Example 1:
Input: cache = LRUCache(2)
cache.put(1, 1)
cache.put(2, 2)
cache.get(1)
Output: 1
cache.put(3, 3)
cache.get(2)
Output: -1
Constraints:
  • 1 <= capacity <= 3000

  • 0 <= key, value <= 10^4.

Related Coinbase Software Engineer interview prep

Start practicing Coinbase questions

Sign up for free to access walkthroughs, AI-generated questions, and more.

Get Started Free