This is a simple Noir demo that shows how to use dependencies in a Noir project.
This circuit verifies a signature without revealing the signing address.
git clone https://github.com/Cyfrin/zk-ecrecover-cu.git
cd circuits
nargo check
Then fill in the inputs in the Prover.toml
file.
cast keccak "hello"
cast wallet sign --no-hash --accpunt <name-of-your-keystore> <bytes-output>
cast wallet public-key --account <name-of-your-keystore>
The first 32 bytes are the x value and the second 32 bytes are the y value.
Add the values in the file:
expectedAddress = "0x52d64ED1fd0877797e2030fc914259e052F2bD67"
hashed_message = "0x1c8aff950685c2ed4bc3174f3472287b56d9517b9c948127319a09a7a36deac8"
pub_key_x = "533367042c3e9456fec155940165c28c01fe6e28601337df50562ddc4f36bfb9"
pub_key_y = "7dcafe27cadbe10861bb67e0599382f79dc29c1d39d93b10f716c8ceff1743ed"
signature = "0xdd935f778351217ec02e6f857e47f0cea837380f30eccf63742b9a97cf1872b4316700b028504591f6b31203b86ccb3363353eedd8f9cf4f344a769c689525b31b"
chmod +x generate_inputs.sh
./generate_inputs.sh
Do this step if you want to create a verifier smart contract without creating a proof (if you want users to create witnesses and proofs later).
nargo compile
This step will also compile the circuit.
nargo execute
bb prove -b ./target/circuits.json -w ./target/circuits.gz -o ./target
bb prove --oracle_hash keccak -b ./target/circuits.json -w ./target/circuits.gz -o ./target
bb write_vk -b ./target/circuits.json -o ./target
bb write_vk --oracle_hash keccak -b ./target/circuits.json -o ./target
bb verify -k ./target/vk -p ./target/proof
bb write_solidity_verifier -k ./target/vk -o ./target/Verifier.sol