Complete Algorand Development Cheat Sheet: From Basics to Advanced Applications

Introduction to Algorand

Algorand is a high-performance, carbon-negative blockchain platform founded by Turing Award winner Silvio Micali. It offers a unique pure proof-of-stake (PPoS) consensus mechanism that provides security, scalability (thousands of TPS), and near-instant finality (< 4.5 seconds) without forking. The platform supports smart contracts, asset tokenization, and decentralized applications while maintaining low transaction fees. Algorand’s key differentiators include its focus on solving the blockchain trilemma (security, scalability, decentralization) and its environmental sustainability.

Core Concepts and Foundations

Algorand Architecture

  • Two-tier blockchain structure:
    • Layer 1: Core blockchain protocol (consensus, smart contracts, ASAs)
    • Layer 2: Off-chain solutions for specific use cases (state proofs, co-chains)
  • Consensus Mechanism: Pure Proof-of-Stake (PPoS)
  • Block Production: ~4.5 second block time
  • Transaction Finality: Immediate (no forking)
  • Native Token: ALGO
  • Smart Contract Support: TEAL and PyTeal

Account Types

  • Standard Account: User-controlled account with public/private key pair
  • Rekeyed Account: Account whose spending authority has been transferred
  • Smart Contract Account: Account governed by TEAL logic (stateless)
  • Application Account: Account for an application with global state

Assets on Algorand

  • Algos (ALGO): Native cryptocurrency
  • Algorand Standard Assets (ASA): User-created tokens (fungible and non-fungible)
  • Smart Contracts: Logic written in TEAL or PyTeal

Transaction Types

  • Payment Transaction: Transfer ALGO between accounts
  • Asset Configuration Transaction: Create or modify ASAs
  • Asset Transfer Transaction: Transfer ASAs between accounts
  • Asset Freeze Transaction: Freeze/unfreeze ASAs for an account
  • Application Call Transaction: Create or interact with smart contracts
  • Key Registration Transaction: Register/deregister participation keys

Algorand Development Environment Setup

Development Tools

  • Algorand Sandbox: Dockerized development environment
    git clone https://github.com/algorand/sandbox.gitcd sandbox./sandbox up
    
  • Goal CLI: Command-line tool for node management and transactions
  • SDKs: Available for JavaScript, Python, Go, Java
  • IDEs: VS Code with Algorand extensions, PyCharm, IntelliJ

Network Options

  • MainNet: Production Algorand network
  • TestNet: Testing environment with free test ALGOs
  • BetaNet: Preview of upcoming features
  • Private Network: Local development network via Sandbox

Setting Up Local Development Environment

  1. Install prerequisites (Docker, Git)
  2. Clone and start Algorand Sandbox
  3. Install Algorand SDK for your language
  4. Configure connection to your chosen network
  5. Obtain test ALGOs from TestNet faucet

Algorand Standard Assets (ASA)

Key ASA Properties

  • Asset ID: Unique identifier
  • Creator: Account that created the asset
  • Total Supply: Maximum tokens that can exist
  • Decimals: Number of decimal places (0-19)
  • Unit Name: Short name (e.g., “USDC”)
  • Asset Name: Full name (e.g., “USD Coin”)
  • URL: Reference link for asset information
  • Metadata Hash: Hash of asset documentation
  • Manager: Account that can change asset configuration
  • Reserve: Account holding reserve units
  • Freeze: Account that can freeze/unfreeze balances
  • Clawback: Account that can transfer assets from any holder

Creating an ASA (JavaScript SDK)

const algosdk = require('algosdk');

async function createAsset(client, account) {
  const params = await client.getTransactionParams().do();
  
  const txn = algosdk.makeAssetCreateTxnWithSuggestedParams(
    account.addr,            // creator
    undefined,               // note
    1000000,                 // total supply
    6,                       // decimals
    false,                   // default frozen
    account.addr,            // manager
    account.addr,            // reserve
    account.addr,            // freeze
    account.addr,            // clawback
    "MYTOKEN",               // unit name
    "My Token",              // asset name
    "https://mytoken.com",   // url
    "12345678",              // metadata hash
    params
  );
  
  const signedTxn = txn.signTxn(account.sk);
  const {txId} = await client.sendRawTransaction(signedTxn).do();
  await algosdk.waitForConfirmation(client, txId, 5);
  const ptx = await client.pendingTransactionInformation(txId).do();
  return ptx["asset-index"];
}

Asset Operations

  • Opt-in to Asset: Required before receiving an ASA
  • Transfer Asset: Send ASA to another account
  • Freeze Asset: Prevent an account from transacting with an ASA
  • Revoke Asset: Clawback assets from an account
  • Modify Asset: Change manager, reserve, freeze, and clawback addresses
  • Destroy Asset: Remove asset from the ledger (if all tokens are in creator’s account)

Smart Contracts on Algorand

Smart Contract Types

  • Stateless Smart Contracts:
    • Logic signatures (LogicSig)
    • No persistent storage
    • Approve/reject transactions
  • Stateful Smart Contracts:
    • Application accounts
    • Persistent on-chain storage
    • Complex application logic

TEAL (Transaction Execution Approval Language)

  • Basics: Assembly-like language for Algorand smart contracts
  • Versions: Current version 8 (as of Q2 2025)
  • Execution Modes:
    • Signature mode (approval/logic signature)
    • Application mode (for stateful contracts)
  • Stack-based operations: Push, manipulate, and compare values
  • Opcodes: Mathematical, logical, and cryptographic operations

PyTeal

  • Overview: Python library that compiles to TEAL
  • Advantages: More developer-friendly than raw TEAL
  • Basic Structure:
    from pyteal import *def approval_program():    # Contract logic here    return Approve()def clear_state_program():    return Approve()    # Compile to TEALwith open("approval.teal", "w") as f:    compiled = compileTeal(approval_program(), Mode.Application, version=6)    f.write(compiled)
    

Stateful Contract Storage

  • Global State: Up to 64 key-value pairs available to the application
  • Local State: Up to 16 key-value pairs per account that opts in
  • Value Types:
    • bytes: String or byte array (max 128 bytes)
    • uint64: 64-bit unsigned integer

Application Lifecycle

  1. Creation: Deploy application to blockchain
  2. Opt-in: Users opt into the application to use local storage
  3. Calls: Interact with the application via transactions
  4. Updates: Modify application code (if allowed by original logic)
  5. Delete: Remove application from blockchain

Application Call Types

  • NoOp: Standard application call
  • OptIn: Opt user into the application
  • CloseOut: Close out user from application
  • UpdateApplication: Update the application’s code
  • DeleteApplication: Delete the application
  • ClearState: Force close user from application

Smart Contract Development

Sample Stateful Contract (PyTeal)

from pyteal import *

def approval_program():
    # Global variable operations
    counter = Bytes("counter")
    increment_op = Bytes("increment")
    
    # Initialize counter on creation
    on_creation = Seq([
        App.globalPut(counter, Int(0)),
        Return(Int(1))
    ])
    
    # Handle increment operation
    increment = Seq([
        App.globalPut(counter, App.globalGet(counter) + Int(1)),
        Return(Int(1))
    ])
    
    # Handle NoOp calls
    handle_noop = Cond(
        [Txn.application_args[0] == increment_op, increment]
    )
    
    # Main logic
    program = Cond(
        [Txn.application_id() == Int(0), on_creation],
        [Txn.on_completion() == OnComplete.NoOp, handle_noop],
        [Txn.on_completion() == OnComplete.OptIn, Return(Int(1))],
        [Txn.on_completion() == OnComplete.CloseOut, Return(Int(1))],
        [Txn.on_completion() == OnComplete.UpdateApplication, Return(Int(1))],
        [Txn.on_completion() == OnComplete.DeleteApplication, Return(Int(1))]
    )
    
    return program

def clear_state_program():
    return Return(Int(1))

Stateless Contract Example (PyTeal)

from pyteal import *

def stateless_program():
    # This contract only approves transactions to a specific receiver
    specific_address = Addr("SPECIFICADDRESSHERE")
    
    # Verify that this is a payment transaction to our target address
    is_payment = Txn.type_enum() == TxnType.Payment
    is_correct_receiver = Txn.receiver() == specific_address
    
    # Only approve if both conditions are met
    return And(is_payment, is_correct_receiver)

# Compile program
with open("escrow.teal", "w") as f:
    compiled = compileTeal(stateless_program(), Mode.Signature, version=6)
    f.write(compiled)

Testing Smart Contracts

  • Unit Testing: Test individual functions with pytest, JavaScript testing libraries
  • Integration Testing: Deploy to TestNet and test complete flows
  • TEAL Debugger: Step through TEAL execution
  • Dry Run API: Simulate transaction execution without sending to blockchain

Atomic Transfers

Overview

  • Definition: Group of transactions that either all succeed or all fail
  • Maximum Size: Up to 16 transactions in one atomic group
  • Use Cases: Token swaps, complex financial transactions, escrow services

Creating Atomic Transfers (JavaScript SDK)

const algosdk = require('algosdk');

async function createAtomicTransfer(client, sender, receiver1, receiver2, amount) {
  const params = await client.getTransactionParams().do();
  
  // First transaction: payment to receiver1
  const txn1 = algosdk.makePaymentTxnWithSuggestedParams(
    sender.addr, 
    receiver1, 
    amount, 
    undefined, 
    undefined, 
    params
  );
  
  // Second transaction: payment to receiver2
  const txn2 = algosdk.makePaymentTxnWithSuggestedParams(
    sender.addr, 
    receiver2, 
    amount, 
    undefined, 
    undefined, 
    params
  );
  
  // Group the transactions
  const txGroup = algosdk.assignGroupID([txn1, txn2]);
  
  // Sign the transactions
  const signedTxn1 = txn1.signTxn(sender.sk);
  const signedTxn2 = txn2.signTxn(sender.sk);
  
  // Submit the transaction group
  const { txId } = await client.sendRawTransaction([signedTxn1, signedTxn2]).do();
  await algosdk.waitForConfirmation(client, txId, 5);
  
  return txId;
}

Advanced Algorand Features

Atomic Transaction Composition

  • Transaction Fields: Set fields of one transaction based on another in group
  • Asset Creation & Transfer: Create and transfer an asset in one atomic group
  • Multiple Signers: Collect signatures from different parties

Algorand Rekeying

  • Concept: Change who can spend from an account without changing the address
  • Security Benefit: Keep a constant public address while rotating key authority
  • Implementation: Use RekeyTo field in a transaction

State Proofs

  • Purpose: Connect Algorand to other blockchains
  • Mechanism: Cryptographic proofs about Algorand state
  • Use Cases: Cross-chain bridges, interoperability solutions

Algorand Virtual Machine (AVM)

  • Features: Executes TEAL code
  • AVM Versions: Corresponds to TEAL versions, adds new opcodes
  • Limitations: Deterministic execution, no infinite loops

ARC Standards

  • ARC-0003: Algorand Standard Asset Parameters Conventions
  • ARC-0069: ASA Content Metadata Format (NFT metadata)
  • ARC-0072: Algorand NFT Marketplace API
  • ARC-0200: Algorand Fungible Token Specification

Best Practices for Algorand Development

Security Considerations

  • Smart Contract Audit: Have code reviewed before deployment to MainNet
  • Key Management: Secure storage of private keys, use hardware wallets
  • Limits and Guards: Implement spending limits and logical guards
  • Freeze/Clawback: Consider implications of these powers for ASAs
  • Transaction Verification: Always verify transaction details before signing

Performance Optimization

  • Minimize Storage: On-chain storage has costs, use it efficiently
  • Batch Operations: Use atomic transfers for related operations
  • Indexer Efficiency: Design applications to work efficiently with Indexer
  • State Access Patterns: Optimize how smart contracts access state

Development Workflow

  1. Design: Plan application logic and state requirements
  2. Implement: Code smart contracts and application logic
  3. Test: Unit test and integration test on TestNet
  4. Audit: Have code reviewed by security experts
  5. Deploy: Release to MainNet with monitoring
  6. Maintain: Update as needed, monitor for issues

Common Algorand Development Patterns

Escrow Accounts

  • Purpose: Hold funds until conditions are met
  • Implementation: Stateless smart contract with specific approval logic
  • Use Cases: Atomic swaps, time-locked funds, multi-sig wallets

Token Vesting

  • Purpose: Release tokens according to a schedule
  • Implementation: Stateful contract tracking time and release amounts
  • Features: Release schedules, cliff periods, revocation options

Decentralized Exchanges (DEX)

  • Components: Asset swapping, liquidity pools, price discovery
  • Patterns: AMM (Automated Market Maker), order book models
  • Challenges: Price impact, slippage, front-running protection

NFT Marketplaces

  • Key Features: Listing, bidding, buying, royalties
  • Implementation: Smart contracts for marketplace logic, ASAs for NFTs
  • Standards: ARC-0003, ARC-0069 for metadata

Tools and Resources

Development Tools

  • Algorand Builder (AlgoBuilder): Framework for Algorand application development
  • AlgoExplorer/AlgoScan: Block explorers for transaction monitoring
  • Algorand Indexer: API for querying blockchain data
  • PureStake API: Managed API service for Algorand
  • AlgoSigner: Browser extension for Algorand wallet integration
  • Reach: High-level language for cross-chain application development

SDKs

  • JavaScript/TypeScript SDK
    npm install algosdk
    
  • Python SDK
    pip install py-algorand-sdk
    
  • Go SDK
    go get -u github.com/algorand/go-algorand-sdk/...
    
  • Java SDK
    <dependency>  <groupId>com.algorand</groupId>  <artifactId>algosdk</artifactId>  <version>latest.version</version></dependency>
    

Community Resources

  • Algorand Developer Portal: documentation.algorand.org
  • Algorand Foundation: algorand.foundation
  • Algorand Discord: discord.gg/algorand
  • Algorand Forums: forum.algorand.org
  • GitHub: github.com/algorand
  • Stack Overflow: Stack Overflow with “algorand” tag

Learning Resources

  • Algorand Developer Documentation: Complete official documentation
  • Developer Office Hours: Regular community sessions
  • Algorand Developer Academy: Structured learning paths
  • Algorand Education: University programs and resources

Comparison with Other Blockchains

FeatureAlgorandEthereumSolanaCardano
ConsensusPure Proof-of-StakeProof-of-StakeProof-of-History + PoSOuroboros PoS
TPS~6,000~30 (L1)~65,000~250
Finality~4.5 seconds~12 minutes~13 seconds~20 minutes
Smart ContractsTEAL/PyTealSolidity/VyperRustPlutus/Marlowe
Fees~0.001 ALGOVariable, often high~0.00025 SOL~0.17-0.5 ADA
ForkingNo forksPossiblePossiblePossible
Native AssetsASAERC standardsSPL tokensNative tokens
Layer 2 OptionsState Proofs, Co-ChainsRollups, Plasma, ChannelsN/AHydra

Troubleshooting Common Issues

Transaction Issues

  • Problem: “Transaction rejected by ApprovalProgram”

    • Solution: Debug TEAL using dryrun to identify why logic is failing
  • Problem: “Overspend”

    • Solution: Check account has sufficient balance including minimum balance requirement
  • Problem: “Below min fee”

    • Solution: Ensure transaction fee meets network minimum (current min fee: 1000 microAlgos)

Smart Contract Issues

  • Problem: “Budget exceeded”

    • Solution: Optimize TEAL code, reduce operations
  • Problem: “Invalid program”

    • Solution: Verify TEAL version compatibility with network
  • Problem: “Source not found in key-value store”

    • Solution: Check if your app has the key in state, or if account has opted in

Development Environment Issues

  • Problem: Sandbox connection failing

    • Solution: Check Docker services running, restart sandbox
  • Problem: TestNet faucet not working

    • Solution: Try different faucet sources, or request from community
  • Problem: SDK version compatibility

    • Solution: Ensure SDK version matches network features you’re using

Advanced Topics for Further Study

Algorand Co-Chains

  • Custom blockchains connected to Algorand MainNet
  • Private transaction capabilities
  • Enterprise-focused features

Zero-Knowledge Proofs on Algorand

  • Privacy-preserving transactions
  • ZK-SNARK integration
  • Anonymous asset transfers

Governance and Protocol Evolution

  • Algorand Governance program
  • Protocol upgrade process
  • ARC (Algorand Request for Comments) process

Cross-Chain Interoperability

  • State proofs for trustless bridges
  • Asset bridging implementations
  • Cross-chain smart contract calls

This cheatsheet provides a comprehensive overview of Algorand development, from basic concepts to advanced implementations. Use it as a reference when building applications on the Algorand blockchain.

Scroll to Top