Logo
New RPC users get 35% off their first monthView the offer
OnFinality Learn
Network & Protocol Guides11 min read

Avalanche Subnet (L1) Guide: Architecture, Deployment, and RPC Verification

A practical technical guide to Avalanche subnets, now called Avalanche L1s: how they work, how to deploy one, and how to verify its RPC endpoint.

TL;DR

An Avalanche subnet is a sovereign validator set on the Avalanche network that can run one or more custom blockchains; the term is now largely synonymous with Avalanche L1. This guide explains the P-Chain, subnet-evm, and validator mechanics, then walks through a reproducible deployment and RPC verification workflow using placeholders rather than invented endpoints. You will learn how to confirm chain ID, block production, and finality behavior, and how to diagnose the most common subnet RPC failures. It separates documented protocol behavior from operational recommendations and from measurements you must run against your own infrastructure.

Scope and direct answer

An Avalanche subnet is a dynamic set of validators that agree to validate one or more blockchains. Since the Avalanche9000 upgrade, the ecosystem increasingly calls these networks Avalanche L1s, but the underlying P-Chain primitive is still a subnet. A subnet does not inherit the C-Chain's execution environment; it defines its own validator membership, and each blockchain deployed to it defines its own VM, genesis, and gas rules.

This article covers the mental model, a runnable deployment path using Avalanche CLI and subnet-evm, and a diagnostic procedure for verifying a subnet RPC endpoint. It assumes you have basic familiarity with EVM chains, a terminal, and access to an Avalanche node or a managed RPC provider. Concrete endpoint selection is out of scope here; use the RPC Assistant for provider and network recommendations.

  • Documented behavior: P-Chain subnet registration, validator staking, and VM plugin loading.
  • Recommendations: isolate RPC traffic, pin chain IDs, and monitor block height independently of your application.
  • Measurements you must run: latency, block time, and finality on your own endpoint.

Prerequisites and assumptions

Before deploying, confirm tool versions and funding. Avalanche CLI wraps node and subnet operations, but it still needs a reachable Avalanche node and a funded key on the P-Chain for validator registration. The exact minimum stake and fee schedule changes with network upgrades, so read the current Avalanche documentation rather than relying on older figures.

You also need a chain specification: VM choice (subnet-evm for EVM compatibility), genesis allocation, chain ID, and fee configuration. Keep these in version control. For node hosting options, see dedicated node infrastructure and the network directory.

  • Avalanche CLI installed and on your PATH.
  • A P-Chain key with sufficient AVAX for subnet and validator transactions.
  • A genesis JSON and chain ID reserved for your network.
  • A plan for RPC exposure, either self-hosted or through a managed provider.

How subnets and L1s fit into Avalanche

Avalanche has three primary chains: the X-Chain for asset operations, the C-Chain for EVM contracts, and the P-Chain for validators and subnets. A subnet is registered on the P-Chain, then validators are added to it by staking. Each blockchain on the subnet is identified by a blockchain ID and runs a VM plugin. The Primary Network validates the X-, C-, and P-Chains; a subnet's own validators validate its blockchains.

This separation is the core mental model: the subnet is the validator set, and the blockchain is the state machine. A single subnet can host multiple blockchains, and a validator can belong to multiple subnets if it meets the stake requirements. Cross-subnet communication uses Avalanche Interchain Messaging (ICM) and Teleporter, which relay messages between chains rather than sharing state directly.

subnet-evm and the execution layer

subnet-evm is the EVM implementation used for most Avalanche L1s. It supports configurable gas targets, fee markets, precompiles, and state upgrades. The standalone ava-labs/subnet-evm repository has been archived and its code moved into AvalancheGo, so pin your node version and read the AvalancheGo release notes rather than cloning the archived repository.

Genesis configuration controls the initial allocation, chain ID, and fee parameters. Changing genesis after launch requires a coordinated state upgrade, so treat it as an immutable contract with your users. For a broader comparison of execution environments, see the RPC endpoints guide.

Deploying a local subnet for verification

A local deployment is the fastest way to validate your genesis and RPC assumptions before spending funds on a public network. Avalanche CLI can create a local network with a subnet and a subnet-evm blockchain. The commands below use placeholders for names and paths; substitute your own values.

After deployment, the CLI prints the RPC URL and blockchain ID. Record both. The local network is ephemeral, so do not use it for production data.

avalanche blockchain create myl1 --vm subnet-evm --genesis ./genesis.json
avalanche blockchain deploy myl1 --local
# Expected output includes:
# RPC URL: http://127.0.0.1:<port>/ext/bc/<blockchainID>/rpc
# Blockchain ID: <blockchainID>

Verifying a subnet RPC endpoint with curl

The first check is chain identity. Call eth_chainId and compare the hex result to your genesis chain ID. A mismatch usually means you are pointed at the wrong blockchain or a proxy is routing to the C-Chain. The second check is block production: call eth_blockNumber twice with a delay and confirm the height advances.

Use placeholders for the endpoint. Never commit real credentials to source control.

RPC_URL="https://your-subnet-rpc.example/ext/bc/<blockchainID>/rpc"

curl -s -X POST "$RPC_URL" \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"eth_chainId","params":[]}'

curl -s -X POST "$RPC_URL" \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":2,"method":"eth_blockNumber","params":[]}'

A JavaScript health-check procedure

For continuous verification, script the checks and record results in a table. The script below measures chain ID, block height, and round-trip latency. It does not assert a specific block time because that depends on your genesis and validator set.

Run it on a schedule and store the output. A results table with columns for timestamp, chain ID, block height, latency, and status makes regressions visible.

const RPC_URL = process.env.RPC_URL;

async function call(method, params = []) {
  const start = Date.now();
  const res = await fetch(RPC_URL, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ jsonrpc: '2.0', id: 1, method, params })
  });
  const json = await res.json();
  return { result: json.result, latencyMs: Date.now() - start };
}

(async () => {
  const chainId = await call('eth_chainId');
  const block1 = await call('eth_blockNumber');
  await new Promise(r => setTimeout(r, 5000));
  const block2 = await call('eth_blockNumber');
  console.log({
    chainId: chainId.result,
    block1: parseInt(block1.result, 16),
    block2: parseInt(block2.result, 16),
    latencyMs: chainId.latencyMs
  });
})();

Interpreting verification results

A healthy endpoint returns a stable chain ID, a block height that increases between samples, and latency consistent with your network path. If the chain ID is correct but the height is static, the validator may be syncing, the blockchain may be paused, or your request may be hitting a cache. If the chain ID is wrong, check the blockchain ID in the URL path and any reverse-proxy routing rules.

Record measurements rather than guessing. The table below is a template; fill it with your own observations.

  • | Check | Method | Expected | Observed |
  • | Chain identity | eth_chainId | Matches genesis | (record) |
  • | Block production | eth_blockNumber x2 | Height increases | (record) |
  • | Latency | Timed request | Within your SLO | (record) |
  • | Finality | eth_getBlockByNumber | Accepted block | (record) |

Troubleshooting common subnet RPC failures

Connection refused or 502 usually means the node is not running, the RPC port is not exposed, or a load balancer has no healthy backend. A 200 response with a JSON-RPC error such as method not found suggests you are talking to a different VM or an older node version. Timeouts under load often indicate resource exhaustion on the node rather than a protocol problem.

For validator-level issues, check P-Chain registration and stake status. A validator that is not in the subnet's validator set will not produce or validate blocks for that subnet. For broader node operations, see the blockchain node hosting guide.

  • Confirm the blockchain ID in the RPC path matches the deployed blockchain.
  • Check node logs for VM plugin load errors.
  • Verify the validator is registered and staked on the P-Chain.
  • Test from a different network path to rule out local DNS or firewall issues.

Limitations and tradeoffs

Subnets trade shared security for sovereignty. You choose and fund your validator set, so security is a function of your staking design, not the Primary Network's. That flexibility enables custom gas tokens, permissioned membership, and application-specific throughput, but it also means you own uptime, upgrades, and incident response.

Cross-subnet messaging adds latency and complexity compared with same-chain calls. If your application depends on atomic composability with C-Chain liquidity, evaluate whether an L1 is the right fit before committing. For managed RPC options, compare RPC pricing and the API service.

Next steps

After local verification, deploy to a public network with a small validator set, then run the health-check script continuously. Document your chain ID, genesis hash, and RPC URL in a runbook. When you are ready to choose a production endpoint, use the RPC Assistant for concrete provider and network recommendations rather than guessing from a list.

For related reading, see what a blockchain nonce is and the multi-chain RPC endpoints guide.

Never Worry about Infrastructure Again

OnFinality takes away the heavy lifting of DevOps so you can build smarter and faster.

Get Started