# M01-L04 — Lab: Proof of work

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

## Bài toán → Vấn đề → Giải pháp
- **Bài toán:** How can participants demonstrate computational work when proposing a block?
- **Vấn đề:** A block hash is cheap to calculate; without an acceptance rule anyone can produce many candidates.
- **Giải pháp:** Mine a nonce whose SHA-256 hash has a prefix target; validate claimed work. This is a toy model, not real PoW 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
`Mined block meets difficulty; tampered nonce fails.`

## 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.
