Powered by

A design system from Family

Custom Chains

By default, we only surface Ethereum Mainnet. If you'd like, you can include more networks like Optimism, Polygon, and others.

Example

ConnectKit uses wagmi internally, meaning all the various chains from wagmi are available. All you need to do is provide a custom wagmi client.

First, make sure to import the chain constant from wagmi:

,
CustomChains.jsx
1import { chain } from "wagmi";

Then simply replace the default client provided to wagmi with a custom one. Make sure to include your own Infura or Alchemy IDs for the various connectors you want to support.

Below is an example of an app supporting multiple chains/networks using ConnectKit:

,
CustomChains.jsx
1import { WagmiConfig, createClient, chain } from "wagmi";
2import { ConnectKitProvider, getDefaultClient } from "connectkit";
3
4const alchemyId = process.env.ALCHEMY_ID;
5
6// Choose which chains you'd like to show
7const chains = [chain.mainnet, chain.polygon, chain.optimism, chain.arbitrum];
8
9const client = createClient(
10 getDefaultClient({
11 appName: "Your App Name",
12 alchemyId,
13 chains,
14 }),
15);
16
17const App = () => {
18 return (
19 <WagmiConfig client={client}>
20 <ConnectKitProvider>
21 {/* Your App */}
22 <ConnectKitButton />
23 </ConnectKitProvider>
24 </WagmiConfig>
25 );
26};

And that's it—users can now choose to connect to any of the networks listed in the chains array.

Chains & Networks

In the example above, we used four different chains. In the table below you'll find a more extensive list of chains you can add to ConnectKit (which wagmi supports out of the box):

ChainDescriptionChain ID
mainnet
chain.mainnetEthereum Mainnet1
hardhat
chain.rinkeby Rinkeby Testnet4
hardhat
chain.ropsten Ropsten Testnet3
goerli
chain.goerliGörli Testnet5
kovan
chain.kovanKovan Testnet42
localhost
chain.localhostLocalhost Testnet1337
hardhat
chain.hardhatHardhat Default Network31337
arbitrum
chain.arbitrumArbitrum Network42161
arbitrumRinkeby
chain.arbitrumRinkebyArbitrum Rinkeby Network421611
optimism
chain.optimismOptimism Network10
optimismKovan
chain.optimismKovanOptimism Kovan Testnet69
polygon
chain.polygonPolygon Network137
polygonMumbai
chain.polygonMumbaiPolygon Mumbai Testnet80001