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 provider API methods from your dapp.
MetaMask SDK is the recommended method of integrating your dapp with MetaMask. You can get started by setting up the SDK.
Benefits of MetaMask SDK
Before MetaMask SDK, there were three ways to connect a dapp to a user's MetaMask wallet:
- Connect from a web dapp in a desktop browser to the MetaMask browser extension
- Connect from a web dapp in MetaMask Mobile's in-app browser to MetaMask Mobile
- Use third-party libraries to connect a mobile dapp to MetaMask Mobile
With MetaMask SDK, there are more ways to connect:
- Connect from a web dapp in a desktop browser to the MetaMask browser extension or to MetaMask Mobile
- Connect from a web dapp in a mobile browser to MetaMask Mobile
- Connect from desktop, mobile, and gaming dapps to MetaMask Mobile
MetaMask SDK enables your dapp to provide a seamless user experience for MetaMask users, from multiple dapp platforms, without relying on third-party libraries.
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 JavaScript SDK examples 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 JavaScript SDK examples 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 iOS SDK example 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 Android SDK example and 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 Node.js SDK example 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.