0.23.0 • Published 3 months ago

@aztec/noir-contracts v0.23.0

Weekly downloads
-
License
-
Repository
-
Last release
3 months ago

Aztec.nr contracts

This package contains the source code and the Aztec ABIs for the example contracts used in tests.

Disclaimer

Please note that any example contract set out herein is provided solely for informational purposes only and does not constitute any inducement to use or deploy. Any implementation of any such contract with an interface or any other infrastructure should be used in accordance with applicable laws and regulations.

Setup

Installing Noir

An essential tool for managing noir versions is noirup.

  • Install noirup
    curl -L https://raw.githubusercontent.com/noir-lang/noirup/main/install | bash

Happy Path

Currently we all work from a single aztec tagged noir release. This release updates independently from noir's regular cadence to allow us to rapidly prototype new features. It has prebuilt binaries and is super easy to install using noirup

  • Install noirup
    curl -L https://raw.githubusercontent.com/noir-lang/noirup/main/install | bash
  • Install aztec tagged nargo
    noirup -v aztec

Pinning Aztec flavoured noir releases
Aztec noir is released with semver alongside noir. If you would like to pin to a specific version you can run:

noirup -v <noir-version>-aztec.<patch version>

e.g noirup -v 0.11.1-aztec.0

Building from source (If working with custom features)

  • Install noirup
    curl -L https://raw.githubusercontent.com/noir-lang/noirup/main/install | bash
  • Nix is already globally installed but path to this installation needs to be added in $HOME/.zshenv so correct configuration can be found by VSCode, do so with:
    echo -e '\n# Nix path set globally\nexport PATH="$HOME/.nix-profile/bin:/nix/var/nix/profiles/default/bin:$PATH"' >> $HOME/.zshenv
  • Enable nix flake command in ~/.config/nix/nix.conf with commands:
    mkdir -p $HOME/.config/nix && echo -e '\nexperimental-features = nix-command\nextra-experimental-features = flakes' >> $HOME/.config/nix/nix.conf
  • Install direnv into your Nix profile by running:
    nix profile install nixpkgs#direnv
  • Add direnv to your shell following their guide
    echo -e '\n# Adds direnv initialization\neval "$(direnv hook zsh)"' >> $HOME/.zshenv
  • VSCode needs to be restarted so direnv plugin can notice env changes with:
    kill -9 ps aux | grep $(whoami)/.vscode-server | awk '{print $2}'
  • Restart shell

  • Clone noir repo:

    git clone https://github.com/noir-lang/noir.git
  • Checkout your target noir branch

    cd noir
    git checkout <branch>
  • Enable direnv

    direnv allow
  • Restart shell

  • Go to the noir dir and install Noir:

    cd noir
    noirup -p ./

Building the contracts

  • In the aztec-packages repository, go to the directory yarn-project/noir-contracts

  • Use the noir:build:all script to compile the contracts you want and prepare the ABI for consumption

    yarn noir:build:all

    Alternatively you can run yarn noir:build CONTRACT1 CONTRACT2... to build a subset of contracts:

    yarn noir:build private_token public_token

    To view compilation output, including errors, run with the VERBOSE=1 flag:

    VERBOSE=1 yarn noir:build private_token public_token

Creating a new contract package

  1. Go to src/contracts folder.
  2. Create a new package whose name has to end with _contract. E.g.:
    nargo new --contract example_contract
  3. Add the aztec dependency to nargo.toml:

    [package]
    authors = [""]
    compiler_version = "0>=.18.0"
    
    [dependencies]
    aztec = { path = "../../../../aztec-nr/aztec" }
  4. Replace the content of the generated example_contract/src/main.nr file with your contract code.

  5. Go to noir-contracts root folder and run yarn noir:build example to compile the contract.
  6. Export the abi in src/artifacts/index.ts to be able to use the contract in the rest of the project:
    import ExampleContractJson from './example_contract.json' assert { type: 'json' };
    export const ExampleContractArtifact = ExampleContractJson as ContractArtifact;
0.23.0

3 months ago

0.22.0

4 months ago

0.21.0

4 months ago

0.20.0

4 months ago

0.19.0

4 months ago

0.18.0

4 months ago

0.17.0

4 months ago

0.16.8

5 months ago

0.16.9

5 months ago

0.16.5

6 months ago

0.16.6

6 months ago

0.16.7

6 months ago

0.16.3

6 months ago

0.16.4

6 months ago

0.16.2

6 months ago

0.16.0

6 months ago

0.16.1

6 months ago

0.15.0

6 months ago

0.15.1

6 months ago

0.14.0

7 months ago

0.14.1

7 months ago

0.14.2

7 months ago

0.11.0

7 months ago

0.11.1

7 months ago

0.13.0

7 months ago

0.13.1

7 months ago

0.12.0

7 months ago

0.10.1

7 months ago

0.10.0

7 months ago

0.9.0

7 months ago

0.8.14

7 months ago

0.8.13

7 months ago

0.8.12

7 months ago

0.8.11

7 months ago

0.8.10

7 months ago

0.8.9

7 months ago

0.8.8

8 months ago

0.8.7

8 months ago

0.8.6

8 months ago

0.8.5

8 months ago

0.8.4

8 months ago

0.7.10

8 months ago

0.7.9

8 months ago

0.7.8

8 months ago

0.7.7

8 months ago

0.7.5

8 months ago

0.7.4

8 months ago

0.7.3

8 months ago

0.7.2

8 months ago

0.7.0

8 months ago

0.6.7

8 months ago

0.6.6

8 months ago

0.6.5

9 months ago

0.6.4

9 months ago

0.6.2

9 months ago

0.1.0-alpha63

9 months ago

0.1.0-alpha62

9 months ago

0.1.0-alpha61

9 months ago

0.1.0-alpha60

9 months ago

0.1.0-alpha59

9 months ago

0.1.0-alpha57

9 months ago

0.1.0-alpha49

9 months ago

0.1.0-alpha48

9 months ago

0.1.0-alpha47

9 months ago

0.1.0-alpha46

9 months ago

0.1.0-alpha45

9 months ago

0.1.0-alpha44

9 months ago

0.1.0-alpha43

9 months ago

0.1.0-alpha42

9 months ago

0.1.0-alpha41

9 months ago

0.1.0-alpha40

9 months ago

0.1.0-alpha39

9 months ago

0.1.0-alpha38

9 months ago

0.1.0-alpha37

9 months ago

0.1.0-alpha36

10 months ago

0.1.0-alpha35

10 months ago

0.1.0-alpha34

10 months ago

0.1.0-alpha33

10 months ago

0.1.0-alpha32

10 months ago

0.1.0-alpha31

10 months ago

0.1.0-alpha30

10 months ago

0.1.0-alpha29

10 months ago

0.1.0-alpha26

10 months ago

0.1.0-alpha25

10 months ago

0.1.0-alpha24

10 months ago

0.1.0-alpha23

10 months ago

0.1.0-alpha22

10 months ago

0.1.0-alpha21

11 months ago

0.1.0-alpha20

11 months ago

0.1.0-alpha17

11 months ago

0.1.0-alpha16

11 months ago

0.1.0-alpha15

11 months ago

0.1.0-alpha14

11 months ago

0.1.0-alpha13

11 months ago

0.1.0-alpha12

11 months ago

0.1.0-alpha11

11 months ago

0.1.0-alpha10

11 months ago