# NodeJS

You can import the MetaMask SDK into your nodeJS application to enable users to easily connect with their MetaMask Mobile wallet.

The SDK will render a QR code on the console which users can scan with their MetaMask Mobile app and now you can use all the ethereum methods available right from your nodeJS app!

# 1. Install a MetaMask Mobile version compatible with the SDK

In order to test the MetaMask SDK, developers need access to a MetaMask Mobile build that is compatible with the SDK. Please install MetaMask Mobile v5.8.1 or above.

# 2. Install the SDK

yarn add @metamask/sdk
or
npm i @metamask/sdk

# 3. Import the SDK

import MetaMaskSDK from '@metamask/sdk';

# 4. Instantiate the SDK

For all Javascript-based apps, instantiate the SDK like this:

const MMSDK = new MetaMaskSDK(options);
const ethereum = MMSDK.getProvider(); // You can also access via window.ethereum

For a list of possible options check here

# 5. Use the SDK

ethereum.request({ method: 'eth_requestAccounts', params: [] });

TIP

You should always call eth_requestAccounts first--that is what makes the SDK render the QR code on the console!

For other possible methods, check the Ethereum Provider API

# Recordings

# Examples

# Install the example: yarn

# Run the example: node .