Skip to main content


In this guide, you will

  1. Set up the Aztec sandbox locally
  2. Install the Aztec CLI
  3. Use the CLI to deploy an example contract that comes with the sandbox
  4. Use the CLI to interact with the contract you just deployed

... in less than 10 minutes.


  • Node.js >= v18 (recommend installing with nvm)
  • Docker and Docker Compose (Docker Desktop under WSL2 on windows)

Install the Sandbox

You can run the Sandbox using either Docker or npm. In this guide we will use Docker, but you can learn more about alternative installation methods here.

To install the latest Sandbox version, run:

/bin/bash -c "$(curl -fsSL '')"

This will attempt to run the Sandbox on localhost:8080, so you will have to make sure nothing else is running on that port or change the port defined in ./.aztec/docker-compose.yml. Running the command again will overwrite any changes made to the docker-compose.yml.

This command will also install the CLI if a node package version of the CLI isn't found locally.

Alternatively, you can run the sandbox as an npm package.

Deploy a contract using the CLI

The sandbox is preloaded with multiple accounts. Let's assign them to shell variables. Run the following in your terminal, so we can refer to the accounts as $ALICE and $BOB from now on:


The default accounts that come with sandbox will likely change over time. Save two of the "Initial accounts" that are printed in the terminal when you started the sandbox.

Source code: /yarn-project/end-to-end/src/guides/

Start by deploying a token contract. After it is deployed, we check that the deployment succeeded, and export the deployment address to use in future commands. For more detail on how the token contract works, see the token contract tutorial.

CONTRACT=$(aztec-cli deploy TokenContractArtifact --salt 0 --args $ALICE --json | jq -r '.address')
echo "Deployed contract at $CONTRACT"
aztec-cli check-deploy --contract-address $CONTRACT
Source code: /yarn-project/end-to-end/src/guides/

Note that the deployed contract address is exported, so we can use it as $CONTRACT later on.

Call a contract with the CLI

Alice is set up as the contract admin and token minter in the _initialize function. Let's get Alice some private tokens.

We need to export the SECRET and SECRET_HASH values in order to privately mint tokens. Private tokens are claimable by anyone with the pre-image to a provided hash, see more about how the token contract works in the token contract tutorial. After the tokens have been minted, the notes will have to added to the Private Execution Environment (PXE) to be consumed by private functions. Once added, Alice can claim them with the redeem_shield function. After this, Alice should have 1000 tokens in their private balance.


MINT_PRIVATE_OUTPUT=$(aztec-cli send mint_private \
--args 1000 $SECRET_HASH \
--contract-artifact TokenContractArtifact \
--contract-address $CONTRACT \
--private-key $ALICE_PRIVATE_KEY)

MINT_PRIVATE_TX_HASH=$(echo "$MINT_PRIVATE_OUTPUT" | grep "Transaction hash:" | awk '{print $NF}')

aztec-cli add-note \
--note 1000 $SECRET_HASH

aztec-cli send redeem_shield \
--args $ALICE 1000 $SECRET \
--contract-artifact TokenContractArtifact \
--contract-address $CONTRACT \
--private-key $ALICE_PRIVATE_KEY
Source code: /yarn-project/end-to-end/src/guides/

We can have Alice privately transfer tokens to Bob. Only Alice and Bob will know what's happened. Here, we use Alice's private key to send a transaction to transfer tokens to Bob. Once they are transferred, we can verify that it worked as expected by checking Alice's and Bob's balances:

aztec-cli send transfer \
--args $ALICE $BOB 500 0 \
--contract-artifact TokenContractArtifact \
--contract-address $CONTRACT \
--private-key $ALICE_PRIVATE_KEY

aztec-cli call balance_of_private \
--args $ALICE \
--contract-artifact TokenContractArtifact \
--contract-address $CONTRACT

aztec-cli call balance_of_private \
--args $BOB \
--contract-artifact TokenContractArtifact \
--contract-address $CONTRACT
Source code: /yarn-project/end-to-end/src/guides/

Alice and Bob should have 500 tokens.

Congratulations! You are all set up with the Aztec sandbox!

What's next?

To start writing your first smart contract, go to the next page.

You can also dig more into the sandbox and CLI here.