Build a Tamper-Evident Hash Chain for Envelope Audit Events

Last updated: November 29, 2026

Quick Overview

Implement an append-only audit log for envelope events (sent, viewed, signed) where each entry stores the hash of the previous entry, and a verifier that returns the index of the first entry that was modified, removed or reordered.

DocuSign
Software Engineering Fundamentals
Software Engineer
DocuSign
November 29, 2026
Software Engineer
Onsite
Software Engineering Fundamentals
Medium

0

0

0 solved


Implement an append-only audit log for envelope events (sent, viewed, signed) where each entry stores the hash of the previous entry, and a verifier that returns the index of the first entry that was modified, removed or reordered.

DocuSign's Certificate of Completion and audit trail are what make an electronic signature defensible, so integrity of event history is central to the product. The interviewer is checking hashing fundamentals, canonical serialisation, and an honest account of what a hash chain does and does not protect against.

What the Interviewer Expects
  • Chain each entry to the previous hash starting from a fixed genesis value
  • Serialise events canonically (sorted keys, fixed separators) before hashing
  • Detect edits, deletions and reorders by recomputing from the start
  • Explain that a chain alone does not stop someone who can rewrite the whole log
  • Propose anchoring the head hash externally or signing it with a key held in an HSM
Key Topics to Cover
Cryptographic hashing
Canonical serialisation
Append-only logs
Integrity vs authenticity
How to Approach This
  1. Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
  2. Choose data structures based on access patterns, not familiarity.
  3. Prefer immutable data and message passing over shared mutable state for concurrency.
  4. Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
  • How would you verify a single entry without replaying millions of earlier ones?
  • How do you append safely when two services write events for the same envelope concurrently?
  • Where would you store and publish the chain head so an insider cannot rewrite history?
  • How does this relate to the PDF's own digital signature on the completed document?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements

Append events in order. Each stored entry has event, prev and hash, with hash = SHA256(prev + canonical_json(event)). first_tampered(log) returns the first index whose stored values no longe...

High-Level Design

Linking each hash to its predecessor means any change propagates: altering entry i changes its recomputed hash, so either entry i fails or entry i+1's prev no longer matches. Verification walks from...


Submit Your Answer
Markdown supported

Related Questions