diff options
Diffstat (limited to 'docs/utxo-proofs.md')
| -rw-r--r-- | docs/utxo-proofs.md | 61 |
1 files changed, 61 insertions, 0 deletions
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. | ||