Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update aztec-wallet proving instructions #10953

Merged
merged 3 commits into from
Dec 24, 2024
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
11 changes: 10 additions & 1 deletion aztec-up/bin/aztec-wallet
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@ set -euo pipefail
export SKIP_PORT_ASSIGNMENT=1
export WALLET_DATA_DIRECTORY=$(dirname $0)/wallet-data
export BB_WORKING_DIRECTORY=$(dirname $0)/bb-workdir
export BB_BINARY_PATH=$(which bb)

if [ -z "${BB_BINARY_PATH:-}" ]; then
export BB_BINARY_PATH=$HOME/.bb/bb
fi

if [ ! -f $BB_BINARY_PATH ]; then
echo "bb binary does not exist at $BB_BINARY_PATH. Set BB_BINARY_PATH environment variable to the path of the bb binary."
exit 1
fi

export ENV_VARS_TO_INJECT="WALLET_DATA_DIRECTORY SSH_AUTH_SOCK PXE_PROVER_ENABLED BB_BINARY_PATH BB_WORKING_DIRECTORY"

mkdir -p $BB_WORKING_DIRECTORY
Expand Down
27 changes: 7 additions & 20 deletions docs/docs/guides/developer_guides/local_env/sandbox_proving.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,31 +40,18 @@ The sandbox will also deploy 3 Schnorr account contracts on startup. The sandbox
Once everything has been set up, you will see that the PXE is listening on `localhost:8080` as you would see with the sandbox running in the default mode. At this point you can use the sandbox as you would without client-side proving enabled.

## Proving with `aztec-wallet`
You can enable proving on a per-transaction basis using the `aztec-wallet` CLI.

### Config
Open `~/.aztec/bin/aztec-wallet` and update the `ENV_VARS_TO_INJECT` variable to:

```bash
# ~/.aztec/bin/aztec-wallet
export ENV_VARS_TO_INJECT="WALLET_DATA_DIRECTORY SSH_AUTH_SOCK BB_BINARY_PATH PXE_PROVER_ENABLED BB_WORKING_DIRECTORY"
```

Export the following envnironment variables in the terminal where you will run `aztec-wallet` commands:
You can enable proving on a per-transaction basis using the `aztec-wallet` CLI by setting the `PXE_PROVER_ENABLED` environment variable to `1`. This will use your local `bb` binary to prove the transaction.

```bash
export BB_BINARY_PATH=/usr/src/barretenberg/cpp/build/bin/bb
export PXE_PROVER_ENABLED=1
export BB_WORKING_DIRECTORY=~/bb-temp
PXE_PROVER_ENABLED=1 aztec-wallet create-account -a test
```

### Usage
Now send transactions from `aztec-wallet`, and proving will be enabled. Check the [Quickstart](../../getting_started.md) for a refresher on how to send transactions using `aztec-wallet` or check the [reference here](../../../reference/developer_references/cli_wallet_reference.md)
Check the [Quickstart](../../getting_started.md) for a refresher on how to send transactions using `aztec-wallet` or check the [reference here](../../../reference/developer_references/cli_wallet_reference.md)

Note that you do not need to restart the sandbox in order to start sending proven transactions. You can optionally set this for 1 off transactions.
Note that you do not need to restart the sandbox in order to start sending proven transactions. You can optionally set this for one-off transactions.

If this is the first time you are sending transactions with proving enabled, you will have to download the CRS (which is several GBs).
If this is the first time you are sending transactions with proving enabled, it will take a while to download a CRS file (which is several MBs) that is required for proving.

::: note
You can also profile your transactions to get gate count, if you don't want to prove your transactions but check how many constraints it is. Follow [reference here](../../../reference/developer_references/cli_wallet_reference.md#profile)
:::note
You can also profile your transactions to get gate count, if you don't want to prove your transactions but check how many constraints it is. Follow the [guide here](../../developer_guides/smart_contracts/profiling_transactions.md)
:::
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ In this guide, we will look at how to profile the private execution of a transac

- `aztec-nargo` installed (go to [Sandbox section](../../../reference/developer_references/sandbox_reference/sandbox-reference.md) for installation instructions)
- `aztec-wallet` installed (installed as part of the Sandbox)
- Aztec Sandbox running with **proving enabled** (go to [Sandbox PXE Proving](../local_env/sandbox_proving.md) for instructions)

## Profiling using aztec-wallet

Expand All @@ -35,6 +34,7 @@ aztec-wallet create-account -a owner
aztec-wallet create-account -a user

# Deploy a token contract and mint 100 tokens to the user
# Run this from noir-projects/noir-contracts to determine the path to the token_contract
aztec-wallet deploy token_contract@Token --args accounts:owner Test TST 18 -f owner -a token
aztec-wallet send mint_to_private -ca token --args accounts:owner accounts:user 100 -f owner
```
Expand All @@ -56,14 +56,14 @@ This will print the following results after some time:

```bash
Gate count per circuit:
SchnorrAccount:entrypoint Gates: 26,363 Acc: 26,363
private_kernel_init Gates: 34,887 Acc: 61,250
Token:transfer Gates: 28,229 Acc: 89,479
private_kernel_inner Gates: 57,530 Acc: 147,009
private_kernel_reset Gates: 86,600 Acc: 233,609
private_kernel_tail Gates: 13,045 Acc: 246,654

Total gates: 246,654
SchnorrAccount:entrypoint Gates: 26,487 Acc: 26,487
private_kernel_init Gates: 48,562 Acc: 75,049
Token:transfer Gates: 32,869 Acc: 107,918
private_kernel_inner Gates: 89,062 Acc: 196,980
private_kernel_reset Gates: 105,077 Acc: 302,057
private_kernel_tail Gates: 27,501 Acc: 329,558

Total gates: 329,558
```

Here you can see the gate count of each private function call in the transaction along with the kernel circuits needed in between, and the total gate count.
Expand Down
Loading