# M01-L01 — Lab: Replicated ledger

## Prerequisites
Java 21, terminal, no external dependencies. Complete M01-L00 first if applicable.

## Bài toán → Vấn đề → Giải pháp
- **Bài toán:** How do three nodes agree on the same append-only transaction history?
- **Vấn đề:** A single centralized database is a single trust authority; copying data without deterministic ordering produces divergent histories.
- **Giải pháp:** Use an ordered, validated log and deterministic replay; do not confuse replication with Byzantine consensus.

## Step-by-step
1. Read `theory.md`, predict the result and write down the invariant.
2. Open `starter/README.md`, create your own `Main.java` in `starter/`.
3. Compile: `javac Main.java` and run `java Main` from your starter directory.
4. Compare your result with `solution/Main.java`; run the solution using `javac Main.java && java Main`.
5. Trigger one negative case and explain why it is rejected.
6. Run `bash test.sh` from this lesson folder to validate the reference solution.
7. Record actual terminal output in your own lab notes. No RPC, wallet, or real funds required.

## Expected output
`Three replicas match after replay; a diverging replica is detected.`

## Failure modes
- Invalid or tampered inputs must be rejected rather than silently accepted.
- All tests must be deterministic except the displayed nonce/hash values where explicitly noted.

## Deliverables
Starter implementation, output transcript, explanation of invariant, and comparison with solution.
