Configuring EVM networks
Read below to learn how to configure supported EVM networks for the Expo SDK and how to switch the embedded wallet’s current network.
Configuring networks
Privy embedded wallets can support any EVM-compatible chain. You can configure EVM networks for Privy via the supportedChains
property of the PrivyProvider
component, per the instructions below.
Configuring viem
-supported networks
If your desired EVM network is supported by the popular viem/chains
package, continue with the instructions below. A full list of the package’s supported networks is available here.
Otherwise, skip to the Other Networks section.
To configure viem
-supported networks for Privy, first, install the viem
package. This package contains JSON representations of several EVM networks, which will be used to initialize the Privy SDK.
Next, import your required chains from the viem/chains
package:
Lastly, configure the supportedChains
prop of your PrivyProvider
with an array including your required networks.:
Other Networks
If your desired EVM network is not supported by
viem/chains
, you can still use Privy with
it per the steps below!
First, import viem
and use the package’s defineChain
method to build a JSON representation of your desired network.
At minimum, you must provide the network’s name and chain ID, native currency, RPC URLs, and a blockexplorer URL.
Then, pass the returned object (myCustomChain
in the example above) to the supportedChains
array of the PrivyProvider
, like above.
Overriding a chain’s RPC provider
By default, transactions from the embedded wallet will be sent using Privy’s default RPC providers. Please note that Privy’s default providers are subject to rate limits; these limits are sufficiently generous for developing your integration and moderate amounts of app usage.
As your app’s usage scales, we recommend that you setup your own RPC providers (with Alchemy, QuickNode, Blast, etc.) and configure Privy to use these providers per the instructions below. Setting up your own providers gives you maximum control over RPC throughput and rate limits, and offers you much more visibility into RPC analytics and common errors.
To configure Privy to use a custom RPC provider, first, import the chain you want to override, and import the helper function addRpcUrlOverrideToChain
from @privy-io/chains
to override the RPC provider
Now, you can add the chain returned by addRpcUrlOverrideToChain
(e.g. mainnetOverride
) to the supportedChains
config option like before.
Default Configuration
If neither defaultChain
nor supportedChains
is explicitly set for your app, Privy will automatically default to the following list of EVM-compatible networks:
Want to use a chain not listed below? Configure Privy with any EVM-compatible chain, like Berachain, Monad, or Story per the guidance here.