These are the steps to follow to run a given Cairo program (
program.cairo) with an
associated input file (
One-time only. If this step has been completed, begin from “Activate environment”.
Cairo is python based. An easy way to get started is:
Navigate to a directory where you would like to install Cairo and create and
activate a virtual environment called
python3 -m cairo_venv . source cairo_venv/bin/activate
cairo-lang using pip.
pip3 install cairo-lang
For troubleshooting, see the official docs.
Activate the python virtual environment
Use the command line interface
There are different commands available, each command can be called with the
for an explanation of what it is and how to use it (e.g.,
The commands are:
Compile the code to produce and output called
cairo-compile program.cairo --output compiled_program.json
cairo-run --program=compiled_program.json --program_input=input.json \ --print_output --layout=small --tracer
Send the code for proving
This instruction sends the
input.json to the SHARP
cairo-sharp submit --source program.cairo --program_input input.json
Interact with proof
You can navigate to the on-chain verifier contract.
The contract can be queried with a read method
isValid. Passing the fact hash
True once the SHARP service has created the proof, bundled it, and
sent it to the contract.
Using the proof
You can deploy a smart contract which can integrate the proof as part of a larger application. More details can be found in this solidity skeleton.