Skip to main content

How to Deploy a Contract

This guide explains how to deploy a smart contract using Aztec.js.

To do this from the CLI, go here.


You should have a wallet to act as the deployer, and a contract artifact ready to be deployed.

You can learn how to create wallets from this guide.

You can read about contract artifacts here.

Import the contract artifact

In this guide we are using a Token contract artifact. This comes from the token contract tutorial.

import { TokenContract, TokenContractArtifact } from '@aztec/noir-contracts.js/Token';
Source code: /yarn-project/end-to-end/src/docs_examples.test.ts#L8-L11 (aztec-packages-v0.24.0)

Deploy contract

const deployedContract = await TokenContract.deploy(
wallet, // wallet instance
wallet.getAddress(), // account
'TokenName', // constructor arg1
'TokenSymbol', // constructor arg2
) // constructor arg3
Source code: /yarn-project/end-to-end/src/docs_examples.test.ts#L24-L34 (aztec-packages-v0.24.0)

To learn how to send a transaction from Aztec.js read this guide. You can also call a view function from Aztec.js by reading this guide.