Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions docs/docs/how_to/how-to-solidity-verifier.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ keywords:
smart contract,
blockchain,
compiler,
plonk_vk.sol,
EVM blockchain,
verifying Noir programs,
proving backend,
Expand Down Expand Up @@ -43,13 +42,6 @@ Generating a Solidity Verifier with Barretenberg contract is actually a one-comm
2. How to compile the smart contract in the RemixIDE
3. How to deploy it to a testnet

:::info[Which proving system to use?]

Barretenberg currently provides two provers: `UltraPlonk` and `UltraHonk`. In a nutshell, `UltraHonk` is faster and uses less RAM, but its verifier contract is much more expensive. `UltraPlonk` is optimized for on-chain verification, but proving is more expensive.

In any case, we provide instructions for both. Choose your poison ☠️

:::

## Step 1 - Generate a contract

Expand All @@ -67,7 +59,7 @@ This will compile your source code into a Noir build artifact to be stored in th
bb write_vk -b ./target/<noir_artifact_name>.json -o ./target --oracle_hash keccak

# Generate the Solidity verifier from the vkey
bb write_solidity_verifier -k ./target/vk -o ../target/Verifier.sol
bb write_solidity_verifier -k ./target/vk -o ./target/Verifier.sol
```

replacing `<noir_artifact_name>` with the name of your Noir project. A `Verifier.sol` contract is now in the target folder and can be deployed to any EVM blockchain acting as a verifier smart contract.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ keywords:
smart contract,
blockchain,
compiler,
plonk_vk.sol,
EVM blockchain,
verifying Noir programs,
proving backend,
Expand Down Expand Up @@ -43,13 +42,6 @@ Generating a Solidity Verifier with Barretenberg contract is actually a one-comm
2. How to compile the smart contract in the RemixIDE
3. How to deploy it to a testnet

:::info[Which proving system to use?]

Barretenberg currently provides two provers: `UltraPlonk` and `UltraHonk`. In a nutshell, `UltraHonk` is faster and uses less RAM, but its verifier contract is much more expensive. `UltraPlonk` is optimized for on-chain verification, but proving is more expensive.

In any case, we provide instructions for both. Choose your poison ☠️

:::

## Step 1 - Generate a contract

Expand All @@ -67,7 +59,7 @@ This will compile your source code into a Noir build artifact to be stored in th
bb write_vk -b ./target/<noir_artifact_name>.json -o ./target --oracle_hash keccak

# Generate the Solidity verifier from the vkey
bb write_solidity_verifier -k ./target/vk -o ../target/Verifier.sol
bb write_solidity_verifier -k ./target/vk -o ./target/Verifier.sol
```

replacing `<noir_artifact_name>` with the name of your Noir project. A `Verifier.sol` contract is now in the target folder and can be deployed to any EVM blockchain acting as a verifier smart contract.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ keywords:
smart contract,
blockchain,
compiler,
plonk_vk.sol,
EVM blockchain,
verifying Noir programs,
proving backend,
Expand Down Expand Up @@ -43,13 +42,6 @@ Generating a Solidity Verifier with Barretenberg contract is actually a one-comm
2. How to compile the smart contract in the RemixIDE
3. How to deploy it to a testnet

:::info[Which proving system to use?]

Barretenberg currently provides two provers: `UltraPlonk` and `UltraHonk`. In a nutshell, `UltraHonk` is faster and uses less RAM, but its verifier contract is much more expensive. `UltraPlonk` is optimized for on-chain verification, but proving is more expensive.

In any case, we provide instructions for both. Choose your poison ☠️

:::

## Step 1 - Generate a contract

Expand All @@ -67,7 +59,7 @@ This will compile your source code into a Noir build artifact to be stored in th
bb write_vk -b ./target/<noir_artifact_name>.json -o ./target --oracle_hash keccak

# Generate the Solidity verifier from the vkey
bb write_solidity_verifier -k ./target/vk -o ../target/Verifier.sol
bb write_solidity_verifier -k ./target/vk -o ./target/Verifier.sol
```

replacing `<noir_artifact_name>` with the name of your Noir project. A `Verifier.sol` contract is now in the target folder and can be deployed to any EVM blockchain acting as a verifier smart contract.
Expand Down Expand Up @@ -140,14 +132,14 @@ Barretenberg attaches the public inputs to the proof, which in this case it's no
```bash
PROOF_HEX=$(cat ./target/proof | od -An -v -t x1 | tr -d $' \n' | sed 's/^.\{8\}//')

NUM_PUBLIC_INPUTS=2
NUM_PUBLIC_INPUTS=1 # Replace this with the number of public inputs in your circuit
HEX_PUBLIC_INPUTS=${PROOF_HEX:0:$((32 * $NUM_PUBLIC_INPUTS * 2))}
SPLIT_HEX_PUBLIC_INPUTS=$(sed -e 's/.\{64\}/0x&,/g' <<<$HEX_PUBLIC_INPUTS)
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]
echo "[${SPLIT_HEX_PUBLIC_INPUTS}]"
```
Comment on lines 132 to 143
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be really good to have this use snippets to pull from the examples directory

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True.
But this one is no longer required with latest bb, and is already removed from latest docs.

You can pass the proof and public inputs from above to the `verify` function in Remix.

Expand Down
Loading