7Block Labs
Blockchain Technology

ByAUJay

Blockchain Development Outsourcing vs In‑House: How to Keep API Quality High

Decision-makers are often torn between outsourcing blockchain development and building in-house. This guide shows how to keep your API quality consistently high either way—using contract-first design, measurable SLOs, chain-specific guardrails, and provable data integrity—so you can ship faster without surprises.

APIs are where blockchain projects succeed or fail. Below is a practical playbook from 7Block Labs to help you set the quality bar, verify it continuously, and avoid the most common chain and provider pitfalls.


Why API quality is your bottleneck in blockchain projects

  • Your users interact with blockchains via APIs (JSON‑RPC, REST, WebSockets, gRPC). Latency spikes, inconsistent responses, and breaking RPC changes translate directly into failed transactions, stuck balances, or wrong UI states.
  • Ethereum’s protocol evolution adds new fields and behaviors (e.g., blob transactions via EIP‑4844) that your APIs must handle correctly:
    max_fee_per_blob_gas
    ,
    blob_versioned_hashes
    , and new receipt fields for blob gas usage. If your API or data model ignores these, you’ll mis-parse L2 fee data post‑Dencun (activated on mainnet March 13, 2024). (eips.ethereum.org)
  • Finality and consistency aren’t uniform across chains. Ethereum finalizes roughly after two epochs (~12.8 minutes); Solana offers multiple “commitment” levels (processed/confirmed/finalized) with different safety guarantees. Your API must expose these semantics explicitly. (ethereum.github.io)

Outsourcing vs in‑house: what actually changes for API quality

Whether you hire a vendor or build internally, the non‑negotiables are the same: a contract-first API, measured SLOs with error budgets, chain-aware behaviors, and observability. What differs:

  • Outsourcing advantages
    • Faster setup of multi-chain RPC, managed SLAs, and scaling; top node providers advertise 99.9–99.99% availability. (infura.io)
    • Vendor ecosystem already tracks protocol upgrades (e.g., Dencun/4844) so you don’t have to. (blog.ethereum.org)
  • Outsourcing risks
    • Provider-imposed method caps (e.g.,
      eth_getLogs
      10,000-block range on many platforms) can break analytics and backfills unless your API transparently paginates. (quicknode.com)
    • Hidden archive-data limits; some methods require archive nodes for historical state (> ~128 blocks), which not every plan includes by default. (alchemy.com)
  • In-house advantages
    • Tighter control over versioning, SLA definitions, and chain-specific behaviors.
    • Ability to run custom clients (e.g., Erigon vs Geth) and tune archive vs. full node footprints.
  • In-house risks
    • You own upgrades (e.g., when Ethereum introduces new transaction types or Starknet deprecates RPC versions), and you must monitor finality/consensus edges yourself. (eips.ethereum.org)

Bottom line: pick the model that best fits your operational maturity. The quality bar below applies to both.


Set a non‑negotiable quality bar: SLOs, SLIs, and error budgets

Define service-level indicators for your blockchain APIs and automate their enforcement:

  • Availability SLOs by surface:
    • Public read endpoints: ≥99.9% monthly availability (error budget ≤0.1%).
    • Write/transaction endpoints: 99.5–99.9% with explicit “pending/confirmed/finalized” semantics.
  • Latency SLOs: p95 < 300 ms for reads, p95 < 1 s for writes (excluding chain confirmation time).
  • Error budget policy: freeze risky changes when budget is spent; prioritize reliability work. (sre.google)

Instrument these with OpenTelemetry:

  • Emit
    rpc.client.duration
    ,
    rpc.server.duration
    ,
    rpc.system="jsonrpc"
    , method names, error types, and request sizes to correlate spikes with specific JSON‑RPC calls. (opentelemetry.io)

Contract‑first API design that survives provider churn

  • Use OpenAPI 3.1 to describe REST surfaces (pre/post‑processing, auth, webhooks) and formalize error shapes; 3.1 aligns with JSON Schema 2020‑12 so you can validate payloads robustly. (openapis.org)
  • Lint specs with Spectral (CI gate), including the OWASP ruleset, and auto-mock with Prism so frontends and partners integrate before the backend is live. (github.com)
  • For JSON‑RPC, support batch requests per spec, and expose method-level versioning in docs to handle chain differences. (json-rpc.org)
  • Adopt consumer-driven contract tests for critical flows (e.g., “submit transaction → poll receipt → proof fetch”): use Pact for HTTP + events and Dredd to verify your implementation doesn’t drift from the contract. (docs.pact.io)

Chain‑specific pitfalls and how to guardrail them

Ethereum and EVM L2s

  • Dencun/4844 compatibility
    • Accept and return blob‑transaction fields (
      max_fee_per_blob_gas
      ,
      blob_versioned_hashes
      ), and include blob gas metrics in telemetry. Validate these fields in your OpenAPI/JSON schemas. (eips.ethereum.org)
  • Finality awareness
    • Expose “head/safe/finalized” block tags downstream so callers can choose safety vs. recency (e.g., risk-aware payments use
      finalized
      ). EIP‑1898 adds blockHash/number objects to remove ambiguity across reorgs. (eips.ethereum.org)
  • Logs backfills
    • Many providers cap
      eth_getLogs
      ranges (often 10,000 blocks; free tiers can be much lower). Implement segmented queries with retries, and surface a deterministic pagination scheme in your API. (quicknode.com)
  • Archive data
    • Certain methods against historical blocks require archive state (balances, storage, code,
      eth_call
      at old block numbers). Your API should dynamically route to archive-enabled backends or return a descriptive 4xx with “upgrade required.” (alchemy.com)
  • Verifiable responses
    • For high-trust use cases, return merkle proofs (
      eth_getProof
      ) with the queried values so clients can verify against the state root in a block header. (eips.ethereum.org)

Practical example: exposing safe/finalized reads

// Request: read a balance at "finalized" state using EIP-1898 format
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_getBalance",
  "params": ["0xabc...123",
    {"blockNumber":"finalized"} // or {"blockHash":"0x..."}
  ]
}

Solana

  • Commitment levels matter. Provide a
    commitment
    parameter and document trade-offs:
    processed
    (fastest),
    confirmed
    ,
    finalized
    (safest). Map your API defaults to the recommended level per use case (e.g., wallet balances often use
    confirmed
    ; settlement screens may require
    finalized
    ). (docs.solanalabs.com)
  • Per-method rate limits exist. Some RPCs like
    getProgramAccounts
    and
    getTokenLargestAccounts
    have explicit RPS caps (e.g., 3 RPS or 50 RPS on common providers). Build throttling and backpressure, and publish backoff guidance in your API docs. (quicknode.com)

Starknet

  • RPC versions deprecate on a schedule (0.6/0.7 sunset; 0.8–0.10 current in 2025). Negotiate version in clients and add smoke tests that fail builds when an endpoint drops an older version. (community.starknet.io)

Security patterns specific to Web3 APIs

  • Authenticate users and sessions with Sign‑In With Ethereum (EIP‑4361), validating domain binding, nonce freshness, and expiry. Keep the signed message and signature for audit. (eips.ethereum.org)
  • Apply the OWASP API Security Top 10 (2023): authorization across object and property levels, resource consumption controls, SSRF protections for webhooks, and inventory/version hygiene. Bake Spectral’s OWASP ruleset into CI to catch spec-level issues. (owasp.org)
  • Prefer mTLS/HMAC for service-to-service calls; lock down sensitive RPC methods (e.g., debug/trace) to trusted networks.

Resilience engineering: retries, timeouts, rate limits, idempotency

  • Retries with jitter: Use truncated exponential backoff with randomization; avoid retrying non‑idempotent actions unless protected by idempotency keys. (cloud.google.com)
  • Deadlines/timeouts: Always set RPC deadlines; propagate them downstream to prevent hung calls and cascading failures. (grpc.io)
  • gRPC/JSON‑RPC telemetry: instrument method, status, duration, and payload size to find pathological calls. (opentelemetry.io)
  • Idempotency for writes: support
    Idempotency-Key
    on POST/DELETE; replay the original successful response on retry. Document conflict behavior when a reused key mismatches payload. (stripe.com)
  • Rate limiting: enforce token/sliding-window policies at your API gateway; return standard headers (
    RateLimit-*
    ) and include guidance for clients. Kong’s advanced plugin supports sliding windows and Redis coordination. (developer.konghq.com)

Testing that catches chain/provider drift before users see it

  • Contract tests: publish Pact contracts from consumers; providers verify on every build. Run Dredd against your OpenAPI to keep implementation/spec in sync. (docs.pact.io)
  • Local mainnet‑fork testing: shadow-fork Ethereum with Hardhat or Foundry Anvil to reproduce tricky on‑chain states and simulate upgrades or reorgs in CI. Pin blocks for reproducibility. (hardhat.org)
  • Synthetic monitors: continuously call “canary” RPCs that historically break on upgrades (e.g.,
    eth_getLogs
    with narrow ranges;
    eth_getProof
    on known contracts; Solana
    getProgramAccounts
    with filters). Alert when p95 or error rate exceeds SLOs.
  • Load testing: benchmark “heavy” RPCs with realistic data (e.g.,
    eth_getLogs
    chunked by 2k blocks, capped response size) and validate provider-specific limits in your CI pipeline. (alchemy.com)

Example rollout: making your API EIP‑4844‑aware without downtime

  1. Update schemas and clients to support transaction type 3 and new fields (
    max_fee_per_blob_gas
    ,
    blob_versioned_hashes
    ). Add unknown-field tolerance for forward compatibility. (eips.ethereum.org)
  2. Add canary monitors for blob transactions (parse/validate receipts including blob gas usage).
  3. Route a small percentage of traffic to upgraded code behind a feature flag; compare p95 latency/error rate vs. baseline.
  4. Verify on a mainnet‑fork (Hardhat/Anvil) with recorded blob txs; run Pact/Dredd suites. (hardhat.org)
  5. Increase traffic gradually; freeze rollout if error budget burn accelerates. (sre.google)

Vendor due diligence checklist (RPC and dev partners)

Ask providers/vendors to document, with URLs where possible:

  • Availability commitments and history (status page) and whether 99.9%+ is financially backed. (aws.amazon.com)
  • eth_getLogs
    block range, log caps, and payload size limits across chains and plans. (quicknode.com)
  • Archive coverage and pricing/limits; do they auto-route historical calls? (alchemy.com)
  • Dencun/4844 and future protocol support timelines; testnets used; cutover playbooks. (blog.ethereum.org)
  • Solana commitment defaults and per-method RPS caps (e.g.,
    getProgramAccounts
    ,
    getTokenLargestAccounts
    ). (quicknode.com)
  • Starknet RPC version support and deprecation policies. (community.starknet.io)
  • Security: SOC 2/ISO 27001, mTLS options, IP allowlisting, webhook SSRF protections (documented OWASP controls). (owasp.org)

Brief, chain‑aware API design patterns you can copy

  • Finality-aware reads
    • Ethereum: expose
      blockTag
      options including
      safe
      /
      finalized
      ; default to
      safe
      for balances,
      latest
      for UI vanity reads. (eips.ethereum.org)
    • Solana: accept
      commitment
      ; default to
      confirmed
      , allow override. (docs.solanalabs.com)
  • Deterministic backfills
    • Segment
      eth_getLogs
      by 2,000-block windows; cap responses to 150 MB; retry with jitter; checkpoint progress externally (e.g., durable state). (alchemy.com)
  • Verifiable state
    • Return optional
      proof
      objects using
      eth_getProof
      tied to the queried block. (eips.ethereum.org)
  • Idempotent writes
    • Require
      Idempotency-Key
      for transaction-submission POSTs; if duplicate key, replay original result. (stripe.com)

Implementation snippet: resilient JSON‑RPC client defaults

// Pseudo-TypeScript: JSON-RPC client defaults for EVM
const DEFAULTS = {
  timeoutMs: 5000,                // set per call; never "infinite"
  deadlineMs: 10000,              // overall
  maxAttempts: 5,                 // with jittered backoff
  initialBackoffMs: 100,
  maxBackoffMs: 2000,
  jitter: true,                   // full or decorrelated
  idempotencyKeyHeader: 'Idempotency-Key',
  batchSize: 20,                  // respect provider constraints
  blockRangeChunk: 2000,          // for eth_getLogs
  acceptBlockTags: ['latest','safe','finalized'],
};

Backoff should be truncated exponential with jitter to avoid thundering herds; treat 5xx, 429, and network timeouts as retryable. (cloud.google.com)


The 7Block Labs API quality checklist

  • SLOs and error budgets defined, monitored, and enforced (freeze on burn). (sre.google)
  • OpenAPI 3.1 and JSON‑RPC contracts linted (Spectral + OWASP ruleset) and mocked (Prism). (openapis.org)
  • Consumer-driven contract tests (Pact), conformance tests (Dredd) in CI. (docs.pact.io)
  • OpenTelemetry traces and metrics for
    rpc.system=jsonrpc
    , p95 latency, error.type. (opentelemetry.io)
  • Finality-aware reads (Ethereum
    safe/finalized
    ; Solana commitments) and documented defaults. (eips.ethereum.org)
  • Logs backfill pagination compatible with provider caps; archive routing in place. (quicknode.com)
  • EIP‑4844 field support validated in schemas/tests; canary monitors deployed. (eips.ethereum.org)
  • SIWE auth for user sessions; OWASP API Top 10 controls applied. (eips.ethereum.org)
  • Retry + deadline policies with jitter; idempotency keys on writes; gateway rate limiting with sliding windows. (grpc.io)
  • Mainnet‑fork tests (Hardhat/Anvil) for upgrade scenarios and reorg tolerance. (hardhat.org)
  • Vendor questionnaire completed (SLA, range limits, archive, versioning timelines). (aws.amazon.com)

Final thoughts

Whether you outsource or build in-house, excellent API quality is a discipline: contract-first design, explicit finality semantics, verifiable data, measured SLOs, and continuous conformance testing. Get these right and provider changes, protocol upgrades, and multi-chain complexity become routine instead of risky.

If you’d like 7Block Labs to evaluate your current API surface and produce a chain‑aware quality plan (including Dencun/4844 audits, Solana commitment defaults, and provider cap benchmarking), our team can help you implement the checklist above fast.


Sources


Like what you're reading? Let's build together.

Get a free 30‑minute consultation with our engineering team.

Related Posts

7BlockLabs

Full-stack blockchain product studio: DeFi, dApps, audits, integrations.

7Block Labs is a trading name of JAYANTH TECHNOLOGIES LIMITED.

Registered in England and Wales (Company No. 16589283).

Registered Office address: Office 13536, 182-184 High Street North, East Ham, London, E6 2JA.

© 2025 7BlockLabs. All rights reserved.