← Protocols
Algorand
01Description

Algorand is a pure-PoS L1 with instant finality, Algorand Standard Assets (ASA) for fungibles/NFTs, and AVM smart contracts written in PyTeal/TEALScript or via the high-level Algorand Python (Puya) compiler. `algosdk` is the low-level JS/TS SDK; `@algorandfoundation/algokit-utils` is the modern TypeScript wrapper plus AlgoKit CLI for project scaffolding, LocalNet, and contract deployment.

02Best for
  • 01Algorand dapps and ASA tokenization
  • 02instant-finality payments and microtransactions
  • 03AVM smart contracts (Algorand Python / TEALScript)
  • 04Pera / Defly / WalletConnect auth on Algorand
  • 05atomic transaction groups (multi-tx atomic ops)
03Install
  • pnpm add algosdk @algorandfoundation/algokit-utils @perawallet/connect
  • pipx install algokit
04Environment variables
VariableScopeDescription
NEXT_PUBLIC_ALGORAND_NETWORKClientNetwork — `mainnet`, `testnet`, `betanet`, or `localnet`.
NEXT_PUBLIC_ALGOD_URLClientalgod node URL (e.g. https://mainnet-api.algonode.cloud or https://testnet-api.algonode.cloud).
NEXT_PUBLIC_INDEXER_URLClientAlgorand indexer URL (e.g. https://mainnet-idx.algonode.cloud) for historical / search queries.
ALGOD_API_TOKENServerOptional algod API token if using a paid provider (Nodely, Purestake successors).
05Prompt snippet
Use `@algorandfoundation/algokit-utils` for app code and AlgoKit CLI for scaffolding/deploys. Create a client with `const algorand = AlgorandClient.fromConfig({ algodConfig: { server: NEXT_PUBLIC_ALGOD_URL }, indexerConfig: { server: NEXT_PUBLIC_INDEXER_URL } });`. Send a payment with `await algorand.send.payment({ sender, receiver, amount: algos(1) })`. Build atomic groups with `algorand.newGroup().addPayment({...}).addAssetTransfer({...}).send()`. For wallet UX use `@perawallet/connect` (`new PeraWalletConnect()` → `connect()` → `signTransaction([txns])`) or WalletConnect v2. To call a smart contract, generate a typed client with `algokit generate client` from the contract's ARC-32/56 app spec, then call methods directly. The low-level `algosdk` (`makePaymentTxnWithSuggestedParamsFromObject`, `assignGroupID`, `signTransaction`) is still useful for advanced flows.
06Gotchas
  • Algorand uses a stateful account model where every account must opt in (a 0-amount AssetTransfer to self) before it can hold any non-ALGO ASA; sending an ASA to an un-opted account fails and the sender pays the fee.
  • Minimum balance requirement (MBR) increases by 0.1 ALGO per ASA opt-in, per local-state schema entry, and per box; closing or rekeying an account does not refund unless the underlying state is also removed.
  • Transaction fees are flat (default 0.001 ALGO) but inner transactions and group sizes affect total cost; AVM apps can use fee pooling so one tx in a group pays for others — confusing to debug if you over-fund.
  • Finality is instant (no reorgs, ~3.3s blocks) but `algod.statusAfterBlock` and indexer can lag by 1–2 blocks; never read state from the indexer immediately after a write — read from algod (`accountInformation`) for fresh data.
  • Smart contract args/state encode bytes, uint64, and addresses with strict ABI rules (ARC-4) — use the AlgoKit-generated typed client to avoid hand-encoding `appArgs`; raw `Uint8Array` mismatches silently revert with `logic eval error`.
  • Algorand has two address forms: 58-character base32 with checksum (display) and 32-byte public key (programmatic); always normalize with `algosdk.encodeAddress` / `decodeAddress` before comparison or hashing.
  • Genesis hashes / network IDs differ per network; signing a tx built against testnet `suggestedParams` and broadcasting to mainnet (or vice versa) returns `transaction has invalid genesis hash` — always re-fetch params per network.
07Alternatives