-
Notifications
You must be signed in to change notification settings - Fork 51
Open
Milestone
Description
After ergoplatform/ergo#1525 is implemented we can get the UTXO proof (unspent box) in the current state (block). See details in ergoplatform/ergo#1525 (comment)
For a recent payment, we can get the UTXO proof in the current block and wait for n blocks for confirmation.
For an old payment, it's faster to use NiPoPoW proof described in #495
Goal
Confirm that boxes with the given ids are in the UTXO, i.e. are not spent. Confirm that the contents of the boxes are indeed as expected.
Step 1. Choose randomly N nodes from the known nodes list.
Step 2. Ask each node for:
- 2.1
blocks/lastHeaders/1
to get the last header and verify the received header withAutolykosPowScheme::validate()
and check thatheader.timestamp
is no more than block time(5 min) old. Also, verify that the received block is in the chain via Step 1.1 from NiPoPoW workflow Payment verification workflow for SPV with NiPoPoW #495. - 2.2
utxo/getBoxesBinaryProof
with the given boxes id;
Step 3. Verify the boxes.
- 3.1 Verify UTXO proof from every node (from 2.2) via
AdProofs::verify
using last header'sstateRoot
(from 2.1) as previous hash(digest) and Lookup op(state change) for every box. Where to get the expected hash? For all N nodes UTXO proofs must be verified. The only reason for the verification to fail is either node's last header is too old (before the box was created) or the box was already spent. - 3.2 Ask any node from the list of known nodes for
/utxo/byId/{boxId}
for each box id to get the box contents; - 3.3 Verify that the received box content corresponds to the box id by checking that the id of the parsed box from JSON is the same.
- 3.4 Verify that box content is as expected (guarding script == your PK, coins and/or tokens amount, etc.).
Needs to be implemented
Rust equivalent of
ross-weir
Metadata
Metadata
Assignees
Labels
No labels