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 your preferred chains from wagmi:
CustomChains.jsx
1import { mainnet, polygon, optimism, arbitrum } from "wagmi/chains";
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";34const alchemyId = process.env.ALCHEMY_ID;56// Choose which chains you'd like to show7const chains = [mainnet, polygon, optimism, arbitrum];89const client = createClient(10 getDefaultClient({11 appName: "Your App Name",12 alchemyId,13 chains,14 }),15);1617const 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):
Chain | Description | Chain ID | ||
---|---|---|---|---|
chain.mainnet | Ethereum Mainnet | 1 | ||
chain.rinkeby | Rinkeby Testnet | 4 | ||
chain.ropsten | Ropsten Testnet | 3 | ||
chain.goerli | Görli Testnet | 5 | ||
chain.kovan | Kovan Testnet | 42 | ||
chain.localhost | Localhost Testnet | 1337 | ||
chain.hardhat | Hardhat Default Network | 31337 | ||
chain.arbitrum | Arbitrum Network | 42161 | ||
chain.arbitrumRinkeby | Arbitrum Rinkeby Network | 421611 | ||
chain.optimism | Optimism Network | 10 | ||
chain.optimismKovan | Optimism Kovan Testnet | 69 | ||
chain.polygon | Polygon Network | 137 | ||
chain.polygonMumbai | Polygon Mumbai Testnet | 80001 |