Skip to main content

How to Send a Transaction

This guide explains how to send a transaction using Aztec.js.

To do this from the CLI, go here.


You should have a wallet to act as the transaction sender, and a contract that has been deployed.

You can learn how to create wallets from this guide.

You can learn how to deploy a contract here.

Relevant imports

You will need to import this library:

import { Contract } from '@aztec/aztec.js';
Source code: /yarn-project/end-to-end/src/docs_examples.test.ts#L5-L7 (aztec-packages-v0.24.0)

Define contract

Get a previously deployed contract like this:

const contract = await, TokenContractArtifact, wallet);
Source code: /yarn-project/end-to-end/src/docs_examples.test.ts#L36-L38 (aztec-packages-v0.24.0)

Call method

const _tx = await contract.methods.transfer(1, wallet).send().wait();
Source code: /yarn-project/end-to-end/src/docs_examples.test.ts#L40-L42 (aztec-packages-v0.24.0)