Skip to main content
Version: v4.0.0-nightly.20260204

Creating Accounts

This guide shows you how to create and deploy a new account on Aztec.

Prerequisites

Install dependencies

yarn add @aztec/aztec.js@4.0.0-nightly.20260204 @aztec/test-wallet@4.0.0-nightly.20260204

Create a new account

Using the wallet from the connection guide, call createSchnorrAccount to create a new account with a random secret and salt:

create_account
import { Fr } from "@aztec/aztec.js/fields";

const secret = Fr.random();
const salt = Fr.random();
const newAccount = await wallet.createSchnorrAccount(secret, salt);
console.log("New account address:", newAccount.address.toString());
Source code: docs/examples/ts/aztecjs_connection/index.ts#L39-L46

The secret is used to derive the account's encryption keys, and the salt ensures address uniqueness. The signing key is automatically derived from the secret.

Store your secret and salt

Save the secret and salt values securely. You need both to recover access to your account. If you lose them, you will permanently lose access to the account and any assets it holds.

Deploy the account

New accounts must be deployed before they can send transactions. Deployment requires paying fees.

Using the Sponsored FPC

If your account doesn't have Fee Juice, use the Sponsored Fee Payment Contract:

deploy_account_sponsored_fpc
// Additional imports needed for account deployment examples
import { AztecAddress } from "@aztec/aztec.js/addresses";
import { SponsoredFeePaymentMethod } from "@aztec/aztec.js/fee/testing";
import { SponsoredFPCContract } from "@aztec/noir-contracts.js/SponsoredFPC";
import { getContractInstanceFromInstantiationParams } from "@aztec/stdlib/contract";

// Set up the Sponsored FPC payment method (see fees guide for details)
const sponsoredFPCInstance = await getContractInstanceFromInstantiationParams(
SponsoredFPCContract.artifact,
{ salt: new Fr(0) },
);
await wallet.registerContract(
sponsoredFPCInstance,
SponsoredFPCContract.artifact,
);
const sponsoredPaymentMethod = new SponsoredFeePaymentMethod(
sponsoredFPCInstance.address,
);

// newAccount is the account created in the previous section
const deployMethod = await newAccount.getDeployMethod();
await deployMethod.send({
from: AztecAddress.ZERO,
fee: { paymentMethod: sponsoredPaymentMethod },
});
Source code: docs/examples/ts/aztecjs_connection/index.ts#L48-L74
info

See the guide on fees for setting up the Sponsored FPC.

Using Fee Juice

If your account already has Fee Juice (for example, bridged from L1):

deploy_account_fee_juice
// newAccount is the account created in the previous section
const deployMethodFeeJuice = await newAccount.getDeployMethod();
await deployMethodFeeJuice.send({
from: AztecAddress.ZERO,
});
Source code: docs/examples/ts/aztecjs_connection/index.ts#L76-L82

The from: AztecAddress.ZERO is required because there's no existing account to send from—the transaction itself creates the account.

Verify deployment

Confirm the account was deployed successfully:

verify_account_deployment
const metadata = await wallet.getContractMetadata(newAccount.address);
console.log("Account deployed:", metadata.isContractInitialized);
Source code: docs/examples/ts/aztecjs_connection/index.ts#L84-L87

Next steps