diff --git a/readme.md b/readme.md index a56a8f4..b78791a 100644 --- a/readme.md +++ b/readme.md @@ -11,6 +11,7 @@ This repository is split into 3 components: ### Installation To install our Rust circuit SDK into a Cargo project, run: + ```bash cargo add axiom-sdk ``` @@ -39,17 +40,20 @@ pub struct AccountAgeInput { ### Compute Function Specification You must implement the `AxiomComputeFn` on your input struct. There is only one trait function that you must implement: + ```rust fn compute( api: &mut AxiomAPI, assigned_inputs: AccountAgeCircuitInput>, ) -> Vec ``` + where `AccountAgeCircuitInput` should be replaced with your derived circuit input struct. The `AxiomAPI` struct gives you access to subquery calling functions in addition to a `RlcCircuitBuilder` to specify your circuit. Your compute function should then return any values that you wish to pass on-chain in the `Vec` -- an `AxiomResult` is either an enum of either `HiLo>` or `AssignedValue` (in which case it is converted to hi-lo for you). Here is an example: + ```rust impl AxiomComputeFn for AccountAgeInput { fn compute( @@ -83,12 +87,14 @@ impl AxiomComputeFn for AccountAgeInput { ### Running The Circuit To run your circuit, create a `main` function call the `run_cli` function with your input struct as the generic parameter: + ```rust fn main() { env_logger::init(); run_cli::(); } ``` + The `main` function will run a CLI that allows you to run mock proving, key generation, and proving of your circuit. The CLI has the following commands: ``` @@ -117,3 +123,4 @@ cargo run --example account_age -- --input data/account_age_input.json -k 12 -p where `PROVIDER_URI` is a JSON-RPC URI, and `CMD` is `mock`, `prove`, `keygen`, or `run`. +Note that for the above example to work with the provied `data/account_age_input.json`, the `PROVIDER_URI` needs to be a JSON-RPC URI for Sepolia Testnet.