Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
fmkra committed Sep 10, 2024
1 parent a9bab39 commit a5b0e34
Showing 1 changed file with 8 additions and 22 deletions.
30 changes: 8 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

[![Continuous Integration - proof verification tests](https://github.com/HerodotusDev/cairo-verifier/actions/workflows/proof_verification_tests.yml/badge.svg)](https://github.com/HerodotusDev/cairo-verifier/actions/workflows/proof_verification_tests.yml)

## Using Verifier contracts
## Using Verifier contracts on Starknet

To use the Verifier for verifying proofs on starknet, you need to generate calldata for your proof. The easiest way to do that is to use [Calldata Generator](https://github.com/HerodotusDev/integrity-calldata-generator). It also provides script for automatic transaction sending (proof verification is split into multiple transactions, for more information see [Split Verifier Architecture](/README.md#split-verifier-architecture)).
To use the Verifier for verifying proofs on starknet, you need to generate calldata for your proof. The easiest way to do that is to use [Calldata Generator](https://github.com/HerodotusDev/integrity-calldata-generator). It also provides script for automatic transaction sending (proof verification is split into multiple transactions, for more information see [Split Verifier Architecture](#split-verifier-architecture)).

## Running locally

Expand All @@ -20,7 +20,7 @@ To build the Cairo Verifier, follow these steps:
scarb build
```

If you want to build for other layouts, refer to [Configure Verifier](/README.md#configure-verifier)
If you want to build for other layouts, refer to [Configure Verifier](#configure-verifier)

2. (Optional) Test the project to ensure everything works correctly:

Expand All @@ -39,25 +39,6 @@ cargo run --release --bin runner -- --program target/dev/cairo_verifier.sierra.j
cargo run --release --bin runner -- --program target/dev/cairo_verifier.sierra.json -c cairo1 < examples/proofs/recursive/cairo1_example_proof.json
```

<!-- ### Starknet Proof Verification
To verify proofs on Starknet, proceed with the following steps:
1. Prepare calldata of example proof for sncast:
```bash
cargo run --release --bin snfoundry_proof_serializer -- -c cairo0 < examples/proofs/recursive/cairo0_example_proof.json > examples/starknet/calldata
```
2. Call the function with calldata on the Starknet contract:
```bash
cd examples/starknet
./1-verify-proof.sh 0x274d8165a19590bdeaa94d1dd427e2034462d7611754ab3e15714a908c60df7 calldata
```
[List of deployed Verifier Contracts](deployed_contracts.md) -->

### Configure Verifier

By default, the verifier is configured for monolith version, recursive layout and keccak hash for verifier unfriendly commitment layers. You can easily change that by using scarb's features:
Expand Down Expand Up @@ -100,4 +81,9 @@ Since verifier can be configured in many ways and some parts of the logic change

After proof is verified, `FactRegistered` event is emitted which contains `fact_hash`, `verification_hash`, `security_bits` and `settings`. `fact_hash` is a value that represents proven program and its output (formally `fact_hash = poseidon_hash(program_hash, output_hash)`). Remember that registration of some `fact_hash` doesn't necessary mean that it has been verified by someone with secure enough proof. You always need to check `security_bits` and `settings` which is part of `verification_hash` (formally `verification_hash = poseidon_hash(fact_hash, security_bits, settings)`).

`FactRegistry` provides two methods for checking verified proofs:

- `get_verification(verification_hash)`
- `get_all_verifications_for_fact_hash(fact_hash)`

FactRegistry contract is trustless which means that owner of the contract can't override or change any existing behavior, they can only add new verifiers. Proxy contract on the other hand is upgradable, so every function can be changed or removed. It has the advantage of having all future updates of the verifier logic without having to replace the address of FactRegistry contract.

0 comments on commit a5b0e34

Please sign in to comment.