Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPV workflow for verifying a payment with NiPoPoW #187

Open
greenhat opened this issue Jul 28, 2022 · 0 comments
Open

SPV workflow for verifying a payment with NiPoPoW #187

greenhat opened this issue Jul 28, 2022 · 0 comments

Comments

@greenhat
Copy link
Member

greenhat commented Jul 28, 2022

SPV workflow for verifying a payment with NiPoPoW

Created from ergo-lib #495

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.

Step 1.2. Prove that a tx with a given id exists in the blockchain.

See Step 1.1 in ergo-lib example workflow

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.

Implement the missing parts in appkit:

EDIT: Actually, I'm pretty sure that the above NiPoPoW-related types would better be in a dedicated ergo-nipopow lib since they are not directly related to wallet features. However, the bigger challenge will be the dependent more low-level types like Header, etc. Seems like they should be moved to their own separate lib (ergo-core/ergo-chain-types?).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant