upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/docs/utxo-proofs.md
blob: 4947c3ceb00d964b43da7b6e821907cc83b381c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Bitflash UTXO inclusion proofs

`scripts/prove-utxo.py` creates a deterministic inclusion proof for one
currently unspent output. `scripts/verify-utxo-proof.py` verifies that proof
against the UTXO root produced by `scripts/verify-utxo-set.py`.

This is intentionally outside consensus. It turns the audit root into something
useful for a specific coin without changing what nodes accept.

## Create A Proof

Use an unspent output in `txid:vout` form:

```bash
python3 scripts/prove-utxo.py TXID:VOUT --out utxo-proof.json --json
```

The proof contains:

- the target UTXO;
- its sorted leaf index;
- the leaf hash;
- the Merkle sibling path;
- the UTXO root and chain tip used to create it.

It does not contain the full UTXO set.

## Verify A Proof

Verify against the root embedded in the proof:

```bash
python3 scripts/verify-utxo-proof.py utxo-proof.json
```

Or verify against a root copied from another machine, dashboard, block explorer,
or future node export:

```bash
python3 scripts/verify-utxo-proof.py utxo-proof.json \
  --root ROOT_FROM_REPORT_OR_EXPORT
```

The verifier does not need local `blk*.dat` files. It only needs the proof and
the expected root.

## Scope

This first proof format supports inclusion only. Absence and range proofs are
left for a later design because they require a more careful commitment scheme
and are easier to get subtly wrong.

The proof uses the exact same leaf and node domains as the UTXO commitment:

```text
BTFUTXO1
BTFNODE1
```

That keeps the verifier language-neutral and gives future implementations a
small, stable target.