SDK for verifying contract artifacts and deployments on AztecScan. Compatible with Aztec v4 (@aztec/*@4.0.0-devnet.2-patch.1).
- Verify contract artifacts (contract classes)
- Verify contract instance deployments
- Attach deployer metadata (name, contact, repo, etc.)
- Attach AztecScan notes (displayed in the explorer UI)
- Network presets for devnet, testnet, mainnet
- Stateful
AztecScanClientclass or stateless utility functions - End-to-end deploy-and-verify script for devnet
git clone https://github.com/aztec-scan/aztec-scan-sdk.git
cd aztec-scan-sdk
npm installCopy .env.example to .env and edit as needed:
cp .env.example .env| Variable | Description | Default (devnet) |
|---|---|---|
EXPLORER_API_URL |
AztecScan API base URL | https://api.devnet.aztecscan.xyz |
API_KEY |
API key | temporary-api-key |
AZTEC_NODE_URL |
Aztec node RPC (for scripts) | https://v4-devnet-2.aztec-labs.com/ |
import { AztecScanClient } from "aztec-scan-sdk";
// Uses env vars or defaults to devnet
const client = new AztecScanClient();
// Or configure explicitly
const client = new AztecScanClient({
network: "testnet",
// or: explorerApiUrl: "https://api.testnet.aztecscan.xyz",
// apiKey: "your-api-key",
});
// Verify a contract artifact
const artifactResult = await client.verifyArtifact(
contractClassId,
1, // version
artifactJson,
);
// Verify a contract instance deployment
const instanceResult = await client.verifyInstance(
contractAddress,
{
publicKeysString, // 514 chars: "0x" + 4*128 hex
deployer, // 66 chars: "0x" + 64 hex
salt, // 66 chars: "0x" + 64 hex
constructorArgs: ["arg1", "arg2"],
artifactObj: artifactJson, // optional if already verified
},
{
// optional deployer metadata
contractIdentifier: "MyToken",
details: "My token contract",
creatorName: "Alice",
creatorContact: "alice@example.com",
appUrl: "https://myapp.xyz",
repoUrl: "https://github.com/alice/myapp",
// optional AztecScan notes (shown in explorer UI, non-production envs only)
aztecScanNotes: {
name: "My Token",
origin: "My Project",
comment: "A brief description of this contract instance",
},
},
);If you're using the Aztec SDK to deploy contracts, fromContractInstance eliminates the manual string extraction boilerplate. It accepts the ContractInstanceWithAddress returned by deployment and produces all the verification arguments automatically:
import { AztecScanClient, fromContractInstance } from "aztec-scan-sdk";
import { TokenContract } from "@aztec/noir-contracts.js/Token";
// Deploy the contract
const { contract, instance } = await TokenContract.deploy(
wallet, admin, name, symbol, decimals,
).send({ fee: { paymentMethod }, wait: { timeout: 1_200_000 } });
// Extract all verification params in one call
const { address, contractClassId, verifyInstanceArgs } = fromContractInstance(instance, {
constructorArgs: [admin, name, symbol, decimals],
});
// Verify
const client = new AztecScanClient();
await client.verifyArtifact(contractClassId, 1, tokenArtifact);
await client.verifyInstance(address, { ...verifyInstanceArgs, artifactObj: tokenArtifact });The helper handles:
- Stringifying
salt,deployer, andpublicKeysStringfrom the Aztec SDK types - Converting all constructor args to strings (numbers,
Fr,AztecAddress, etc.) - Extracting the contract address and class ID
npm run register-artifact <contractClassId> [version]npm run verify-deployment <address> <publicKeysString> <deployer> <salt> [constructorArgs...]Deploys a Token contract to devnet, then verifies both the artifact and instance on AztecScan:
npm run deploy-and-verify::devnetThis script:
- Creates an ephemeral
EmbeddedWallet - Deploys a Schnorr account (sponsored fees via
SponsoredFPC) - Deploys a
TokenContract - Waits for the indexer to pick up the deployment
- Verifies the artifact on AztecScan
- Verifies the instance deployment on AztecScan
The publicKeysString is a 514-character hex string encoding the four master public keys of the contract instance. It is constructed by concatenating the keys in this exact order:
"0x" + masterNullifierPublicKey (128 hex chars)
+ masterIncomingViewingPublicKey (128 hex chars)
+ masterOutgoingViewingPublicKey (128 hex chars)
+ masterTaggingPublicKey (128 hex chars)
Total: 2 + 4*128 = 514 characters.
If you have a deployed contract instance, the simplest way to get this value is:
const publicKeysString = instance.publicKeys.toString();This produces the correctly ordered string automatically. You do not need to construct it manually.
Both are 66-character hex strings ("0x" + 64 hex digits). After deploying a contract, extract them from the instance:
const salt = instance.salt.toString(); // 66 chars
const deployer = instance.deployer.toString(); // 66 charsNote that salt is generated randomly during deployment by default and is not recoverable after the fact unless you save it. The deploy-and-verify.ts script demonstrates how to capture all required values at deploy time.
npm run build # Build SDK (src/ -> dist/)
npm run build:scripts # Build scripts
npm run build:all # Build bothsrc/
config.ts — Configuration (network presets, env var resolution)
types.ts — TypeScript types matching explorer-api Zod schemas
api-utils.ts — URL/payload generators + fetch-based HTTP client
aztec-helpers.ts — Helpers for converting Aztec SDK types (fromContractInstance)
index.ts — AztecScanClient class + re-exports
scripts/
register-artifact.ts — CLI: verify an artifact
verify-deployment.ts — CLI: verify an instance
deploy-and-verify.ts — E2E: deploy to devnet + verify on AztecScan
Apache-2.0