Skip to main content


Privy makes it easy to get and switch the network of external wallets users connect to your app. You can find the full list of Privy's supported networks here.


Privy is proud to support apps building on Base! Just upgrade @privy-io/react-auth to version 1.32.0 or above, and switch your wallets to Base mainnet/testnet via the Chain IDs below.

Getting the current network

To get a wallet's current network, simply find the ConnectedWallet object for your desired wallet from the useWallets array, and inspect its chainId property:

// Find your desired wallet
const {wallets} = useWallets();
const wallet = wallets.find((wallet) => (wallet.address === 'your-desired-address'));
// Inspect its chainId
const chainId = wallet.chainId;
// 'eip155:1' (as an example for Ethereum mainnet)

This will be a CAIP-2 formatted chain ID.

Switching networks


If you need the user's wallet to always be on a given network, we recommend calling switchChain for the user's wallet on page load.

To switch the network of a wallet connected through Privy, first find the ConnectedWallet object for your desired wallet from the useWallets array:

const {wallets} = useWallets();
const wallet = wallets.find((wallet) => (wallet.address === 'your-desired-address'));

Then, call the ConnectedWallet object's switchChain method, passing your desired chain ID as a number or as a 0x-prefixed hexadecimal string:

// These lines are equivalent
await wallet.switchChain(137);
await wallet.switchChain('0x89');

For external wallets, switchChain will prompt the user to switch to the target network within the external wallet's client (e.g. the MetaMask browser extension or the Rainbow wallet mobile app).

switchChain returns a Promise that resolves to void once the wallet has successfully been switched to the target network. The Promise will reject with an error if:

  • The target chain is not supported.
  • The user declines the request to switch their network, from their external wallet client.

If you're using an external library like ethers or viem, you should switch the wallet's network to your desired network before initializing the wallet's client/provider instance for that library (e.g. getEthersProvider for ethers and createWalletClient for viem).

If you switch a wallet's network after initializing the external library's wallet provider, the provider may have an outdated chain ID.


The MetaMask mobile app currently has a bug that prevents an app from switching a wallet's network. This should be fixed in version 7.4.0 of the mobile app, which is slowly being rolled out.

Supported networks

By default, external wallets can be used on the networks listed below.


You can easily add additional networks to your app per these instructions!

NetworkChain IDSupported?
Arbitrum Goerli421613
Avalanche C-Chain43114
Avalanche Fuji43113
Base Goerli84531
Celo Alfajores44787
Ethereum Goerli5
Ethereum Sepolia11155111
Linea Testnet59140
Optimism Goerli420
Polygon Mumbai80001

Not all wallet clients support all networks; for example, Rainbow Wallet does not support most testnets. In kind, exact network support with Privy will vary on which wallet client is being used.

Adding additional networks

If your app doesn't use one of the default supported networks listed above, you can easily configure Privy to support your app's network! Simply follow the instructions below:


To support an additional network, first check if your desired network has a corresponding JSON representation in the @wagmi/chains library, a public repository of EVM networks. You can find the full list of networks supported by that library here.

If your network is included in @wagmi/chains, you can simply import the network and follow the instructions below.

If your network is not included in @wagmi/chains, you can instead build your own JSON representation of the network, that implements wagmi's Chain type. You can find the required fields of this type here.

First, install the latest version of the @privy-io/react-auth and @wagmi/chains SDKs:

npm i @privy-io/react-auth@latest @wagmi/chains

In particular, your @privy-io/react-auth dependency must be on version 1.37.0 or later.

Next, import your desired network(s) from @wagmi/chains:

As an example, here we import the @wagmi/chains objects for the Aurora mainnet and testnet:

// Replace this with any of the networks listed at
import {aurora, auroraTestnet} from '@wagmi/chains';

Lastly, configure your PrivyProvider with these additional network(s):

The config property of the PrivyProvider contains an optional additionalChains field. In this field, pass an array containing your imported chain objects from @wagmi/chains, like below:

// Replace the entries in this array with the chains you imported from `@wagmi/chains`
additionalChains: [aurora, auroraTestnet]
{/* your app's content */}

That's it! Your user's wallet can now take on-chain actions on any of Privy's default supported chains, or any other chains you've supplied in additionalChains.