diff options
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/utxo-commitment.md | 14 | ||||
| -rw-r--r-- | docs/utxo-proofs.md | 61 |
2 files changed, 75 insertions, 0 deletions
diff --git a/docs/utxo-commitment.md b/docs/utxo-commitment.md index ddf5450..991e5d9 100644 --- a/docs/utxo-commitment.md +++ b/docs/utxo-commitment.md | |||
| @@ -54,6 +54,20 @@ SHA256("BTFNODE1|" || left_hash || right_hash) | |||
| 54 | 54 | ||
| 55 | The final hash is the UTXO-set root. | 55 | The final hash is the UTXO-set root. |
| 56 | 56 | ||
| 57 | ## Inclusion Proofs | ||
| 58 | |||
| 59 | After a root has been computed, `scripts/prove-utxo.py` can create a compact | ||
| 60 | inclusion proof for one unspent output: | ||
| 61 | |||
| 62 | ```bash | ||
| 63 | python3 scripts/prove-utxo.py TXID:VOUT --out utxo-proof.json --json | ||
| 64 | python3 scripts/verify-utxo-proof.py utxo-proof.json | ||
| 65 | ``` | ||
| 66 | |||
| 67 | The verifier does not need local block files. It recomputes the target leaf, | ||
| 68 | walks the sibling path, and compares the result with the expected root. See | ||
| 69 | [UTXO inclusion proofs](utxo-proofs.md). | ||
| 70 | |||
| 57 | ## Deterministic Output | 71 | ## Deterministic Output |
| 58 | 72 | ||
| 59 | `--json` and `--out` write canonical JSON with sorted keys, fixed separators, | 73 | `--json` and `--out` write canonical JSON with sorted keys, fixed separators, |
diff --git a/docs/utxo-proofs.md b/docs/utxo-proofs.md new file mode 100644 index 0000000..4947c3c --- /dev/null +++ b/docs/utxo-proofs.md | |||
| @@ -0,0 +1,61 @@ | |||
| 1 | # Bitflash UTXO inclusion proofs | ||
| 2 | |||
| 3 | `scripts/prove-utxo.py` creates a deterministic inclusion proof for one | ||
| 4 | currently unspent output. `scripts/verify-utxo-proof.py` verifies that proof | ||
| 5 | against the UTXO root produced by `scripts/verify-utxo-set.py`. | ||
| 6 | |||
| 7 | This is intentionally outside consensus. It turns the audit root into something | ||
| 8 | useful for a specific coin without changing what nodes accept. | ||
| 9 | |||
| 10 | ## Create A Proof | ||
| 11 | |||
| 12 | Use an unspent output in `txid:vout` form: | ||
| 13 | |||
| 14 | ```bash | ||
| 15 | python3 scripts/prove-utxo.py TXID:VOUT --out utxo-proof.json --json | ||
| 16 | ``` | ||
| 17 | |||
| 18 | The proof contains: | ||
| 19 | |||
| 20 | - the target UTXO; | ||
| 21 | - its sorted leaf index; | ||
| 22 | - the leaf hash; | ||
| 23 | - the Merkle sibling path; | ||
| 24 | - the UTXO root and chain tip used to create it. | ||
| 25 | |||
| 26 | It does not contain the full UTXO set. | ||
| 27 | |||
| 28 | ## Verify A Proof | ||
| 29 | |||
| 30 | Verify against the root embedded in the proof: | ||
| 31 | |||
| 32 | ```bash | ||
| 33 | python3 scripts/verify-utxo-proof.py utxo-proof.json | ||
| 34 | ``` | ||
| 35 | |||
| 36 | Or verify against a root copied from another machine, dashboard, block explorer, | ||
| 37 | or future node export: | ||
| 38 | |||
| 39 | ```bash | ||
| 40 | python3 scripts/verify-utxo-proof.py utxo-proof.json \ | ||
| 41 | --root ROOT_FROM_REPORT_OR_EXPORT | ||
| 42 | ``` | ||
| 43 | |||
| 44 | The verifier does not need local `blk*.dat` files. It only needs the proof and | ||
| 45 | the expected root. | ||
| 46 | |||
| 47 | ## Scope | ||
| 48 | |||
| 49 | This first proof format supports inclusion only. Absence and range proofs are | ||
| 50 | left for a later design because they require a more careful commitment scheme | ||
| 51 | and are easier to get subtly wrong. | ||
| 52 | |||
| 53 | The proof uses the exact same leaf and node domains as the UTXO commitment: | ||
| 54 | |||
| 55 | ```text | ||
| 56 | BTFUTXO1 | ||
| 57 | BTFNODE1 | ||
| 58 | ``` | ||
| 59 | |||
| 60 | That keeps the verifier language-neutral and gives future implementations a | ||
| 61 | small, stable target. | ||