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.
- Host: GitHub
- URL: https://github.com/AztecProtocol/aztec-starter
- Owner: AztecProtocol
- Created: 2023-12-20T01:41:12.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-04-10T15:02:50.000Z (10 months ago)
- Last Synced: 2025-04-11T17:56:31.676Z (10 months ago)
- Language: TypeScript
- Size: 797 KB
- Stars: 36
- Watchers: 11
- Forks: 42
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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).
[](https://github.com/AztecProtocol/aztec-starter/stargazers)
[](https://github.com/AztecProtocol/aztec-starter/network/members)
[](https://github.com/AztecProtocol/aztec-starter/actions)
[](https://github.com/AztecProtocol/aztec-starter/commits/main)
[](https://opensource.org/license/mit)
[](https://discord.gg/aztec)
[](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: