About MetaMask SDK
MetaMask SDK is a library that provides a reliable, secure, and seamless connection from your dapp to the MetaMask browser extension and MetaMask Mobile. You can install the SDK in existing dapps, and call any Wallet API methods from your dapp. Get started using the SDK.
Benefits of MetaMask SDK
MetaMask SDK enables your dapp to provide a seamless user experience for MetaMask users, from multiple dapp platforms, without relying on third-party libraries. By integrating your dapp using the SDK, millions of MetaMask Mobile users can connect to their preferred MetaMask client. The SDK uses the MetaMask Ethereum provider, so existing dapps work out of the box with the SDK.
The following table outlines some of the features available when you integrate your dapp with MetaMask using the SDK. Most of these features are not available if you only integrate your dapp directly using the Wallet API.
Feature | Wallet API only | MetaMask SDK |
---|---|---|
Connect from a web dapp to the MetaMask extension | ✅ | ✅ |
Connect from a web dapp to MetaMask Mobile | ❌ | ✅ |
Connect from desktop, mobile, and gaming dapps to MetaMask Mobile | ❌ | ✅ |
Use custom RPC methods such as connectAndSign | ❌ | ✅ |
Display custom modals in MetaMask | ❌ | ✅ |
Make read-only requests using the Infura API | ❌ | ✅ |
Batch multiple RPC requests | ❌ | ✅ |
User experience
The following are examples of how a user experiences a dapp with the SDK installed, on various platforms.
- Desktop browser
- Mobile browser
- iOS
- Android
- Node.js
- Unity
When a user accesses your web dapp on a desktop browser that doesn't have the MetaMask extension installed, a popup appears that prompts the user to either install the MetaMask extension or connect to MetaMask Mobile using a QR code.
- Get started by setting up the SDK in your web dapp.
- See the example JavaScript dapps in the JavaScript SDK GitHub repository for advanced use cases.
When a user accesses your web dapp on a mobile browser, the SDK automatically deeplinks to MetaMask Mobile (or if the user doesn't already have it, prompts them to install it). After the user accepts the connection, they're automatically redirected back to your dapp. This happens for all actions that need user approval.
- Get started by setting up the SDK in your web dapp.
- See the example JavaScript dapps in the JavaScript SDK GitHub repository for advanced use cases.
When a user accesses your iOS dapp, the SDK automatically deeplinks to MetaMask Mobile (or if the user doesn't already have it, prompts them to install it). After the user accepts the connection, they're automatically redirected back to your dapp. This happens for all actions that need user approval.
- Get started by setting up the SDK in your iOS dapp.
- See the example iOS dapp in the iOS SDK GitHub repository for advanced use cases.
When a user accesses your Android dapp, the SDK automatically deeplinks to MetaMask Mobile (or if the user doesn't already have it, prompts them to install it). After the user accepts the connection, they're automatically redirected back to your dapp. This happens for all actions that need user approval.
- Get started by setting up the SDK in your Android dapp.
- See the example Android dapp in the Android SDK GitHub repository and the Android SDK architecture for more information.
When a user accesses your Node.js dapp, the SDK renders a QR code on the console which users can scan with their MetaMask Mobile app.
- Get started by setting up the SDK in your Node.js dapp.
- See the example Node.js dapp in the Node.js SDK GitHub repository for advanced use cases.
When a user accesses your Unity game, the SDK renders a QR code in the game UI using a dedicated prefab which players can scan with their MetaMask Mobile app. It also supports deeplinking on mobile platforms, as demonstrated in the following screen recording.
- Get started by setting up the SDK in your Unity game.
- See the Unity demo game with the SDK installed for advanced use cases.
You can read more about the connection flow between the SDK and MetaMask.