Attestation proof verification
- Dominant language
- Rust
- Stars
- 62
- Forks
- 10
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.