Connect to MetaMask
You can connect your dapp to MetaMask using one of the following methods:
- MetaMask SDK
- Third-party libraries with SDK support, such as Wagmi or Web3-Onboard
- The Wallet API directly
The following table compares the supported features of each connection option:
Feature | MetaMask SDK | Third-party libraries with SDK | Wallet API only |
---|---|---|---|
Connect from a web dapp to the MetaMask extension | ✓ | ✓ | ✓ |
Connect from a web dapp, desktop, mobile, and gaming dapps to MetaMask Mobile | ✓ | ✓ | |
Use EIP-6963 to connect to MetaMask without conflict | ✓ | ✓ | ✓ |
Custom RPC methods such as connectAndSign , custom modals, read-only requests using Infura API, and RPC request batching | ✓ | ✓ |
MetaMask SDK
MetaMask SDK enables a reliable, secure, and seamless connection between your dapp and the MetaMask browser extension or MetaMask Mobile. You can call any Wallet API method from a dapp with the SDK installed, and you can integrate the SDK into existing projects without modifying existing Wallet API calls.
Key features include:
- Multi-platform support – Connect from web, desktop, mobile, and gaming platforms.
- Seamless mobile integration – Use QR codes or deeplinks to establish persistent connections with MetaMask Mobile.
- EIP-6963 detection – Automatically detect MetaMask without conflicting with other installed wallets.
- RPC request batching – Improve efficiency by batching multiple requests into a single call.
The SDK only connects to MetaMask. We recommend using third-party libraries with SDK support if you need to connect to multiple wallets.
Get started using MetaMask SDK.
Third-party libraries
MetaMask SDK integrates seamlessly with libraries like Wagmi and Web3-Onboard, simplifying wallet connections and supporting multiple wallets. These libraries include all key features of the SDK, streamline connection logic, and offer additional features for managing multiple wallets. We recommend using third-party libraries if you need to connect to multiple wallets.
Due to their multi-wallet support, third-party libraries might reduce control over specific MetaMask features, and introduce potential inconsistencies across different wallets.
Get started with Wagmi or Web3-Onboard.
Wallet API
The Wallet API consists of an Ethereum Provider API and a JSON-RPC API, which allow you to interact with users' EVM accounts in MetaMask. For most dapps, we recommend integrating with MetaMask using the SDK or third-party libraries in conjunction with the Wallet API, to take advantage of the SDK's benefits. However, you can also connect to the MetaMask extension directly using the Wallet API.
Get started with the Wallet API.