-
Notifications
You must be signed in to change notification settings - Fork 51
Description
Using NiPoPoW described in KMZ17
Goal
Prove that a payment (ERG and/or tokens) was made on the blockchain.
EDIT: For a recent payment it would be faster to use UTXO proof described in #502
Step 1. Prove that a tx with a given id in a block with a given id exists in the blockchain.
Step 1.1. Prove that a block with a given id exists in the blockchain.
-
1.1.1. Ask proofs from known nodes via
/nipopow/proof/{m}/{k}/{headerId}
/nipopow/proof
REST API endpoint support #545 -
1.1.2. Create
NipopowVerifier
Rust equvalent and feed all received proofs intoNipopowVerifier::process
; [1500 SigmaUSD] NiPoPoW proof verification #499 -
1.1.3. Check that
verifier.bestProof().suffixHead.id
is our block id; [1500 SigmaUSD] NiPoPoW proof verification #499
Step 1.2. Prove that a tx with a given id exists in the blockchain.
- 1.2.1. Ask any node for
MerkleProof
via/blocks/{headerId}/proofFor/{txId}
; [350 SigmaUSD]MerkleProof
verification #515 - 1.2.2. Confirm the tx id is in the block with
merkleProof.valid(header.transactionsRoot)
Rust equivalent; [350 SigmaUSD]MerkleProof
verification #515
Step 2. Check the box with the payment
Step 2.1 Get the whole tx for tx id from Step 1
It can either be provided along with the tx id in Step 1 or fetched from the node. It is verified by serializing the tx and calculating its id and then comparing it to the tx id confirmed in Step 1.2.
Step 2.2. Confirm the payment is in this tx
Find the output box protected with a certain script (e.g certain PK) and check that its value and/or tokens are as expected.