OnFinality
New RPC users get 35% off their first monthView the offer
OnFinality Learn
Infrastructure & Operations10 min read

Best Blockchain Infrastructure: How to Choose and Test Your Stack

Compare managed RPC, dedicated and self-hosted nodes, and indexers, then test which combination meets your application's requirements.

TL;DR

The best blockchain infrastructure is the smallest stack that delivers the chain data your application needs, at the required freshness and reliability, within your operating budget. Start with managed RPC if shared capacity and standard methods meet your requirements; add dedicated capacity, an indexer, or a self-hosted node when a specific requirement justifies it. Verify network identity and historical data first, then measure latency, freshness, and recovery separately. This guide provides a repeatable test procedure and a decision table for comparing deployments.

The right infrastructure for the workload

For most applications, the first decision is how to access a chain you have already chosen, not which chain to build on. This guide covers application infrastructure: RPC access, node capacity, and the pipelines that turn chain data into queryable records. Choosing a chain is a separate decision about execution, settlement, and ecosystem fit.

Match the stack to what breaks when it falls behind. A wallet backend may need fresh balance reads and dependable submission. A payments service needs a reliable way to distinguish inclusion from settlement. An analytics pipeline needs historical coverage and predictable backfills, even if individual reads can be slower. These workloads can use the same network without needing the same infrastructure.

The layers behind an application request

A node follows the network and serves data from the state and history it retains. An RPC endpoint exposes methods to clients and may route requests across multiple nodes. An indexer reads chain data and builds its own queryable store. Its progress, retention, and reorganization handling are separate from the RPC endpoint's. A fast RPC response does not prove the node is current, and a current node does not prove the indexer has caught up.

Treat historical state and historical records as separate capabilities. A node can return a block or receipt at a given height without retaining the account state needed for a balance query at that same height. If your workload needs old state or traces, test the actual method at the oldest height you intend to support. A successful call against the latest block does not establish archive coverage.

Operating models and their tradeoffs

ApproachFits whenTradeoff to verify
Managed shared RPCStandard methods work and the team wants to avoid operating nodesConfirm rate, concurrency, and method-specific limits under your request mix
Managed dedicated nodeYou need isolated node capacity or a specific configurationConfirm what is dedicated and which gateway, network, or storage limits still apply
Self-hosted nodeYou need control over client versions, retention, or data localityBudget for upgrades, storage growth, monitoring, and recovery from a failed node
Indexer backed by RPC or your own nodeThe app needs searchable history, aggregates, or resumable ingestionMeasure indexing lag, backfill time, and reorganization handling separately

These options can coexist. For example, route interactive reads separately from historical backfills so a large scan cannot exhaust the capacity needed by user-facing traffic. Review the managed RPC service and dedicated node option against the same workload. Dedicated capacity can isolate work, but it is not a failover plan by itself.

Requirements and test prerequisites

Inventory the exact network, methods, historical depth, payload sizes, and transport your application uses. Estimate the normal and burst request mix from application telemetry where available, including retry traffic. Set pass criteria before testing: per-method latency, maximum data lag, acceptable failure rate, and maximum recovery time. Treat missing required methods and incorrect data as disqualifying rather than averaging them into a score.

Use authorized endpoints and stay within agreed test limits. The examples below use EVM JSON-RPC over HTTP; the first requires curl and jq, and the second uses Python 3. For other protocols, substitute their native identity, finality, and historical-read methods rather than assuming EVM semantics. Check the network directory for the environment you're evaluating, and use the RPC pricing page to check how a candidate plan meters the traffic you expect.

Network identity and finality preflight

Set RPC_URL in your environment to the candidate endpoint. The probe below prints the EVM chain ID in hex and the block number, hash, and timestamp returned for the finalized tag. Use this second check only where the network and endpoint document support for the tag. On rollups in particular, verify that the network's finality semantics match the settlement guarantee your application needs.

Expect the documented chain ID and a non-null finalized block. Compare its height with a trusted reference sampled at roughly the same time. Different finalized heights can reflect normal propagation or observation timing; to check agreement, query both sources at the same finalized height and compare the hashes. Do not swap in latest if the finality check fails: that tests a different guarantee.

set -eu
: "${RPC_URL:?Set RPC_URL to your authorized EVM endpoint}"
rpc() {
  curl -fsS --max-time 10 -H 'Content-Type: application/json' --data "$1" "$RPC_URL"
}
identity=$(rpc '{"jsonrpc":"2.0","id":1,"method":"eth_chainId","params":[]}')
printf '%s\n' "$identity" | jq -er 'select(.id == 1 and .error == null) | .result | select(type == "string" and test("^0x[0-9a-fA-F]+$"))'
finalized=$(rpc '{"jsonrpc":"2.0","id":2,"method":"eth_getBlockByNumber","params":["finalized",false]}')
printf '%s\n' "$finalized" | jq -e 'select(.id == 2 and .error == null) | .result | select(.number != null and .hash != null and .timestamp != null) | {number, hash, timestamp}'

A correctness-aware RPC baseline

Create fixtures.json as an array of cases. Each case has method, params, and expected; optionally use field to compare a property inside the result. For a block case, use eth_getBlockByNumber, parameters containing a fixed finalized height in hex and false, field set to hash, and the expected hash from a trusted reference. For a historical state case, use eth_getBalance with an address and a fixed block number, omit field, and use the expected hex balance from an independently checked source. Choose a known nonzero balance for at least one old-state case so a zero result cannot pass that check.

Save the script as rpc_probe.py and run python3 rpc_probe.py with RPC_URL set. Keep the fixture file, client location, rounds, and timeout identical for each candidate. The script emits one JSON record per fixture with outcome counts and nearest-rank p95 latency for correct responses. A passing correctness run has ok equal to attempts for every fixture; use the measured p95 and failure rate against your own thresholds. The default round count is a starting point, not evidence that the tail estimate is stable.

import collections
import json
import math
import os
import time
import urllib.error
import urllib.request

url = os.environ['RPC_URL']
rounds = int(os.getenv('ROUNDS', '30'))
timeout = float(os.getenv('TIMEOUT_SECONDS', '5'))
with open('fixtures.json', encoding='utf-8') as f:
    cases = json.load(f)
if not cases or rounds < 1 or timeout <= 0:
    raise SystemExit('Provide fixtures, positive rounds, and a positive timeout')
counts = [collections.Counter() for _ in cases]
latencies = [[] for _ in cases]

for round_no in range(rounds):
    for i, case in enumerate(cases):
        ident = round_no * len(cases) + i
        body = json.dumps(dict(jsonrpc='2.0', id=ident,
                               method=case['method'], params=case['params'])).encode()
        req = urllib.request.Request(url, data=body,
                                     headers={'Content-Type': 'application/json'})
        start = time.monotonic()
        try:
            with urllib.request.urlopen(req, timeout=timeout) as response:
                reply = json.loads(response.read())
            if not isinstance(reply, dict) or reply.get('jsonrpc') != '2.0' or reply.get('id') != ident:
                outcome = 'invalid_response'
            elif 'error' in reply:
                outcome = 'rpc_error'
            elif 'result' not in reply:
                outcome = 'missing_result'
            else:
                result = reply['result']
                if 'field' in case:
                    result = result.get(case['field']) if isinstance(result, dict) else None
                outcome = 'ok' if result == case['expected'] else 'mismatch'
        except urllib.error.HTTPError as exc:
            outcome = f'http_{exc.code}'
            exc.close()
        except TimeoutError:
            outcome = 'timeout'
        except (urllib.error.URLError, OSError):
            outcome = 'transport_error'
        except (ValueError, UnicodeError):
            outcome = 'invalid_response'
        elapsed = time.monotonic() - start
        if outcome == 'ok' and elapsed > timeout:
            outcome = 'over_latency_budget'
        counts[i][outcome] += 1
        if outcome == 'ok':
            latencies[i].append(elapsed * 1000)

for i, case in enumerate(cases):
    ordered = sorted(latencies[i])
    p95 = round(ordered[math.ceil(0.95 * len(ordered)) - 1], 2) if ordered else None
    print(json.dumps(dict(fixture=i, method=case['method'], attempts=rounds,
                          outcomes=dict(counts[i]), p95_ok_ms=p95)))

Production load, freshness, and recovery tests

The baseline is sequential, sends no retries, and does not reproduce your application's connection pool. The urllib timeout applies to blocking operations; it is not a hard end-to-end cancellation deadline. Repeated fixtures may also hit caches. Use the baseline to isolate correctness and latency under a narrow, repeatable workload, not to claim production throughput.

Replay an approved, sanitized request mix with the application's HTTP client and connection settings. Use varied fixed-height fixtures to reduce cache bias, measure live reads separately, and record the offered rate and achieved rate during normal traffic and bursts. Track original requests separately from retry attempts. For freshness, sample the same finality level on the candidate and reference from the same observer. Compute lag as reference height minus candidate height, retaining negative values and investigating persistent differences rather than treating the reference as infallible.

In staging, simulate an unavailable primary at the application boundary and measure time until the application first serves correct, sufficiently fresh data through its fallback. Also test a primary that returns successful responses with stale data. If you consume subscriptions, disconnect the stream and verify that the consumer resumes from its durable checkpoint, backfills the gap, and deduplicates replayed events.

Diagnostic signals and likely causes

Troubleshoot by separating transport success from RPC success and application correctness. Inspect sanitized response metadata and RPC error details; never log endpoint credentials. Confirm the pattern across multiple samples before changing providers, capacity, or client behavior.

  • HTTP 429 or an RPC quota error: check burst and method limits before raising concurrency. Bound retries and honor Retry-After when present.
  • Fast responses with a stale finalized height: compare both sources at the same finality level and check whether the issue is isolated to one route or shared across dependencies.
  • Old blocks return correctly but historical balance reads fail: verify state retention and method support at the tested height.
  • Fixed-height hash mismatch: recheck network identity, fixture height, and the reference hash before accepting any results from that run.
  • Transaction submission times out: treat the outcome as unknown. Reconcile using the original signed transaction's hash before creating a replacement; do not apply a generic read retry policy to writes.

Results table and deployment decision

Use one row per candidate, region, workload, and test window. Report counts with percentages, and keep latency for correct responses alongside the failure rate so a fast p95 cannot hide dropped traffic. Mark untested capabilities explicitly. For monthly cost, model the observed method mix, burst capacity, storage, transfers, and staff time where applicable; a low entry price does not establish a low cost for backfills or incident recovery.

Candidate, region, windowWorkload and offered rateCorrect / attemptedp95 of correct responsesFinalized lagRecovery timeModeled monthly costDecision
Fill from test notesRecord mix, rate, and concurrencyRecord counts and error classesRecord by methodRecord distribution and worst observed lagRecord drill outcomeRecord metering and operating assumptionsPass, fail, or untested

Rollout and ongoing verification

Choose the simplest deployment that clears every mandatory requirement. If two candidates pass, compare operating cost, recovery effort, and shared dependencies before optimizing for small latency differences. Two endpoints are not independent just because they have different hostnames; verify what you can about shared gateways, regions, and upstream infrastructure.

Roll out with a small share of read traffic first. Monitor correctness, freshness, errors, and retries by method and region, with a rollback condition agreed before launch. Keep the fixture suite and recovery drill in your release checklist, and rerun them after changes to node software, routing, or traffic patterns. Use the OnFinality Learn technical guides for deeper integration and operations workflows once the stack is selected.

Never Worry about Infrastructure Again

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

Get Started