Skip to content

Instantly share code, notes, and snippets.

@Turupawn
Last active May 20, 2025 21:34
Show Gist options
  • Save Turupawn/4d0b48e97edbf18fbe8f85d78e1a085c to your computer and use it in GitHub Desktop.
Save Turupawn/4d0b48e97edbf18fbe8f85d78e1a085c to your computer and use it in GitHub Desktop.
Getting started with Noir: Hello World

Install the dependencies

curl -L https://raw.githubusercontent.com/noir-lang/noirup/refs/heads/main/install | bash
noirup
curl -L https://raw.githubusercontent.com/AztecProtocol/aztec-packages/refs/heads/master/barretenberg/bbup/install | bash
bbup

Create a new project

nargo new hello_world
cd hello_world
nargo check

Generate a proof

Prover.toml

x = "1"
y = "2"
nargo compile
nargo execute
bb prove -b ./target/hello_world.json -w ./target/hello_world.gz -o ./target  --oracle_hash keccak
bb write_vk -b target/hello_world.json -o target --oracle_hash keccak
bb write_solidity_verifier -k target/vk -o Verifier.sol

Now deply the HonkVerifier contract on Verifier.sol by setting the compiler optimization runs to 200.

Verify a proof

serialize_proof.sh

PROOF_HEX=$(cat ./target/proof | od -An -v -t x1 | tr -d $' \n' | sed 's/^.\{8\}//')

NUM_PUBLIC_INPUTS=1
HEX_PUBLIC_INPUTS=${PROOF_HEX:0:$((32 * $NUM_PUBLIC_INPUTS * 2))}
SPLIT_HEX_PUBLIC_INPUTS=$(sed -e 's/.\{64\}/0x&,/g' <<<$HEX_PUBLIC_INPUTS)

PROOF_WITHOUT_PUBLIC_INPUTS="${PROOF_HEX:$((NUM_PUBLIC_INPUTS * 32 * 2))}"

echo 0x$PROOF_WITHOUT_PUBLIC_INPUTS
echo [$SPLIT_HEX_PUBLIC_INPUTS]
sh serialize_proof.sh

Now pass the result of the console to the Honkverifier verify function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment