PracHub
QuestionsLearningGuidesInterview Prep
|Home/System Design/Stripe

Design an Idempotent Double-Entry Ledger

Last updated: Aug 2, 2026

Quick Overview

Design an idempotent double-entry ledger for financial requests retried over unreliable networks. Address immutable postings, balanced currencies, concurrent requests, pending and posted states, atomic responses, balance queries, corrections, reconciliation, recovery, and hot-account scaling.

  • medium
  • Stripe
  • System Design
  • Software Engineer

Design an Idempotent Double-Entry Ledger

Company: Stripe

Role: Software Engineer

Category: System Design

Difficulty: medium

Interview Round: Technical Screen

Design a ledger service that records financial transactions using double-entry accounting. Clients submit operations over an unreliable network and may retry the same logical request. The design must ensure that retries do not create duplicate postings while unrelated requests continue normally. Focus on the idempotency-key contract as well as account, transaction, and posting models; atomic writes; balance queries; concurrency; reconciliation; and operational recovery. ### Constraints & Assumptions - One ledger transaction contains two or more postings whose signed amounts sum to zero per currency. - Posted entries are immutable; corrections use compensating transactions. - Clients choose idempotency keys within an authenticated scope. - A timeout does not tell the client whether the original request committed. - The initial database supports serializable transactions or equivalent row and uniqueness constraints. ### Clarifying Questions to Ask - Is the idempotency key unique per account, API credential, customer, or entire ledger? - How long must completed idempotency records be retained? - Can a transaction remain pending, and can pending funds affect available balance? - What throughput, currency, and audit requirements apply? ### What a Strong Answer Covers - Defines an immutable balanced posting model and a separate transaction state. - Scopes idempotency keys, binds them to a canonical request hash, and stores the response atomically with the write. - Handles concurrent identical requests and key reuse with different payloads. - Uses one transaction for validation, postings, balance projection, and idempotency completion. - Explains pending versus posted balances, reversals, reconciliation, and restore behavior. - Identifies hot-account contention, sharding limits, and observability needs. ### Follow-up Questions 1. What should a retry receive if the first request is still in progress? 2. How would idempotency work across two services that each own part of a workflow? 3. How can the ledger scale without allowing one transaction to span arbitrary shards?

Quick Answer: Design an idempotent double-entry ledger for financial requests retried over unreliable networks. Address immutable postings, balanced currencies, concurrent requests, pending and posted states, atomic responses, balance queries, corrections, reconciliation, recovery, and hot-account scaling.

Related Interview Questions

  • Design a Superhero Dispatch System - Stripe (medium)
  • Design a Distributed Metrics Counter - Stripe (hard)
  • Design a superhero incident dispatch system - Stripe (medium)
  • Design a Merchant Ledger Service - Stripe (medium)
|Home/System Design/Stripe

Design an Idempotent Double-Entry Ledger

Stripe logo
Stripe
Jun 16, 2026, 12:00 AM
mediumSoftware EngineerTechnical ScreenSystem Design
2
0

Design a ledger service that records financial transactions using double-entry accounting. Clients submit operations over an unreliable network and may retry the same logical request. The design must ensure that retries do not create duplicate postings while unrelated requests continue normally.

Focus on the idempotency-key contract as well as account, transaction, and posting models; atomic writes; balance queries; concurrency; reconciliation; and operational recovery.

Constraints & Assumptions

  • One ledger transaction contains two or more postings whose signed amounts sum to zero per currency.
  • Posted entries are immutable; corrections use compensating transactions.
  • Clients choose idempotency keys within an authenticated scope.
  • A timeout does not tell the client whether the original request committed.
  • The initial database supports serializable transactions or equivalent row and uniqueness constraints.

Clarifying Questions to Ask Guidance

  • Is the idempotency key unique per account, API credential, customer, or entire ledger?
  • How long must completed idempotency records be retained?
  • Can a transaction remain pending, and can pending funds affect available balance?
  • What throughput, currency, and audit requirements apply?

What a Strong Answer Covers Guidance

  • Defines an immutable balanced posting model and a separate transaction state.
  • Scopes idempotency keys, binds them to a canonical request hash, and stores the response atomically with the write.
  • Handles concurrent identical requests and key reuse with different payloads.
  • Uses one transaction for validation, postings, balance projection, and idempotency completion.
  • Explains pending versus posted balances, reversals, reconciliation, and restore behavior.
  • Identifies hot-account contention, sharding limits, and observability needs.

Follow-up Questions Guidance

  1. What should a retry receive if the first request is still in progress?
  2. How would idempotency work across two services that each own part of a workflow?
  3. How can the ledger scale without allowing one transaction to span arbitrary shards?

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More System Design•More Stripe•More Software Engineer•Stripe Software Engineer•Stripe System Design•Software Engineer System Design

Your design canvas — auto-saved

PracHub

Master your tech interviews with 9,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.