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
2 changes: 2 additions & 0 deletions docs/docs-words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ autonumber
Azguard
AZIP
AZTC
aztecexplorer
aztecjs
aztecscan
barebones
Becuase
becuse
Expand Down
12 changes: 7 additions & 5 deletions docs/docs/developers/guides/getting_started_on_testnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,19 +115,21 @@ aztec-wallet deploy \
--payment method=fpc-sponsored,fpc=contracts:sponsoredfpc \
--alias token \
TokenContract \
--args accounts:my-wallet Token TOK 18
--args accounts:my-wallet Token TOK 18 --no-wait
```

You should see confirmation that the token contract is stored in the database.

Wait for the transaction to be mined on testnet. You can check the transaction status with the transaction hash on [aztecscan](https://aztecscan.xyz) or [aztecexplorer](https://aztecexplorer.xyz).

2. Mint 10 private tokens to yourself:

```bash
aztec-wallet send mint_to_private \
--node-url $NODE_URL \
--from accounts:my-wallet \
--payment method=fpc-sponsored,fpc=contracts:sponsoredfpc \
--contract-address last \
--contract-address token \
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you know if/when the "last" alias was dropped from the tool?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think it was dropped, but it can be inconsistent. Since the token deployment uses the token alias, this is more robust.

--args accounts:my-wallet accounts:my-wallet 10
```

Expand All @@ -140,7 +142,7 @@ aztec-wallet send transfer_to_public \
--node-url $NODE_URL \
--from accounts:my-wallet \
--payment method=fpc-sponsored,fpc=contracts:sponsoredfpc \
--contract-address last \
--contract-address token \
--args accounts:my-wallet accounts:my-wallet 2 0
```

Expand All @@ -154,7 +156,7 @@ Private balance:
aztec-wallet simulate balance_of_private \
--node-url $NODE_URL \
--from my-wallet \
--contract-address last \
--contract-address token \
--args accounts:my-wallet
```

Expand All @@ -166,7 +168,7 @@ Public balance:
aztec-wallet simulate balance_of_public \
--node-url $NODE_URL \
--from my-wallet \
--contract-address last \
--contract-address token \
--args accounts:my-wallet
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Image from "@theme/IdealImage";

In this guide, we will create our first Aztec.nr smart contract. We will build a simple private counter, where you can keep your own private counter - so no one knows what ID you are at or when you increment! This contract will get you started with the basic setup and syntax of Aztec.nr, but doesn't showcase all of the awesome stuff Aztec is capable of.

This tutorial is compatible with the Aztec version `#include_aztec_version`. Install the correct version with `aztec-up #include_aztec_version`. Or if you'd like to use a different version, you can find the relevant tutorial by clicking the version dropdown at the top of the page.
This tutorial is compatible with the Aztec version `#include_aztec_version`. Install the correct version with `aztec-up -v #include_version_without_prefix`. Or if you'd like to use a different version, you can find the relevant tutorial by clicking the version dropdown at the top of the page.

## Prerequisites

Expand Down Expand Up @@ -69,19 +69,19 @@ pub contract Counter {

#include_code imports /noir-projects/noir-contracts/contracts/test/counter_contract/src/main.nr rust

- `use aztec::macros::{functions::{initializer, private, utility}, storage::storage};`
- `use aztec::macros::{functions::{initializer, private, utility}, storage::storage};`
Imports the macros needed to define function types (`initializer`, `private`, and `utility`) and the `storage` macro for declaring contract storage structures.

- `use aztec::prelude::{AztecAddress, Map};`
- `use aztec::prelude::{AztecAddress, Map};`
Brings in `AztecAddress` (used to identify accounts/contracts) and `Map` (used for creating state mappings, like our counters).

- `use aztec::protocol_types::traits::{FromField, ToField};`
- `use aztec::protocol_types::traits::{FromField, ToField};`
Provides traits for converting values to and from field elements, necessary for serialization and formatting inside Aztec.

- `use easy_private_state::EasyPrivateUint;`
- `use easy_private_state::EasyPrivateUint;`
Imports a wrapper to manage private integer-like state variables (ie our counter), abstracting away notes.

- `use value_note::{balance_utils, value_note::ValueNote};`
- `use value_note::{balance_utils, value_note::ValueNote};`
Brings in `ValueNote`, which represents a private value stored as a note, and `balance_utils`, which makes working with notes feel like working with simple balances.

## Declare storage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Along the way you will:
- Wrap an address with its interface (token)
- Create custom private value notes

This tutorial is compatible with the Aztec version `#include_aztec_version`. Install the correct version with `aztec-up #include_aztec_version`. Or if you'd like to use a different version, you can find the relevant tutorial by clicking the version dropdown at the top of the page.
This tutorial is compatible with the Aztec version `#include_aztec_version`. Install the correct version with `aztec-up -v #include_version_without_prefix`. Or if you'd like to use a different version, you can find the relevant tutorial by clicking the version dropdown at the top of the page.

## Setup

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ In this tutorial you will learn how to:
- Handle different private note types
- Pass data between private and public state

This tutorial is compatible with the Aztec version `#include_aztec_version`. Install the correct version with `aztec-up #include_aztec_version`. Or if you'd like to use a different version, you can find the relevant tutorial by clicking the version dropdown at the top of the page.
This tutorial is compatible with the Aztec version `#include_aztec_version`. Install the correct version with `aztec-up -v #include_version_without_prefix`. Or if you'd like to use a different version, you can find the relevant tutorial by clicking the version dropdown at the top of the page.

We are going to start with a blank project and fill in the token contract source code defined [here (GitHub Link)](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/noir-contracts/contracts/app/nft_contract/src/main.nr), and explain what is being added as we go.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Image from '@theme/IdealImage';

In this tutorial we will go through writing a very simple private voting smart contract in Aztec.nr. You will learn about private functions, public functions, composability between them, state management and creatively using nullifiers to prevent people from voting twice!

This tutorial is compatible with the Aztec version `#include_aztec_version`. Install the correct version with `aztec-up #include_aztec_version`. Or if you'd like to use a different version, you can find the relevant tutorial by clicking the version dropdown at the top of the page.
This tutorial is compatible with the Aztec version `#include_aztec_version`. Install the correct version with `aztec-up -v #include_version_without_prefix`. Or if you'd like to use a different version, you can find the relevant tutorial by clicking the version dropdown at the top of the page.

We will build this:

Expand Down Expand Up @@ -70,23 +70,23 @@ Inside this, paste these imports:

We are using various utils within the Aztec `prelude` library:

- `use dep::aztec::keys::getters::get_public_keys;`
- `use dep::aztec::keys::getters::get_public_keys;`
Imports a helper to retrieve public keys associated with the caller, used for computing a secure nullifier during voting.

- `use dep::aztec::macros::{functions::{initializer, internal, private, public, utility}, storage::storage};`
- `use dep::aztec::macros::{functions::{initializer, internal, private, public, utility}, storage::storage};`
Brings in macros for defining different function types (`initializer`, `internal`, `private`, `public`, `utility`) and for declaring contract storage via `storage`.

- `use dep::aztec::prelude::{AztecAddress, Map, PublicImmutable, PublicMutable};`
- `use dep::aztec::prelude::{AztecAddress, Map, PublicImmutable, PublicMutable};`
Imports:

- `AztecAddress`: a type for account/contract addresses,
- `Map`: a key-value storage structure,
- `PublicMutable`: public state that can be updated,
- `PublicImmutable`: public state that is read-only after being set once.

- `use dep::aztec::protocol_types::traits::{Hash, ToField};`
- `use dep::aztec::protocol_types::traits::{Hash, ToField};`
Provides the `Hash` and `ToField` traits, used for hashing values and converting them to a Field, used for nullifier creation and other computations.


## Set up storage

Under these imports, we need to set up our contract storage.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ In this tutorial you will learn how to:

We are going to start with a blank project and fill in the token contract source code defined [here (GitHub Link)](https://github.com/AztecProtocol/aztec-packages/blob/#include_aztec_version/noir-projects/noir-contracts/contracts/app/token_contract/src/main.nr), and explain what is being added as we go.

This tutorial is compatible with the Aztec version `#include_aztec_version`. Install the correct version with `aztec-up #include_aztec_version`. Or if you'd like to use a different version, you can find the relevant tutorial by clicking the version dropdown at the top of the page.
This tutorial is compatible with the Aztec version `#include_aztec_version`. Install the correct version with `aztec-up #include_version_without_prefix`. Or if you'd like to use a different version, you can find the relevant tutorial by clicking the version dropdown at the top of the page.

## Requirements

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ You will learn:
- Typescript glue code to format and authenticate transactions
- Deploying and testing the account contract

This tutorial is compatible with the Aztec version `#include_aztec_version`. Install the correct version with `aztec-up #include_aztec_version`. Or if you'd like to use a different version, you can find the relevant tutorial by clicking the version dropdown at the top of the page.
This tutorial is compatible with the Aztec version `#include_aztec_version`. Install the correct version with `aztec-up -v #include_version_without_prefix`. Or if you'd like to use a different version, you can find the relevant tutorial by clicking the version dropdown at the top of the page.

Writing your own account contract allows you to define the rules by which user transactions are authorized and paid for, as well as how user keys are managed (including key rotation and recovery). In other words, writing an account contract lets you make the most out of account abstraction in the Aztec network.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The first half of this page reviews the process and contracts for bridging token
- sending tokens from L2 back to L1
- withdrawing tokens from the L1 portal

This tutorial is compatible with the Aztec version `#include_aztec_version`. Install the correct version with `aztec-up #include_aztec_version`. Or if you'd like to use a different version, you can find the relevant tutorial by clicking the version dropdown at the top of the page.
This tutorial is compatible with the Aztec version `#include_aztec_version`. Install the correct version with `aztec-up -v #include_version_without_prefix`. Or if you'd like to use a different version, you can find the relevant tutorial by clicking the version dropdown at the top of the page.

## Components

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,19 +115,21 @@ aztec-wallet deploy \
--payment method=fpc-sponsored,fpc=contracts:sponsoredfpc \
--alias token \
TokenContract \
--args accounts:my-wallet Token TOK 18
--args accounts:my-wallet Token TOK 18 --no-wait
```

You should see confirmation that the token contract is stored in the database.

Wait for the transaction to be mined on testnet. You can check the transaction status with the transaction hash on [aztecscan](https://aztecscan.xyz) or [aztecexplorer](https://aztecexplorer.xyz).

2. Mint 10 private tokens to yourself:

```bash
aztec-wallet send mint_to_private \
--node-url $NODE_URL \
--from accounts:my-wallet \
--payment method=fpc-sponsored,fpc=contracts:sponsoredfpc \
--contract-address last \
--contract-address token \
--args accounts:my-wallet accounts:my-wallet 10
```

Expand All @@ -140,7 +142,7 @@ aztec-wallet send transfer_to_public \
--node-url $NODE_URL \
--from accounts:my-wallet \
--payment method=fpc-sponsored,fpc=contracts:sponsoredfpc \
--contract-address last \
--contract-address token \
--args accounts:my-wallet accounts:my-wallet 2 0
```

Expand All @@ -154,7 +156,7 @@ Private balance:
aztec-wallet simulate balance_of_private \
--node-url $NODE_URL \
--from my-wallet \
--contract-address last \
--contract-address token \
--args accounts:my-wallet
```

Expand All @@ -166,7 +168,7 @@ Public balance:
aztec-wallet simulate balance_of_public \
--node-url $NODE_URL \
--from my-wallet \
--contract-address last \
--contract-address token \
--args accounts:my-wallet
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Image from "@theme/IdealImage";

In this guide, we will create our first Aztec.nr smart contract. We will build a simple private counter, where you can keep your own private counter - so no one knows what ID you are at or when you increment! This contract will get you started with the basic setup and syntax of Aztec.nr, but doesn't showcase all of the awesome stuff Aztec is capable of.

This tutorial is compatible with the Aztec version `v0.87.2`. Install the correct version with `aztec-up v0.87.2`. Or if you'd like to use a different version, you can find the relevant tutorial by clicking the version dropdown at the top of the page.
This tutorial is compatible with the Aztec version `v0.87.2`. Install the correct version with `aztec-up 0.87.2`. Or if you'd like to use a different version, you can find the relevant tutorial by clicking the version dropdown at the top of the page.

## Prerequisites

Expand Down Expand Up @@ -70,7 +70,7 @@ pub contract Counter {
}
```

```rust title="imports" showLineNumbers
```rust title="imports" showLineNumbers
use aztec::macros::{functions::{initializer, private, public, utility}, storage::storage};
use aztec::prelude::{AztecAddress, Map};
use aztec::protocol_types::{
Expand All @@ -83,26 +83,26 @@ use value_note::{balance_utils, value_note::ValueNote};
> <sup><sub><a href="https://github.com/AztecProtocol/aztec-packages/blob/v0.87.2/noir-projects/noir-contracts/contracts/test/counter_contract/src/main.nr#L8-L17" target="_blank" rel="noopener noreferrer">Source code: noir-projects/noir-contracts/contracts/test/counter_contract/src/main.nr#L8-L17</a></sub></sup>


- `use aztec::macros::{functions::{initializer, private, utility}, storage::storage};`
- `use aztec::macros::{functions::{initializer, private, utility}, storage::storage};`
Imports the macros needed to define function types (`initializer`, `private`, and `utility`) and the `storage` macro for declaring contract storage structures.

- `use aztec::prelude::{AztecAddress, Map};`
- `use aztec::prelude::{AztecAddress, Map};`
Brings in `AztecAddress` (used to identify accounts/contracts) and `Map` (used for creating state mappings, like our counters).

- `use aztec::protocol_types::traits::{FromField, ToField};`
- `use aztec::protocol_types::traits::{FromField, ToField};`
Provides traits for converting values to and from field elements, necessary for serialization and formatting inside Aztec.

- `use easy_private_state::EasyPrivateUint;`
- `use easy_private_state::EasyPrivateUint;`
Imports a wrapper to manage private integer-like state variables (ie our counter), abstracting away notes.

- `use value_note::{balance_utils, value_note::ValueNote};`
- `use value_note::{balance_utils, value_note::ValueNote};`
Brings in `ValueNote`, which represents a private value stored as a note, and `balance_utils`, which makes working with notes feel like working with simple balances.

## Declare storage

Add this below the imports. It declares the storage variables for our contract. We are going to store a mapping of values for each `AztecAddress`.

```rust title="storage_struct" showLineNumbers
```rust title="storage_struct" showLineNumbers
#[storage]
struct Storage<Context> {
counters: Map<AztecAddress, EasyPrivateUint<Context>, Context>,
Expand All @@ -117,7 +117,7 @@ Now we’ve got a mechanism for storing our private state, we can start using it

Let’s create a constructor method to run on deployment that assigns an initial count to a specified owner. This function is called `initialize`, but behaves like a constructor. It is the `#[initializer]` decorator that specifies that this function behaves like a constructor. Write this:

```rust title="constructor" showLineNumbers
```rust title="constructor" showLineNumbers
#[initializer]
#[private]
// We can name our initializer anything we want as long as it's marked as aztec(initializer)
Expand All @@ -137,7 +137,7 @@ We have annotated this and other functions with `#[private]` which are ABI macro

Now let’s implement the `increment` function we defined in the first step.

```rust title="increment" showLineNumbers
```rust title="increment" showLineNumbers
#[private]
fn increment(owner: AztecAddress, sender: AztecAddress) {
unsafe {
Expand Down Expand Up @@ -166,7 +166,7 @@ Because our counters are private, the network can't directly verify if a note wa

The last thing we need to implement is the function in order to retrieve a counter. In the `getCounter` we defined in the first step, write this:

```rust title="get_counter" showLineNumbers
```rust title="get_counter" showLineNumbers
#[utility]
unconstrained fn get_counter(owner: AztecAddress) -> Field {
let counters = storage.counters;
Expand Down
Loading