Skip to content

Payment verification workflow for SPV with UTXO proof #502

@greenhat

Description

@greenhat

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:

Step 3. Verify the boxes.

  • 3.1 Verify UTXO proof from every node (from 2.2) via AdProofs::verify using last header's stateRoot (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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions