Skip to content

Commit

Permalink
readme lint
Browse files Browse the repository at this point in the history
  • Loading branch information
yuwen01 committed Oct 30, 2024
1 parent 8902b2b commit a9ddd4c
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This crate verifies Groth16 proofs generated with SP1, leveraging Solana's BN254

> [!CAUTION]
>
> This repository is under active development and is not yet ready for production use.
> This repository is not audited for production use.
## Repository Overview

Expand All @@ -21,25 +21,26 @@ The `sp1-solana` library itself is in the [`verifier`](verifier) directory. [`ex

- Rust
- Edge Solana CLI
- Install with the following command:
- Install with the following command:

```shell
sh -c "$(curl -sSfL https://release.anza.xyz/edge/install)"
```

## Example usage

The [example](./example) demonstrates how to use the `sp1-solana` crate to verify a proof generated by SP1 on Solana.
The [example](./example) demonstrates how to use the `sp1-solana` crate to verify a proof generated by SP1 on Solana.
Running the script will perform the following steps:

1. Load an SP1 [`SP1ProofWithPublicValues`](https://docs.rs/sp1-sdk/2.0.0/sp1_sdk/proof/struct.SP1ProofWithPublicValues.html)
from the pre-generated proof [`fibonacci_proof.bin`](../proofs/fibonacci_proof.bin). This is a SP1 Groth16 proof that
proves that the 20th fibonacci number is 6765. Optionally, this proof can be freshly generated from
the [`sp1-program`](../sp1-program).

2. Extract the proof and public inputs from the `SP1ProofWithPublicValues`.
2. Extract the proof and public inputs from the `SP1ProofWithPublicValues`.

* The `proof` is the Groth16 proof, serialized in [SP1's standard format](https://docs.rs/sp1-sdk/2.0.0/sp1_sdk/proof/struct.SP1ProofWithPublicValues.html#method.bytes)
* The `sp1_public_inputs` are the public inputs to the underlying sp1 program.
- The `proof` is the Groth16 proof, serialized in [SP1's standard format](https://docs.rs/sp1-sdk/2.0.0/sp1_sdk/proof/struct.SP1ProofWithPublicValues.html#method.bytes)
- The `sp1_public_inputs` are the public inputs to the underlying sp1 program.
Here is a snippet from the [example script](./example/script/src/main.rs) that demonstrates this.
Expand All @@ -66,10 +67,10 @@ let groth16_proof = SP1Groth16Proof {
run_verify_instruction(groth16_proof).await;
```
3. Using the [`solana-program-test`](https://docs.rs/solana-program-test/latest/solana_program_test/) framework, send the `SP1Groth16Proof` to the
3. Using the [`solana-program-test`](https://docs.rs/solana-program-test/latest/solana_program_test/) framework, send the `SP1Groth16Proof` to the
[`fibonacci-verifier-contract`](./example/program). This smart contract will verify the proof using the `sp1-solana`
crate against the fibonacci SP1 program vkey and print out the public inputs. Here is a snippet that demonstrates
how to perform the verification and read the public inputs on chain.
how to perform the verification and read the public inputs on chain.
```rust
// Derived by running `vk.bytes32()` on the program's vkey.
Expand Down Expand Up @@ -110,14 +111,14 @@ pub fn process_instruction(
### Running the script
To load the pregenerated proof and verify it on `solana-program-test`, run the following commands.
To load the pregenerated proof and verify it on `solana-program-test`, run the following commands.
```shell
cd script
RUST_LOG=info cargo run --release
```
To generate a fresh proof from the program in `sp1-program`, run the following commands.
To generate a fresh proof from the program in `sp1-program`, run the following commands.
```shell
cd script
Expand All @@ -128,7 +129,7 @@ RUST_LOG=info cargo run --release -- --prove
Run the following commands to build and deploy the example solana program to devnet. These commands
assume you've already created a Solana keypair locally, and you have the edge solana CLI tools.
Request [devnet sol](https://faucet.solana.com/) as necessary.
Request [devnet sol](https://faucet.solana.com/) as necessary.
```shell
cd example/program
Expand All @@ -143,8 +144,9 @@ Add `sp1-solana` to your `Cargo.toml`:
```toml
[dependencies]
sp1-solana = { git = "https://github.com/succinctlabs/groth16-solana" }
sp1-solana = { git = "https://github.com/succinctlabs/sp1-solana" }
```
## Acknowledgements
This crate uses the [`groth16-solana`](https://github.com/Lightprotocol/groth16-solana/) crate from Light Protocol Labs for the Groth16 proof verification, and the [`ark-bn254`](https://github.com/arkworks-rs/algebra) crate for the elliptic curve operations.

0 comments on commit a9ddd4c

Please sign in to comment.