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

Attestation proof verification #70

Open
tomt1664 opened this issue Oct 18, 2023 · 1 comment
Open

Attestation proof verification #70

tomt1664 opened this issue Oct 18, 2023 · 1 comment

Comments

@tomt1664
Copy link

Functions required to verify event commitment proofs.

For a given sequence (https://commerceblock.readthedocs.io/en/latest/mainstay-con/index.html#proof-of-immutable-sequence) of proofs, Verification comes in 3 stages:

  1. Verify the sequence of commitments in the hash chain. This involves taking the latest retrieved proof and the list of saved Events (e.g. retrieved from the DB) and repeating the computation of the hash chain of event_ids and then confirming the slot commitment of hash chain in the latest proof (this then gives the latest event that is fully attested).

  2. Verify the proof path. For the latest slot proof, verify that the the commitment is included in the merkle_root this is done by successively concatenating the commitment along the path proof ("ops") as is done here: https://github.com/commerceblock/pymainstay/blob/a84c5f295143c4ac2eed8a3726c3bf1c88399338/mst/verify.py#L158

  3. Finally, we need to verify that the merkle_root is included in the specified bitcoin transaction. This requires a connection to a bitcoin-cli. For the specified txid, first getrawtransaction and then get the pay to address. Confirm the address is tweaked with the merkle_root (like https://github.com/commerceblock/pymainstay/blob/a84c5f295143c4ac2eed8a3726c3bf1c88399338/mst/verify.py#L126) and then go back along the tx staychain to check the initial anchor state.

@ariard
Copy link
Contributor

ariard commented Oct 31, 2023

Okay, so we have 3 steps (verify the sequence of commitments in the hash chain, verify the proof path and verify the merkle root in the specified bitcoin transaction).

I think it’s interesting to have this implemented client-side in civkit-sample:

  • query civkitd to retrieve the listed of saved events and verify the slot commitment
  • verify that the client commitment is included in the merkle_root
  • query civkitd which is querying bitcoind to verify confirmation of the anchor transaction and verify the inclusion of the merkle_root.

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

2 participants