-
Create the Virtual Environment:
- Run the following command to create a virtual environment in the current directory:
python -m venv .venv
- Run the following command to create a virtual environment in the current directory:
-
Activate the Virtual Environment:
- For Unix or MacOS, activate the virtual environment with:
source .venv/bin/activate - For Windows, use:
.venv\Scripts\activate
- For Unix or MacOS, activate the virtual environment with:
-
Install Dependencies:
- Install the required packages from the
requirements.txtfile:pip install -r requirements.txt
- Install the required packages from the
-
Create the Resources Directory:
- Execute the following command to create a
resourcesdirectory:mkdir resources
- Execute the following command to create a
-
Add Configuration File:
- Create a file named
input.jsoninside theresourcesdirectory and paste the following JSON content into it:{ "prev_state_root": 34343434343, "block_number": 123456, "block_hash": 1234567890, "config_hash": 1234567890, "world_da": [ 3488041066649332616440110253331181934927363442882040970594983370166361489161, 633500000000000, 2080372569135727803323277605537468839623406868880224375222092136867736091483, 999999936 ], "message_to_starknet_segment": [123, 456, 123, 128], "message_to_appchain_segment": [123, 456, 123, 128], "nonce_updates": { "1": 12, "2": 1337 }, "storage_updates": { "1": { "123456789": 89, "987654321": 98 }, "2": { "123456789": 899, "987654321": 98 } }, "contract_updates": { "3": 437267489 }, "declared_classes": { "1234": 12345, "12345": 123456, "123456": 1234567 } }
- Create a file named
- To start the HTTP service, execute:
cargo run -p prover
- To send an HTTP request and generate a proof, run:
./scripts/prove.py < resources/input.json > resources/proof.json
This setup guide will help you to configure and run the necessary components for the project. Make sure you follow the steps in order to ensure everything functions as expected.
This guide provides instructions to generate sample agreements, set up Starknet Devnet, and deploy contracts on both Devnet and Sepolia.
Start by building the contract using the following command to ensure it compiles into deployable bytecode.
scarb build To generate sample agreements execute the following command:
cargo run -r --bin json_generator -- --agreements-count <number_of_agreements>Note: Generate new agreements eachtime you want to deploy contracts on sepolia
The generated outputs should be located in target/generator_output/, which will contain the necessary data for deploying the contract and applying agreements.
To launch Starknet Devnet, use the command:
starknet-devnet --seed 0Follow these steps to declare and deploy the agreement contract on Devnet:
-
Set Environment Variables
If non-existent, create file .cargo/config.toml to hold our enviroment variables. Add the necessary enviroment variables ADDRESS, PRIVATE_KEY.
export ADDRESS = "0x64b48806902a367c8598f4f95c305e8c1a1acba5f082d294a43793113115691" export PRIVATE_KEY = "0x71d7bb07b9a64f6f78ac4c816aff4da9"
The sample address and private_key can be used for devnet, for sepolia provide your sepolia-eth account details.
-
Run the Program on Devnet
cargo run --bin applier_runner
-
Run the Program on Sepolia
To run the program on sepolia change the RPC_URL in params or in enviroment variables.
RPC_URL = "https://free-rpc.nethermind.io/sepolia-juno/v0_7"Generate new agreements with:
cargo run -r --bin json_generator -- --agreements-count <number_of_agreements> Then execute the following code.
cargo run --bin applier_runner