Docs

Chain

The thirdweb SDK works with any EVM chain.

All you need to connect a chain is its chain id. RPC connection to the chain is handled for you.

import { defineChain } from "thirdweb";
const myChain = defineChain(myChainId);

The SDK comes with predefined popular chains like base, polygon, and more exported from the thirdweb/chains entrypoint.

import { polygon } from "thirdweb/chains";
const myChain = polygon;

Configuring chains (Advanced)

You can also configure chains with custom RPC endpoints, native currency, block explorers, and more.

const myChain = defineChain({
id: myChainId,
rpc: "https://my-custom-rpc.com",
...
})