Skip to content

Commit 7003853

Browse files
authored
chore(docs): Update install script (AztecProtocol#3847)
Updates the docker install script to get the sandbox, cli and nargo. ~~just verify that the LSP works with aztec-nargo. suggestions to install nargo have been removed.~~ EDIT: I added the recommendation to install nargo back in for the LSP. Closes: AztecProtocol#3846 # Checklist: Remove the checklist to signal you've completed it. Enable auto-merge if the PR is ready to merge. - [ ] If the pull request requires a cryptography review (e.g. cryptographic algorithm implementations) I have added the 'crypto' tag. - [x] I have reviewed my diff in github, line by line and removed unexpected formatting changes, testing logs, or commented-out code. - [x] Every change is related to the PR description. - [x] I have [linked](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) this pull request to relevant issues (if any exist).
1 parent a2b267b commit 7003853

21 files changed

+230
-128
lines changed

docs/docs/concepts/advanced/contract_creation.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ The `deployedContracts` array has a maximum size `MAX_NUM_DEPLOYED_CONTRACTS`. I
206206

207207
Excluding these steps, constructor function call is executed identically to a regular private function.
208208

209-
> Under this design, if a public constructor is desired, one must create a private constructor function that then calls a public function. This could be abstracted away by the Noir++ compiler.
209+
> Under this design, if a public constructor is desired, one must create a private constructor function that then calls a public function. This could be abstracted away by the aztec-nargo compiler.
210210
211211
**Q: why can't deployments be part of the public fn callstack?**
212212

docs/docs/dev_docs/cli/blank_box.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ See the Quickstart page for [requirements](../getting_started/quickstart.md#requ
2020

2121
Aztec Boxes use [yarn](https://classic.yarnpkg.com/) for package management, so if you want to follow along exactly, make sure you have it [installed](https://classic.yarnpkg.com/en/docs/install).
2222

23-
You will also need to install Noir to compile contracts. You can find instructions for installing the latest version of Noir that is compatible with the Sandbox on the [Aztec.nr Contracts](../contracts/main.md#install-noir) page.
23+
You will also need to install Aztec tooling to compile contracts. You can find instructions for installing the latest version [here](../cli/sandbox-reference.md).
2424

2525
## Getting the Box
2626

docs/docs/dev_docs/cli/cli-commands.md

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ This command does a few things to manage updates:
4949
- It looks for `Nargo.toml` at the `--contract` paths specified and updates all `aztec.nr` dependencies to the versions the sandbox expects.
5050
- It outputs the changes.
5151

52+
You can specify a version to update to with the `--aztec-version` flag, but it defaults to `latest` so this is typically not necessary.
5253

5354
:::info
5455

docs/docs/dev_docs/cli/main.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ These provide a self contained environment which deploys Aztec on a local (empty
3232

3333
The current sandbox does not generate or verify proofs, but provides a working end to end developer flow for writing and interacting with Aztec.nr smart contracts.
3434

35-
## Aztec CLI
35+
## Aztec CLI and aztec-nargo
3636

37-
The Aztec CLI is a command-line tool allowing the user to interact directly with the Aztec network and sandbox.
37+
The Aztec CLI is a command-line tool allowing you to interact directly with the Aztec network and sandbox.
3838

39-
It aims to provide all of the functionality required to deploy, compile, and invoke contracts and query system state such as contract data, transactions and emitted logs.
39+
It aims to provide all of the functionality required to deploy, and invoke contracts and query system state such as contract data, transactions and emitted logs.
40+
41+
Use `aztec-nargo` for compiling contracts. See the [compiling contracts](../contracts/compiling.md) page for more information.

docs/docs/dev_docs/cli/sandbox-reference.md

+33-9
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,44 @@ You can run the Sandbox using Docker. See the [Quickstart](../getting_started/qu
1111
### With Docker
1212

1313
```bash
14-
/bin/bash -c "$(curl -fsSL 'https://sandbox.aztec.network')"
14+
bash -i <(curl -s install.aztec.network)
1515
```
1616

17-
This will attempt to run the Sandbox on ` localhost:8080`. You can change the port defined in `./.aztec/docker-compose.yml`. Running the command again will overwrite any changes made to the `docker-compose.yml`.
17+
This will install the following:
1818

19-
This command also installs or updates the CLI. If you have previously installed the CLI via a node package manager, you will need to uninstall it and remove it from your project dependencies and install it via Docker.
19+
- **aztec** - launches various infrastructure subsystems (sequencer, prover, pxe, etc).
20+
- **aztec-cli** - a command line tool for interfacing and experimenting with infrastructure.
21+
- **aztec-nargo** - aztec's build of nargo, the noir compiler toolchain.
22+
- **aztec-sandbox** - a wrapper around docker-compose that launches services needed for sandbox testing.
23+
- **aztec-up** - a tool to upgrade the aztec toolchain to the latest, or specific versions.
24+
25+
Once these have been installed, to start the sandbox, run:
26+
27+
```bash
28+
aztec-sandbox
29+
```
30+
31+
This will attempt to run the Sandbox with the PXE listening on ` localhost:8080`. You can change the port defined in `./.aztec/docker-compose.yml` or by setting the `PXE_PORT` environment variable. Running the install command again will overwrite any changes made to the `docker-compose.yml`.
32+
33+
See the full list of configurable environment variables [here](#environment-variables).
34+
35+
If you have previously installed the CLI via a node package manager, you will need to uninstall it and remove it from your project dependencies and install it via Docker.
2036

2137
To install a specific version of the sandbox, you can set the environment variable `SANDBOX_VERSION`
2238

2339
```bash
24-
SANDBOX_VERSION=<version> /bin/bash -c "$(curl -fsSL 'https://sandbox.aztec.network')"
40+
VERSION=<version> bash -i <(curl -s install.aztec.network)
2541
```
2642

2743
## Running
2844

29-
The installation command will run the sandbox, and once installed you can run like so:
45+
Once the installed, you can run the sandbox with:
46+
47+
```bash
48+
aztec-sandbox
49+
```
50+
51+
Alternatively, you can run like so:
3052

3153
```bash
3254
cd ~/.aztec && docker-compose up
@@ -37,12 +59,10 @@ cd ~/.aztec && docker-compose up
3759
If you wish to run components of the Aztec network stack separately, you can still use the Sandbox by including a `MODE` variable.
3860
The values for `MODE` can be:
3961

40-
```
4162
- sandbox (default)
4263
- node
4364
- pxe
4465
- p2p-bootstrap
45-
```
4666

4767
## Environment Variables
4868

@@ -152,21 +172,25 @@ We have shipped a number of example contracts in the `@aztec/noir-contracts` [np
152172
BenchmarkingContractArtifact
153173
CardGameContractArtifact
154174
ChildContractArtifact
175+
CounterContractArtifact
155176
DocsExampleContractArtifact
156177
EasyPrivateTokenContractArtifact
178+
EasyPrivateVotingContractArtifact
157179
EcdsaAccountContractArtifact
158180
EscrowContractArtifact
159181
ImportTestContractArtifact
182+
InclusionProofsContractArtifact
160183
LendingContractArtifact
161184
ParentContractArtifact
162185
PendingCommitmentsContractArtifact
163-
PokeableTokenContractArtifact
164186
PriceFeedContractArtifact
165187
SchnorrAccountContractArtifact
166188
SchnorrHardcodedAccountContractArtifact
167189
SchnorrSingleKeyAccountContractArtifact
190+
SlowTreeContractArtifact
168191
StatefulTestContractArtifact
169192
TestContractArtifact
193+
TokenBlacklistContractArtifact
170194
TokenBridgeContractArtifact
171195
TokenContractArtifact
172196
UniswapContractArtifact
@@ -180,4 +204,4 @@ You can see all of our example contracts in the monorepo [here](https://github.c
180204

181205
The sandbox is shipped with full-stack Aztec project templates, with example Aztec.nr contracts, testing scripts, and web interfaces.
182206

183-
You can read more information about how to use boxes [here](./blank_box.md)
207+
You can read more information about how to use boxes [here](./blank_box.md).

docs/docs/dev_docs/contracts/deploying.md

+11-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Once you have [compiled](./compiling.md) your contracts you can proceed to deplo
44

55
## Prerequisites
66

7-
- `aztec-cli` installed (go to [CLI main section](../cli/main.md) for installation instructions)
7+
- `aztec-cli` and `aztec-nargo` installed (go to [CLI main section](../cli/main.md) for installation instructions)
88
- contract artifacts ready (go to [Compiling contracts section](./compiling.md) for instructions on how to compile contracts)
99
- aztec-sandbox running (go to [Sandbox section](../getting_started/quickstart.md) for instructions on how to install and run the sandbox)
1010

@@ -27,11 +27,19 @@ aztec-cli deploy /path/to/contract/artifact.json
2727

2828
Pre-requisite - Compile the contract and generate a type-safe typescript class for it.
2929

30+
Compile the contract:
31+
32+
```bash
33+
aztec-nargo compile
34+
```
35+
36+
Generate the ABI and typescript class:
37+
3038
```bash
31-
aztec-cli compile /path/to/contract -o target/ -ts target/
39+
aztec-cli codegen ./aztec-nargo/output/target/path -o src/artifacts --ts
3240
```
3341

34-
This would create a typescript file like `Example.ts` in the path specified. More details in the [compiling page](./compiling.md)
42+
This would create a typescript file like `Example.ts` in `./src/artifacts`. Read more on the [compiling page](./compiling.md).
3543

3644
Now you can import it to easily deploy and interact with the contract.
3745

docs/docs/dev_docs/contracts/main.md

+5-7
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,25 @@ An **Aztec smart contract** is a smart contract with **private** state variables
1818

1919
# Getting started
2020

21-
## Install Noir
21+
## Install aztec-nargo
2222

23-
To write an Aztec.nr contract, you need to write Noir, [aztec-cli](../cli/cli-commands) comes with a built-in compiler for Noir contracts.
23+
To write an Aztec.nr contract, you need to write Noir, `aztec-nargo` comes with a built-in compiler for Aztec contracts written in Noir. See install instructions [here](../cli/sandbox-reference.md).
2424

2525
:::info
26-
For those coming from vanilla Noir, the version used for aztec.nr is tracked separately to nargo for vanilla noir, so be sure to use the nargo version shown above
26+
For those coming from vanilla Noir, the version used for aztec.nr is tracked separately to nargo for vanilla Noir. Be sure to use `aztec-nargo` to compile your contracts.
2727
:::
2828

2929
## Install `nargo` (recommended)
3030

31-
The CLI comes with the Noir compiler, so installing `nargo` is not required, however it is recommended as it provides a better developer experience for writing contracts. You will need nargo installed to take advantage of the [Noir Language Server](https://noir-lang.org/nargo/language_server), which provides syntax highlighting and formatting for your Aztec contracts.
32-
33-
You will also need `nargo` if you want to run unit tests in Noir.
31+
`aztec-nargo` comes with the Noir compiler, so installing `nargo` is not required, however it is recommended as it provides a better developer experience for writing contracts. You will need nargo installed to take advantage of the [Noir Language Server](https://noir-lang.org/nargo/language_server), which provides syntax highlighting and formatting for your Aztec contracts.
3432

3533
You can install `nargo` with the following commands:
3634

3735
<InstallNargoInstructions />
3836

3937
## Install Noir tooling
4038

41-
There are a number of tools to make writing Aztec.nr contracts more pleasant. See [here](https://github.com/noir-lang/awesome-noir#get-coding).
39+
There are a number of tools to make writing Aztec.nr contracts in Noir more pleasant. See [here](https://github.com/noir-lang/awesome-noir#get-coding).
4240

4341
## Tutorials
4442

docs/docs/dev_docs/contracts/resources/dependencies.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@ This allows you to use authentication witnesses in your contract. Find more abou
2626
address_note = { git="https://github.com/AztecProtocol/aztec-packages/", tag="#include_aztec_version", directory="yarn-project/aztec-nr/address-note" }
2727
```
2828

29-
## Assets
30-
31-
```toml
32-
assets = { git="https://github.com/AztecProtocol/aztec-packages/", tag="#include_aztec_version", directory="yarn-project/aztec-nr/assets" }
33-
```
34-
3529
This is a library for utilizing notes that hold addresses. Find it on [GitHub](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/aztec-nr/address-note/src).
3630

3731
## Easy private state
@@ -42,6 +36,14 @@ easy_private_state = { git="https://github.com/AztecProtocol/aztec-packages/", t
4236

4337
This is an abstraction library for using private variables like [`EasyPrivateUint`](https://github.com/AztecProtocol/aztec-packages/blob/6c20b45993ee9cbd319ab8351e2722e0c912f427/yarn-project/aztec-nr/easy-private-state/src/easy_private_state.nr#L17).
4438

39+
## Protocol Types
40+
41+
```toml
42+
protocol_types = { git="https://github.com/AztecProtocol/aztec-packages/", tag="#include_aztec_version", directory="yarn-project/noir-protocol-circuits/src/crates/types"}
43+
```
44+
45+
This library contains types that are used in the Aztec protocol. Find it on [GitHub](https://github.com/AztecProtocol/aztec-packages/tree/master/yarn-project/noir-protocol-circuits/src/crates/types/src).
46+
4547
## Safe math
4648

4749
```toml

docs/docs/dev_docs/contracts/setup.md

+5-10
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,13 @@ If you haven't read about [Aztec.nr](./main.md), we recommend going there first.
1414

1515
### Dependencies
1616

17-
#### `nargo`
18-
19-
Nargo is Noir's build tool. On your terminal, run:
20-
21-
<InstallNargoInstructions />
22-
2317
#### Aztec Sandbox
2418

2519
You need to setup the [Aztec sandbox](../getting_started/quickstart.md).
2620

2721
<!-- TODO([#1056](https://github.com/AztecProtocol/aztec-packages/issues/1056)): Add a step for the starter kit -->
2822

29-
## Set up for aztec.nr contracts
23+
## Setup for Aztec.nr contracts
3024

3125
1. Inside the yarn project you created from the [Sandbox page](../getting_started/quickstart.md), create a sub-folder where the contracts will reside.
3226

@@ -36,14 +30,14 @@ mkdir contracts
3630

3731
All contract projects will reside within this folder. Note that contracts don't actually have to live here and this is just a style choice.
3832

39-
2. Next, create a noir project using nargo by running the following in the terminal from the `contracts` folder
33+
1. Next, create an Aztec contract project using aztec-nargo by running the following in the terminal from the `contracts` folder
4034

4135
```bash
4236
cd contracts
43-
nargo new --contract example_contract
37+
aztec-nargo new --contract example_contract
4438
```
4539

46-
This creates `example_contract` directory within contracts which is a noir project with:
40+
This creates `example_contract` directory within contracts which is a Noir project with:
4741

4842
- a Nargo.toml (which is the manifest file of the project) at `example_contract/Nargo.toml`.
4943
- a main.nr file (the file where our contract will reside) at `example_contract/src/main.nr`.
@@ -77,6 +71,7 @@ type = "contract"
7771
[dependencies]
7872
# Framework import
7973
aztec = { git="https://github.com/AztecProtocol/aztec-packages/", tag="#include_aztec_version", directory="yarn-project/aztec-nr/aztec" }
74+
protocol_types = { git="https://github.com/AztecProtocol/aztec-packages/", tag="#include_aztec_version", directory="yarn-project/noir-protocol-circuits/src/crates/types"}
8075

8176
# Utility dependencies
8277
value_note = { git="https://github.com/AztecProtocol/aztec-packages/", tag="#include_aztec_version", directory="yarn-project/aztec-nr/value-note"}

docs/docs/dev_docs/getting_started/aztecnr-getting-started.md

+13-6
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ authors = [""]
5050
compiler_version = ">=0.18.0"
5151

5252
[dependencies]
53-
aztec = { git="https://github.com/AztecProtocol/aztec-packages", tag="#include_aztec_version", directory="yarn-project/aztec-nr/aztec" }
54-
value_note = { git="https://github.com/AztecProtocol/aztec-packages", tag="#include_aztec_version", directory="yarn-project/aztec-nr/value-note"}
55-
easy_private_state = { git="https://github.com/AztecProtocol/aztec-packages", tag="#include_aztec_version", directory="yarn-project/aztec-nr/easy-private-state"}
53+
aztec = { git="https://github.com/AztecProtocol/aztec-packages/", tag="#include_aztec_version", directory="yarn-project/aztec-nr/aztec" }
54+
value_note = { git="https://github.com/AztecProtocol/aztec-packages/", tag="#include_aztec_version", directory="yarn-project/aztec-nr/value-note"}
55+
easy_private_state = { git="https://github.com/AztecProtocol/aztec-packages/", tag="#include_aztec_version", directory="yarn-project/aztec-nr/easy-private-state"}
56+
protocol_types = { git="https://github.com/AztecProtocol/aztec-packages/", tag="#include_aztec_version", directory="yarn-project/noir-protocol-circuits/src/crates/types"}
5657
```
5758

5859
## Define the functions
@@ -148,14 +149,20 @@ Now we've written a simple Aztec.nr smart contract, it's time to ensure everythi
148149

149150
### Compile the smart contract
150151

151-
In the root of the `nargo` project, run this:
152+
In `./contracts/counter/` directory, run this:
152153

153154
```bash
154-
aztec-cli compile .
155+
aztec-nargo compile
155156
```
156157

157158
This will compile the smart contract and create a `target` folder with a `.json` artifact inside.
158159

160+
After compiling, you need to generate the ABI and typescript class. In the same directory, run this:
161+
162+
```bash
163+
aztec-cli codegen target -o src/artifacts --ts
164+
```
165+
159166
### Deploy
160167

161168
You can use the previously generated artifact to deploy the smart contract. Our constructor takes two arguments - `initial_counter` and `owner` so let's make sure to pass those in.
@@ -192,7 +199,7 @@ Use one of these `address`es as the `owner`. You can either copy it or export.
192199
To deploy the counter contract, [ensure the sandbox is running](../cli/sandbox-reference.md) and run this in the root of your Noir project:
193200

194201
```bash
195-
aztec-cli deploy target/Counter.json --args 100 0x25048e8c1b7dea68053d597ac2d920637c99523651edfb123d0632da785970d0
202+
aztec-cli deploy contracts/counter/src/artifacts/Counter.json --args 100 0x2a0f32c34c5b948a7f9766f0c1aad70a86c0ee649f56208e936be4324d49b0b9
196203
```
197204

198205
You can also test the functions by applying what you learned in the [quickstart](./quickstart.md).

docs/docs/dev_docs/getting_started/quickstart.md

+15-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,21 @@ You can run the Sandbox using Docker.
3636
To install the latest Sandbox version, run:
3737

3838
```bash
39-
/bin/bash -c "$(curl -fsSL 'https://sandbox.aztec.network')"
39+
bash -i <(curl -s install.aztec.network)
40+
```
41+
42+
This will install the following:
43+
44+
- **aztec** - launches various infrastructure subsystems (sequencer, prover, pxe, etc).
45+
- **aztec-cli** - a command line tool for interfacing and experimenting with infrastructure.
46+
- **aztec-nargo** - aztec's build of nargo, the noir compiler toolchain.
47+
- **aztec-sandbox** - a wrapper around docker-compose that launches services needed for sandbox testing.
48+
- **aztec-up** - a tool to upgrade the aztec toolchain to the latest, or specific versions.
49+
50+
Once these have been installed, to start the sandbox, run:
51+
52+
```bash
53+
aztec-sandbox
4054
```
4155

4256
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`.

docs/docs/dev_docs/tutorials/token_portal/withdrawing_to_l1.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,14 @@ npx hardhat compile
7575
And compile your Aztec.nr contracts like this:
7676

7777
```bash
78-
cd aztec-contracts
79-
aztec-cli compile --typescript ../../src/test/fixtures token_bridge
78+
cd aztec-contracts/token-bridge
79+
aztec-nargo compile
80+
```
81+
82+
And generate the TypeScript interface for the contract and add it to the test dir:
83+
84+
```bash
85+
aztec-cli codegen target -o ../../../src/test/fixtures --ts
8086
```
8187

8288
This will create a TS interface in our `src/test` folder!

0 commit comments

Comments
 (0)