Skip to content
ChainFoundry

Migration

Migrating from Alloy, viem, ethers.js, or The Graph

Already using an EVM-only library or SaaS indexer? ChainFoundry extends your stack to 7 architectures without rewriting everything.

The scenario

You've already built your product using:

  • Alloy or ethers-rs for Rust EVM interaction
  • viem or ethers.js for TypeScript EVM interaction
  • The Graph or Envio for indexing
  • Alchemy or Moralis APIs for blockchain data

And now your boss, investors, or users want you to support Solana. Or Cosmos. Or Sui. Or “all the chains.”

The problem with your current stack

What you haveWhat it coversWhat it doesn't
AlloyEVM (Rust)Solana, Cosmos, Substrate, Bitcoin, Aptos, Sui
viemEVM (TypeScript)Everything non-EVM
The GraphEVM indexingReal-time, non-EVM chains, embeddable
Alchemy APIEVM + some SolanaSelf-hosted, non-EVM depth, correlation

How ChainFoundry extends your stack

You don't need to rip out Alloy or viem. ChainFoundry sits alongside them for non-EVM chains:

rust
class="tok-c">// Keep using Alloy for EVM — it's great at what it does
let alloy_provider = ProviderBuilder::new()
    .connect(class="tok-s">"https://eth-rpc.com")
    .await?;

class="tok-c">// Add ChainFoundry for everything else
let sol_client = chainrpc::ChainClient::solana(class="tok-s">"https://sol-rpc.com");
let cosmos_client = chainrpc::ChainClient::cosmos(class="tok-s">"https://cosmos-rpc.com");
let sui_client = chainrpc::ChainClient::sui(class="tok-s">"https://sui-rpc.com");

class="tok-c">// Same middleware (circuit breaker, rate limiting, caching) across all non-EVM chains
class="tok-c">// Alloy handles EVM. ChainFoundry handles the rest.

Or replace everything with one unified interface

typescript
class="tok-c">// Before: 3 libraries, 3 APIs, 3 maintenance burdens
import { createPublicClient } from class="tok-s">'viem';
import { Connection } from class="tok-s">'@solana/web3.js';
import { StargateClient } from class="tok-s">'@cosmjs/stargate';

class="tok-c">// After: 1 library, 1 API, 1 maintenance burden
import { ChainClient } from class="tok-s">'@chainfoundry/chainrpc';
const eth = ChainClient.evm(ethRpc);
const sol = ChainClient.solana(solRpc);
const cosmos = ChainClient.cosmos(cosmosRpc);
class="tok-c">// Same interface. Same middleware. Same error handling.

What you gain

  • Go from “EVM-only” to “7 architectures, 500+ networks” without rewriting your EVM code
  • Use ChainFoundry alongside Alloy/viem or as a full replacement — your choice
  • Get production middleware (failover, caching, rate limiting) for every non-EVM chain for free
  • Future-proof: adding chain #8 is a one-line config change

Who this is for

  • Teams with existing EVM products expanding to multichain
  • Projects migrating from deprecated ethers-rs to a multichain-ready stack
  • Teams on The Graph wanting to self-host or add non-EVM chains
  • Anyone paying for RPC APIs who wants to reduce vendor dependency