An open API service indexing awesome lists of open source software.

https://github.com/AztecProtocol/aztec-starter

A simple aztec contract + test to get started.
https://github.com/AztecProtocol/aztec-starter

Last synced: 10 months ago
JSON representation

A simple aztec contract + test to get started.

Awesome Lists containing this project

README

          



Aztec Protocol Logo

# Aztec Starter

This repo is meant to be a starting point for writing Aztec contracts and tests.

You can find the **Easy Private Voting contract** in `./src/main.nr`. A simple integration test is in `./src/test/index.test.ts`.

The corresponding tutorial can be found in the [Aztec docs here](https://docs.aztec.network/developers/tutorials/codealong/contract_tutorials/private_voting_contract).

[![GitHub Repo stars](https://img.shields.io/github/stars/AztecProtocol/aztec-starter?logo=github&color=yellow)](https://github.com/AztecProtocol/aztec-starter/stargazers)
[![GitHub forks](https://img.shields.io/github/forks/AztecProtocol/aztec-starter?logo=github&color=blue)](https://github.com/AztecProtocol/aztec-starter/network/members)
[![Build](https://github.com/AztecProtocol/aztec-starter/actions/workflows/update.yaml/badge.svg)](https://github.com/AztecProtocol/aztec-starter/actions)
[![GitHub last commit](https://img.shields.io/github/last-commit/AztecProtocol/aztec-starter?logo=git)](https://github.com/AztecProtocol/aztec-starter/commits/main)
[![License](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/license/mit)
[![Discord](https://img.shields.io/badge/discord-join%20chat-5B5EA6)](https://discord.gg/aztec)
[![Twitter Follow](https://img.shields.io/twitter/follow/aztecnetwork?style=flat&logo=twitter)](https://x.com/aztecnetwork)

---

## ๐Ÿš€ **Getting Started**

Use **Node.js version 18.19.0**.

[Start your codespace from the codespace dropdown](https://docs.github.com/en/codespaces/getting-started/quickstart).

Get the **sandbox, aztec-cli, and other tooling** with this command:

```bash
bash -i <(curl -s https://install.aztec.network)
```

Install the correct version of the toolkit with:

```bash
aztec-up 0.84.0
```

Start the sandbox with:

```bash
aztec start --sandbox
```

---

## ๐Ÿ“ฆ **Install Packages**

We need to ignore node version warnings (a temporary fix):

```bash
YARN_IGNORE_ENGINES=true yarn install
```

---

## ๐Ÿ— **Compile**

```bash
aztec-nargo compile
```

or

```bash
yarn compile
```

---

## ๐Ÿ”ง **Codegen**

Generate the **contract artifact JSON** and TypeScript interface:

```bash
yarn codegen
```

---

## ๐Ÿงช **Test**

**Make sure the sandbox is running before running tests.**

```bash
aztec start --sandbox
```

Then test with:

```bash
yarn test
```

Testing will run the **TypeScript tests** defined in `index.test.ts` inside `./src/test`, as well as the [Aztec Testing eXecution Environment (TXE)](https://docs.aztec.network/developers/guides/smart_contracts/testing) tests defined in [`first.nr`](./src/test/first.nr) (imported in the contract file with `mod test;`).

Note: The Typescript tests spawn an instance of the sandbox to test against, and close it once the TS tests are complete.

---

## โ— **Error Resolution**

### ๐Ÿ”„ **Update Node.js and Noir Dependencies**

```bash
yarn update
```

### ๐Ÿ”„ **Update Contract**

Get the **contract code from the monorepo**. The script will look at the versions defined in `./Nargo.toml` and fetch that version of the code from the monorepo.

```bash
yarn update
```

You may need to update permissions with:

```bash
chmod +x update_contract.sh
```

### ๐Ÿ’ฌ Join the Community:



Forum


Telegram


Discord


Twitter (X)