Connect to EVM networks
Connect to Ethereum and other EVM networks in MetaMask using @metamask/connect-evm.
Your existing viem, ethers.js, or web3.js code works with minimal changes — the EVM client gives you a standard EIP-1193 provider (the same window.ethereum-shaped interface you're used to), with automatic platform detection, relay connections, and session persistence built in.
Quick example
import { createEVMClient } from '@metamask/connect-evm'
const client = await createEVMClient({
dapp: { name: 'My DApp', url: 'https://mydapp.com' },
})
// Connect and request chains
const { accounts, chainId } = await client.connect({
chainIds: ['0x1', '0x89'], // Ethereum Mainnet + Polygon
})
// Get an EIP-1193 provider — works with ethers.js, viem, web3.js, etc.
const provider = client.getProvider()
const balance = await provider.request({
method: 'eth_getBalance',
params: [accounts[0], 'latest'],
})
The SDK handles platform detection, relay connections, and session persistence automatically — you just work with the provider.
Get started
MetaMask Connect is available in a variety of ways to make integration as easy as possible. Access it directly via npm, through popular developer libraries like Wagmi, or as part of popular convenience libraries:
Library compatibility
The EVM client works seamlessly with popular Ethereum libraries:
| Library | Compatibility |
|---|---|
| viem | Use with custom() transport |
| ethers.js | Pass client.getProvider() to BrowserProvider |
| web3.js | Pass client.getProvider() to Web3 constructor |
Use EVM and Solana together
If your dapp supports both EVM and Solana, use both the EVM and Solana clients. They share the same underlying multichain session — the user only approves once.
See the Multichain documentation for more details on cross-ecosystem connections.