diff --git a/docs/docs/getting_started.md b/docs/docs/getting_started.md index 1d1fa22519e..923d5e303a8 100644 --- a/docs/docs/getting_started.md +++ b/docs/docs/getting_started.md @@ -23,16 +23,14 @@ bash -i <(curl -s install.aztec.network) This will install the following tools: -- **aztec** - launches various infrastructure subsystems (sequencer, prover, pxe, etc). +- **aztec** - launches various infrastructure subsystems (full sandbox, sequencer, prover, pxe, etc) and provides utility commands to interact with the network - **aztec-nargo** - aztec's build of nargo, the noir compiler toolchain. -- **aztec-sandbox** - a wrapper around docker-compose that launches services needed for sandbox testing. - **aztec-up** - a tool to upgrade the aztec toolchain to the latest, or specific versions. -- **aztec-builder** - A useful tool for projects to generate ABIs and update their dependencies. Once these have been installed, to start the sandbox, run: ```bash -aztec-sandbox +aztec start --sandbox ``` ### Have fun @@ -63,7 +61,7 @@ If you wish to run components of the Aztec network stack separately, you can use aztec start --node [nodeOptions] --pxe [pxeOptions] --archiver [archiverOptions] --sequencer [sequencerOptions] --prover [proverOptions] ----p2p-bootstrap [p2pOptions] ``` -Starting the aztec node alongside a PXE, sequencer or archiver, will attach the components to the node.Eg if you want to run a PXE separately to a node, you can [read this guide](./aztec/concepts/pxe/index.md)/ +Starting the aztec node alongside a PXE, sequencer or archiver, will attach the components to the node. Eg if you want to run a PXE separately to a node, you can [read this guide](./aztec/concepts/pxe/index.md). ## Update the sandbox diff --git a/docs/docs/guides/local_env/versions-updating.md b/docs/docs/guides/local_env/versions-updating.md index c8f59f38d96..106225a6b29 100644 --- a/docs/docs/guides/local_env/versions-updating.md +++ b/docs/docs/guides/local_env/versions-updating.md @@ -86,7 +86,7 @@ Inside your project run: ```shell cd your/aztec/project -aztec-builder update . --contract src/contract1 --contract src/contract2 +aztec update . --contract src/contract1 --contract src/contract2 ``` The sandbox must be running for the update command to work. Make sure it is [installed and running](../../reference/sandbox_reference/sandbox-reference.md). @@ -104,16 +104,16 @@ There are four components whose versions need to be kept compatible: 3. `Aztec.nr`, the Noir framework for writing Aztec contracts First three are packaged together in docker and are kept compatible by running `aztec-up`. -But you need to update your Aztec.nr version manually or using `aztec-builder update`. +But you need to update your Aztec.nr version manually or using `aztec update`. ## Updating Aztec.nr packages ### Automatic update -`aztec-builder` will update your Aztec.nr packages to the appropriate version with the `aztec-builder update` command. Run this command from the root of your project and pass the paths to the folders containing the Nargo.toml files for your projects like so: +You can update your Aztec.nr packages to the appropriate version with the `aztec update` command. Run this command from the root of your project and pass the paths to the folders containing the Nargo.toml files for your projects like so: ```shell -aztec-builder update . --contract src/contract1 --contract src/contract2 +aztec update . --contract src/contract1 --contract src/contract2 ``` ### Manual update diff --git a/docs/docs/guides/smart_contracts/how_to_compile_contract.md b/docs/docs/guides/smart_contracts/how_to_compile_contract.md index 605d8050421..c63d7e28876 100644 --- a/docs/docs/guides/smart_contracts/how_to_compile_contract.md +++ b/docs/docs/guides/smart_contracts/how_to_compile_contract.md @@ -39,7 +39,7 @@ members = [ You can use the code generator to autogenerate type-safe typescript classes for each of your contracts. These classes define type-safe methods for deploying and interacting with your contract based on their artifact. ```bash -aztec-builder codegen ./aztec-nargo/output/target/path -o src/artifacts +aztec codegen ./aztec-nargo/output/target/path -o src/artifacts ``` Below is typescript code generated from the [Token](https://github.com/AztecProtocol/aztec-packages/blob/master/noir-projects/noir-contracts/contracts/token_contract/src/main.nr) contract: diff --git a/docs/docs/guides/smart_contracts/how_to_deploy_contract.md b/docs/docs/guides/smart_contracts/how_to_deploy_contract.md index 710bd8cc40a..eb07475b884 100644 --- a/docs/docs/guides/smart_contracts/how_to_deploy_contract.md +++ b/docs/docs/guides/smart_contracts/how_to_deploy_contract.md @@ -26,7 +26,7 @@ aztec-nargo compile Generate the typescript class: ```bash -aztec-builder codegen ./aztec-nargo/output/target/path -o src/artifacts +aztec codegen ./aztec-nargo/output/target/path -o src/artifacts ``` This would create a typescript file like `Example.ts` in `./src/artifacts`. Read more on the [compiling page](how_to_compile_contract.md). diff --git a/docs/docs/reference/sandbox_reference/cli_reference.md b/docs/docs/reference/sandbox_reference/cli_reference.md new file mode 100644 index 00000000000..808e83ea9c2 --- /dev/null +++ b/docs/docs/reference/sandbox_reference/cli_reference.md @@ -0,0 +1,376 @@ +--- +title: CLI Reference +--- + +:::warning + +`aztec-builder` and `aztec-sandbox` have been deprecated in favor of `aztec` CLI + +::: +- [Start](#starting-and-testing) +- [Accounts](#account-management) +- [Contract deployments and interaction](#contract-deployment-and-interaction) +- [Network and node info](#network-and-node-information) +- [Querying](#transaction-and-block-querying) +- [Logging](#logging-and-data-retrieval) +- [Debugging](#development-and-debugging-tools) +- [L1 contracts](#l1-contract-management) +- [Utils](#utility-commands) + +## Starting and testing + +### start + +Initiates various Aztec modules. It can be used to start individual components or the entire Aztec Sandbox. + +``` +aztec start [options] +``` + +Options: +- `-sb, --sandbox`: Starts the Aztec Sandbox. +- `-p, --port `: Specifies the port to run Aztec on (default: 8080). +- `-n, --node [options]`: Starts the Aztec Node with specified options. +- `-px, --pxe [options]`: Starts the PXE (Private eXecution Environment) with specified options. +- `-a, --archiver [options]`: Starts the Archiver with specified options. +- `-s, --sequencer [options]`: Starts the Sequencer with specified options. +- `-r, --prover [options]`: Starts the Prover Agent with specified options. +- `-o, --prover-node [options]`: Starts the Prover Node with specified options. +- `-p2p, --p2p-bootstrap [options]`: Starts the P2P Bootstrap node with specified options. +- `-t, --txe [options]`: Starts the TXE (Transaction Execution Environment) with specified options. + +### test + +Runs tests written in contracts. + +``` +aztec test [options] +``` + +Options: +- `--workdir `: Sets the working directory inside the container (default: current directory). +- `-e, --env `: Set environment variables (can be used multiple times). +- `--no-tty`: Run the container without a TTY. +- `--rm`: Automatically remove the container when it exits. +- `-i, --interactive`: Keep STDIN open even if not attached. +- `-t, --tty`: Allocate a pseudo-TTY. + +## Account Management + +### create-account +Creates an Aztec account for sending transactions. + +``` +aztec create-account [options] +``` + +Options: +- `--skip-initialization`: Skip initializing the account contract. +- `--public-deploy`: Publicly deploys the account and registers the class if needed. +- `--private-key `: Private key for the account (uses random by default). +- `--register-only`: Just register the account on the PXE without deploying. +- `--no-wait`: Skip waiting for the contract deployment. + +### get-accounts +Retrieves all Aztec accounts stored in the PXE. + +``` +aztec get-accounts [options] +``` + +Options: +- `--json`: Emit output as JSON. + +### get-account +Retrieves an account given its Aztec address. + +``` +aztec get-account
[options] +``` + +### register-recipient +Registers a recipient in the PXE. + +``` +aztec register-recipient [options] +``` + +Required options: +- `-a, --address `: The account's Aztec address. +- `-p, --public-key `: The account public key. +- `-pa, --partial-address `: The partially computed address of the account contract. + +## Contract Deployment and Interaction + +### deploy +Deploys a compiled Aztec.nr contract to Aztec. + +``` +aztec deploy [options] +``` + +Options: +- `--init `: The contract initializer function to call (default: "constructor"). +- `--no-init`: Leave the contract uninitialized. +- `-a, --args `: Contract constructor arguments. +- `-k, --public-key `: Optional encryption public key for this address. +- `-s, --salt `: Optional deployment salt for generating the deployment address. +- `--universal`: Do not mix the sender address into the deployment. +- `--json`: Emit output as JSON. +- `--no-wait`: Skip waiting for the contract deployment. +- `--no-class-registration`: Don't register this contract class. +- `--no-public-deployment`: Don't emit this contract's public bytecode. + +### send +Calls a function on an Aztec contract. + +``` +aztec send [options] +``` + +Options: +- `-a, --args [functionArgs...]`: Function arguments. +- `-c, --contract-artifact `: Compiled Aztec.nr contract's ABI. +- `-ca, --contract-address
`: Aztec address of the contract. +- `--no-wait`: Print transaction hash without waiting for it to be mined. + +### call +Simulates the execution of a view (read-only) function on a deployed contract. + +``` +aztec call [options] +``` + +Options: +- `-a, --args [functionArgs...]`: Function arguments. +- `-c, --contract-artifact `: Compiled Aztec.nr contract's ABI. +- `-ca, --contract-address
`: Aztec address of the contract. +- `-f, --from `: Aztec address of the caller. + +### add-contract +Adds an existing contract to the PXE. + +``` +aztec add-contract [options] +``` + +Required options: +- `-c, --contract-artifact `: Compiled Aztec.nr contract's ABI. +- `-ca, --contract-address
`: Aztec address of the contract. +- `--init-hash `: Initialization hash. + +Optional: +- `--salt `: Optional deployment salt. +- `-p, --public-key `: Optional public key for this contract. +- `--portal-address
`: Optional address to a portal contract on L1. +- `--deployer-address
`: Optional address of the contract deployer. + +## Network and Node Information + +### get-node-info +Retrieves information about an Aztec node at a URL. + +``` +aztec get-node-info [options] +``` + +### get-pxe-info +Retrieves information about a PXE at a URL. + +``` +aztec get-pxe-info [options] +``` + +### block-number +Retrieves the current Aztec L2 block number. + +``` +aztec block-number [options] +``` + +## Transaction and Block Querying + +### get-tx +Retrieves the receipt for a specified transaction hash. + +``` +aztec get-tx [options] +``` + +### get-block +Retrieves information for a given block or the latest block. + +``` +aztec get-block [blockNumber] [options] +``` + +Options: +- `-f, --follow`: Keep polling for new blocks. + +## Logging and Data Retrieval + +### get-logs +Retrieves unencrypted logs based on filter parameters. + +``` +aztec get-logs [options] +``` + +Options: +- `-tx, --tx-hash `: Transaction hash to get the receipt for. +- `-fb, --from-block `: Initial block number for getting logs. +- `-tb, --to-block `: Up to which block to fetch logs. +- `-al --after-log `: ID of a log after which to fetch the logs. +- `-ca, --contract-address
`: Contract address to filter logs by. +- `--follow`: Keep polling for new logs until interrupted. + +### add-note +Adds a note to the database in the PXE. + +``` +aztec add-note
[options] +``` + +Required option: +- `-n, --note [note...]`: The members of a Note serialized as hex strings. + +## Development and Debugging Tools + +### codegen +Validates and generates an Aztec Contract ABI from Noir ABI. + +``` +aztec codegen [options] +``` + +Options: +- `-o, --outdir `: Output folder for the generated code. +- `--force`: Force code generation even when the contract has not changed. + +### update +Updates Nodejs and Noir dependencies. + +``` +aztec update [projectPath] [options] +``` + +Options: +- `--contract [paths...]`: Paths to contracts to update dependencies. +- `--aztec-version `: The version to update Aztec packages to (default: latest). + +### inspect-contract +Shows a list of external callable functions for a contract. + +``` +aztec inspect-contract +``` + +### parse-parameter-struct +Helper for parsing an encoded string into a contract's parameter struct. + +``` +aztec parse-parameter-struct [options] +``` + +Required options: +- `-c, --contract-artifact `: Compiled Aztec.nr contract's ABI. +- `-p, --parameter `: The name of the struct parameter to decode into. + +## L1 Contract Management + +### deploy-l1-contracts +Deploys all necessary Ethereum contracts for Aztec. + +``` +aztec deploy-l1-contracts [options] +``` + +Required options: +- `-u, --rpc-url `: URL of the Ethereum host. +- `-pk, --private-key `: The private key to use for deployment. + +### deploy-l1-verifier +Deploys the rollup verifier contract. + +``` +aztec deploy-l1-verifier [options] +``` + +Required options: +- `--eth-rpc-url `: URL of the Ethereum host. +- `-pk, --private-key `: The private key to use for deployment. +- `--verifier `: Either 'mock' or 'real'. + +### bridge-l1-gas +Mints L1 gas tokens and pushes them to L2. + +``` +aztec bridge-l1-gas [options] +``` + +Required option: +- `--l1-rpc-url `: URL of the Ethereum host. + +### get-l1-balance +Gets the balance of gas tokens in L1 for a given Ethereum address. + +``` +aztec get-l1-balance [options] +``` + +Required option: +- `--l1-rpc-url `: URL of the Ethereum host. + +## Utility Commands + +### generate-keys +Generates encryption and signing private keys. + +``` +aztec generate-keys [options] +``` + +Option: +- `-m, --mnemonic`: Optional mnemonic string for private key generation. + +### generate-p2p-private-key +Generates a LibP2P peer private key. + +``` +aztec generate-p2p-private-key +``` + +### example-contracts +Lists the example contracts available to deploy from @aztec/noir-contracts.js. + +``` +aztec example-contracts +``` + +### compute-selector +Computes a selector for a given function signature. + +``` +aztec compute-selector +``` + +### bootstrap +Bootstraps the blockchain. + +``` +aztec bootstrap [options] +``` + +### sequencers +Manages or queries registered sequencers on the L1 rollup contract. + +``` +aztec sequencers [who] [options] +``` + +Commands: list, add, remove, who-next + +Required option: +- `--l1-rpc-url `: URL of the Ethereum host. + +Note: Most commands accept a `--rpc-url` option to specify the Aztec node URL, and many accept fee-related options for gas limit and price configuration. \ No newline at end of file diff --git a/docs/docs/reference/sandbox_reference/index.md b/docs/docs/reference/sandbox_reference/index.md index ba339531a85..8511fb8bc58 100644 --- a/docs/docs/reference/sandbox_reference/index.md +++ b/docs/docs/reference/sandbox_reference/index.md @@ -15,4 +15,4 @@ The current sandbox does not generate or verify proofs, but provides a working e ## Command line tools -Aztec-nargo and aztec-builder are command-line tool allowing you to compile smart contracts. See the [compiling contracts](../../guides/smart_contracts/how_to_compile_contract.md) page for more information. \ No newline at end of file +Aztec-nargo and aztec CLI are command-line tool allowing you to compile smart contracts. See the [compiling contracts](../../guides/smart_contracts/how_to_compile_contract.md) page for more information. \ No newline at end of file diff --git a/docs/docs/tutorials/contract_tutorials/advanced/token_bridge/3_withdrawing_to_l1.md b/docs/docs/tutorials/contract_tutorials/advanced/token_bridge/3_withdrawing_to_l1.md index a8a71c3cf0e..19e90a10f5d 100644 --- a/docs/docs/tutorials/contract_tutorials/advanced/token_bridge/3_withdrawing_to_l1.md +++ b/docs/docs/tutorials/contract_tutorials/advanced/token_bridge/3_withdrawing_to_l1.md @@ -84,7 +84,7 @@ You may get some unused variable warnings - you can ignore these. And generate the TypeScript interface for the contract and add it to the test dir. Run this inside `aztec-contracts/token_bridge`: ```bash -aztec-builder codegen target -o ../../src/test/fixtures +aztec codegen target -o ../../src/test/fixtures ``` This will create a TS interface inside `fixtures` dir in our `src/test` folder! diff --git a/docs/docs/tutorials/contract_tutorials/counter_contract.md b/docs/docs/tutorials/contract_tutorials/counter_contract.md index 8d140da25f3..1e138b93286 100644 --- a/docs/docs/tutorials/contract_tutorials/counter_contract.md +++ b/docs/docs/tutorials/contract_tutorials/counter_contract.md @@ -48,15 +48,9 @@ Your structure should look like this: The file `main.nr` will soon turn into our smart contract! -Add the following dependencies to `Nargo.toml`: +Add the following dependencies to `Nargo.toml` under the autogenerated content: ```toml -[package] -name = "counter" -type = "contract" -authors = [""] -compiler_version = ">=0.28.0" - [dependencies] aztec = { git="https://github.com/AztecProtocol/aztec-packages/", tag="#include_aztec_version", directory="noir-projects/aztec-nr/aztec" } value_note = { git="https://github.com/AztecProtocol/aztec-packages/", tag="#include_aztec_version", directory="noir-projects/aztec-nr/value-note"} @@ -78,17 +72,13 @@ This defines a contract called `Counter`. We need to define some imports. -Write this within your contract at the top +Write this within your contract at the top: #include_code imports /noir-projects/noir-contracts/contracts/counter_contract/src/main.nr rust -`context::{PrivateContext, Context}` - -Context gives us access to the environment information such as `msg.sender`. We are also importing `PrivateContext` to access necessary information for our private functions. We’ll be using it in the next step. - -`map::Map` +`AztecAddress, Map` -Map is a private state variable that functions like a dictionary, relating Fields to other state variables. +`AztecAddress` is a type for storing contract (including account) addresses. `Map` is a private state variable that functions like a dictionary, relating Fields to other state variables. `value_note` @@ -150,14 +140,14 @@ In `./contracts/counter/` directory, run this: aztec-nargo compile ``` -This will compile the smart contract and create a `target` folder with a `.json` artifact inside. +This will compile the smart contract and create a `target` folder with a `.json` artifact inside. Do not worry if you see some warnings - Aztec is in fast development and it is likely you will see some irrelevant warning messages. -After compiling, you can generate a typescript class using `aztec-builder`'s `codegen` command. (See `aztec-builder help codegen` for syntax). +After compiling, you can generate a typescript class using `aztec codegen` command. In the same directory, run this: ```bash -aztec-builder codegen -o src/artifacts target +aztec codegen -o src/artifacts target ``` You can now use the artifact and/or the TS class in your Aztec.js! diff --git a/docs/docs/tutorials/contract_tutorials/private_voting_contract.md b/docs/docs/tutorials/contract_tutorials/private_voting_contract.md index 667720f466f..2d6b4342f67 100644 --- a/docs/docs/tutorials/contract_tutorials/private_voting_contract.md +++ b/docs/docs/tutorials/contract_tutorials/private_voting_contract.md @@ -21,7 +21,7 @@ To keep things simple, we won't create ballots or allow for delegate voting. ## Prerequisites -- You have followed the [quickstart](../../getting_started.md) to install `aztec-nargo` and `aztec-sandbox`. +- You have followed the [quickstart](../../getting_started.md) to install `aztec-nargo` and `aztec`. - Running Aztec Sandbox ## Set up a project @@ -160,10 +160,10 @@ aztec-nargo compile This will create a new directory called `target` and a JSON artifact inside it. -Use the `aztec-builder` to generate the Typescript artifact for the contract: +Use `aztec codegen` to generate the Typescript artifact for the contract: ```bash -aztec-builder codegen target --outdir src/artifacts +aztec codegen target --outdir src/artifacts ``` Once it is compiled you can [deploy](../../guides/smart_contracts/how_to_deploy_contract.md) it to the sandbox. diff --git a/docs/docs/tutorials/contract_tutorials/token_contract.md b/docs/docs/tutorials/contract_tutorials/token_contract.md index 58e1c8db21b..a01271af73f 100644 --- a/docs/docs/tutorials/contract_tutorials/token_contract.md +++ b/docs/docs/tutorials/contract_tutorials/token_contract.md @@ -480,7 +480,7 @@ aztec-nargo compile Once your contract is compiled, optionally generate a typescript interface with the following command: ```bash -aztec-builder target -o src/artifacts +aztec codegen target -o src/artifacts ``` ## Next Steps