Avalanche (AVAX)

Avalanche is a high-throughput, low-latency Proof-of-Stake blockchain platform launched in September 2020 by Ava Labs, founded by Emin Gün Sirer, Kevin Sekniqi, and Maofan "Ted" Yin. Its defining innovation is a novel family of consensus protocols:

  1. Avalanche consensus (DAG-based) and
  2. Snowman consensus (linear chains) achieves sub-second finality through repeated random subsampling rather than traditional PBFT or longest-chain rules.

Avalanche's most distinctive architectural feature is its three-chain Primary Network:

  1. The Contract Chain (C-Chain) for EVM-compatible smart contracts
  2. the Platform Chain (P-Chain) for validators, staking, and subnet metadata,
  3. The Exchange Chain (X-Chain) for native asset transfers.

Each chain has its own virtual machine, its own RPC namespace, and its own URL path under the GetBlock base URL. The network also pioneered the concept of Subnets (now called L1S), application-specific blockchains with custom validators and tokenomics.

Key Features

  • Three-Chain Primary Network: C-Chain (EVM, smart contracts), P-Chain (platform.* for staking and subnets), X-Chain (avm.* for native assets) — each with its own RPC path
  • Sub-Second Finality: Repeated random subsampling delivers irreversibility in under 1 second, with no probabilistic confirmation windows
  • EVM Compatibility on C-Chain: Full Ethereum JSON-RPC support; deploy Solidity / Vyper contracts with Hardhat, Foundry, ethers.js, viem, or web3.py without modification
  • Avalanche eth_* Extensions on C-Chain: eth_baseFee, eth_getChainConfig, eth_suggestPriceOptions, eth_getBadBlocks, and the newAcceptedTransactions WebSocket subscription
  • Atomic Cross-Chain Transfers: avax.export / avax.import enable atomic AVAX movement between C, P, and X chains
  • Snowman Consensus: Used by C-Chain and P-Chain — linear, BFT-style finality optimized for smart contract execution
  • Avalanche Consensus: Used by X-Chain — DAG-based, optimized for parallel asset transfers
  • Subnets (L1s): Custom application-specific blockchains with their own validator sets, virtual machines, and token economics
  • Native AVAX: Network's native token (18 decimals on C-Chain, 9 decimals as nAVAX on P-Chain / X-Chain — see warning below)
  • Production-Grade Scalability: 4,500+ TPS theoretical throughput on the Primary Network, with subnets adding horizontal scale

TECHNICAL DISCLAIMER: AUTHORITATIVE AVALANCHE RPC SPECIFICATION

GetBlock’s Avalanche API reference documentation is provided exclusively for informational purposes and to optimize the developer experience. The canonical specification for Avalanche's RPC interfaces is maintained by Ava Labs and published at build.avax.network/docs/rpcs. The C-Chain follows the standard Ethereum JSON-RPC specification at ethereum.org/developers/docs/apis/json-rpc, plus Avalanche-specific extensions documented separately. For P-Chain and X-Chain protocols, consensus parameters, and subnet architecture, consult the official Avalanche documentation.

AVAX DECIMALS DIFFER BETWEEN CHAINS — IMPORTANT

AVAX is represented with different decimal precision depending on which chain you are interacting with:

  • C-Chain: 18 decimals (1 AVAX = 10¹⁸ wei), matching Ethereum's convention. Use parseEther / formatEther.
  • P-Chain and X-Chain: 9 decimals — denominated in nAVAX (nano-AVAX). 1 AVAX = 10⁹ nAVAX.

When transferring AVAX across chains via avax.export / avax.import or platform.exportAVAX / platform.importAVAX, the amount field uses the destination chain's decimal convention. A common integration bug is sending 18-decimal wei amounts to the P-Chain (which interprets them as nAVAX).

Network Information

PropertyValue
Network NameAvalanche Mainnet (Primary Network)
C-Chain ID43114 (0xa86a)
Fuji Testnet C-Chain ID43113 (0xa869)
Native CurrencyAVAX
C-Chain Decimals18 (wei)
P-Chain / X-Chain Decimals9 (nAVAX)
FinalitySub-second (Avalanche / Snowman consensus)
Smart Contract VMEVM on C-Chain; AvalancheVM on X-Chain; Platform VM on P-Chain
EVM CompatibleYes (C-Chain only)
Address FormatC-Chain: Ethereum-style 0x…; P-Chain / X-Chain: Bech32 P-avax1… / X-avax1…
Block Explorersnowtrace.io (C-Chain), avascan.info (all chains)

Base URL

GetBlock exposes all three Avalanche chains under a single regional base URL. The chain is selected by the URL path:

ChainPath suffixUse for
C-Chain/ext/bc/C/rpcEVM smart contracts, eth_*, avax.* cross-chain ops
P-Chain/ext/bc/Pplatform.* — validators, staking, subnets
X-Chain/ext/bc/Xavm.* — native asset transfers
https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/ext/bc/C/rpc
https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/ext/bc/P
https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/ext/bc/X

All methods are called by sending a POST request to the corresponding chain URL with a JSON-RPC 2.0 body. For real-time subscriptions on the C-Chain, use the WebSocket scheme: wss://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/ext/bc/C/ws. WebSocket is only available on the C-Chain — P-Chain and X-Chain are HTTP only.

Supported Networks

NetworkC-Chain JSON-RPCC-Chain WSSP-ChainX-ChainFrankfurt
Mainnet✅✅✅✅✅
Fuji Testnet✅✅✅✅✅

Quickstart

In this section, you will learn how to make your first call against the C-Chain (the most common starting point) with either:

  • Axios (JavaScript / Node.js)
  • Python (Requests library)

Before you begin, you must have already installed npm or yarn on your local machine (for the Axios example) or Python and pip (for the Python example).

  1. Setup project

    bashmkdir avalanche-api-quickstart
    cd avalanche-api-quickstart
    npm init --yes
  2. Install Axios

    bashnpm install axios
  3. Create file

    Create a new file named index.js. This is where you will make your first call.

  4. Set ES module type

    Set the ES module "type": "module" in your package.json.

  5. Add code

    index.js

    javascriptimport axios from 'axios';
    
    const data = JSON.stringify({
        "jsonrpc": "2.0",
        "method": "eth_chainId",
        "params": [],
        "id": "getblock.io"
    });
    
    const config = {
        method: 'post',
        url: 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/ext/bc/C/rpc',
        headers: {
            'Content-Type': 'application/json'
        },
        data: data
    };
    
    axios(config)
        .then(response => console.log(JSON.stringify(response.data, null, 2)))
        .catch(error => console.log(error));

    Replace <ACCESS-TOKEN> with your actual GetBlock access token.

  6. Run the script

    bashnode index.js

    Expected output:

    json{
        "jsonrpc": "2.0",
        "id": "getblock.io",
        "result": "0xa86a"
    }

    0xa86a (43114 in decimal) confirms you are connected to Avalanche C-Chain mainnet.

  1. Setup the project directory

    bashmkdir avalanche-api-quickstart
    cd avalanche-api-quickstart
  2. Create and activate a virtual environment

    bashpython -m venv venv
    source venv/bin/activate
    
    # On Windows, use venv\Scripts\activate
  3. Install requests

    bashpip install requests
  4. Create script

    main.py

    pythonimport requests
    import json
    
    url = "https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/ext/bc/C/rpc"
    
    payload = json.dumps({
        "jsonrpc": "2.0",
        "method": "eth_chainId",
        "params": [],
        "id": "getblock.io"
    })
    
    headers = {
        'Content-Type': 'application/json'
    }
    
    response = requests.post(url, headers=headers, data=payload)
    print(response.text)

    Replace <ACCESS-TOKEN> with your actual access token from GetBlock.

  5. Run the script

    bashpython main.py

Available API Methods

Avalanche exposes three RPC surfaces. C-Chain is the most heavily used (EVM smart contracts). P-Chain and X-Chain are documented here with their core methods; for the complete platform.* and avm.* surface, see build.avax.network/docs/rpcs.

C-Chain: Ethereum-Compatible (eth_*)

MethodDescription
eth_blockNumberReturns the current latest block number
eth_chainIdReturns the chain ID (0xa86a = 43114 for C-Chain mainnet)
eth_getBlockByNumberReturns block information by block number
eth_getBlockByHashReturns block information by block hash
eth_getBlockReceiptsReturns all transaction receipts for a given block
eth_syncingReturns sync status or false if node is fully synced
eth_getBalanceReturns the AVAX balance of an account (in wei)
eth_getCodeReturns the contract bytecode at a given address
eth_getStorageAtReturns the value at a specific storage slot
eth_getTransactionCountReturns the transaction count (nonce) for an account
eth_sendRawTransactionBroadcasts a signed transaction
eth_getTransactionByHashReturns a transaction by its hash
eth_getTransactionReceiptReturns the receipt for a transaction by hash
eth_callExecutes a read-only call against contract state
eth_estimateGasEstimates gas required for a transaction
eth_gasPriceReturns the current gas price
eth_maxPriorityFeePerGasReturns the suggested max priority fee per gas (EIP-1559)
eth_feeHistoryReturns historical base fees and priority fees
eth_getLogsReturns logs matching a given filter

C-Chain: Avalanche eth_* Extensions

MethodDescription
eth_baseFeeReturns the base fee for the next block (Avalanche-specific)
eth_getChainConfigReturns the C-Chain configuration
eth_suggestPriceOptionsReturns suggested slow / normal / fast gas price options

C-Chain: WebSocket Subscriptions

MethodDescription
eth_subscribeSubscribes to events (newHeads, logs, newPendingTransactions, newAcceptedTransactions)
eth_unsubscribeCancels an existing subscription

C-Chain: Network & Client Info

MethodDescription
net_versionReturns the network ID
net_listeningReturns true if the client is actively listening for connections
net_peerCountReturns the number of peers connected to the node
web3_clientVersionReturns the client software version
web3_sha3Returns the Keccak-256 hash of the given data

P-Chain (platform.*)

MethodDescription
platform.getHeightReturns the current P-Chain block height
platform.getCurrentValidatorsReturns the list of current validators for a given subnet
platform.getMinStakeReturns the minimum amount of AVAX required to stake
platform.getStakingAssetIDReturns the asset ID used for staking on a subnet
platform.getCurrentSupplyReturns the current AVAX supply on the P-Chain
platform.getTotalStakeReturns the total amount of AVAX staked on a subnet

X-Chain (avm.*)

MethodDescription
avm.getAssetDescriptionReturns description (name, symbol, decimals) for an asset
avm.getTxReturns a transaction by ID
avm.getTxStatusReturns the status of a transaction (Accepted, Processing, etc.)
avm.getUTXOsReturns the UTXOs that reference a given address
avm.issueTxSends a signed transaction to the X-Chain

Support

For technical support and questions:

See Also