Your first transaction

Send AERE from a script with ethers or viem, and read the receipt.

Docs / Getting started / Your first transaction

Send AERE from a script, and read the receipt. Nothing here is AERE-specific except the chain ID and the endpoint.

With ethers v6

import { JsonRpcProvider, Wallet, parseEther } from 'ethers';

const provider = new JsonRpcProvider('https://rpc.aere.network', { name: 'aere', chainId: 2800 });
const wallet = new Wallet(process.env.PRIVATE_KEY, provider);

const tx = await wallet.sendTransaction({
  to: '0x0000000000000000000000000000000000000001',
  value: parseEther('0.001'),
});

console.log('sent', tx.hash);
const receipt = await tx.wait();
console.log('block', receipt.blockNumber, 'status', receipt.status, 'gas', receipt.gasUsed.toString());

tx.wait() returns after one confirmation, and on AERE one confirmation is final: QBFT commits a block or it does not, and a committed block is not reorganised. You do not need to wait for additional confirmations to treat a transfer as settled.

With viem

import { createWalletClient, createPublicClient, http, parseEther, defineChain } from 'viem';
import { privateKeyToAccount } from 'viem/accounts';

const aere = defineChain({
  id: 2800,
  name: 'AERE Network',
  nativeCurrency: { name: 'AERE', symbol: 'AERE', decimals: 18 },
  rpcUrls: { default: { http: ['https://rpc.aere.network'] } },
  blockExplorers: { default: { name: 'AERE Explorer', url: 'https://explorer.aere.network' } },
});

const account = privateKeyToAccount(process.env.PRIVATE_KEY);
const wallet = createWalletClient({ account, chain: aere, transport: http() });
const publicClient = createPublicClient({ chain: aere, transport: http() });

const hash = await wallet.sendTransaction({
  to: '0x0000000000000000000000000000000000000001',
  value: parseEther('0.001'),
});
const receipt = await publicClient.waitForTransactionReceipt({ hash });
console.log(receipt.blockNumber, receipt.status);

Fees

A plain transfer costs 21,000 gas. The base fee has a floor of 1 Gwei, so the minimum cost of a transfer is 21,000 x 1 Gwei = 0.000021 AERE. Both libraries read the fee data from the chain and will do the right thing without help.

Keys

Never paste a private key into a shell, into a config file that gets committed, or into a page. Read it from the environment, as above. Note also that a key with a stray whitespace character can be printed whole inside a library's error message, so trim what you read and never log a raw error object that may contain key material.

Then look at it

Every transaction is on the explorer. Paste the hash into the search field, or go straight to https://explorer.aere.network/tx/<hash>.