Skip to content

Steps to Create a Metamask Wallet

This script creates a single or multiple Metamask wallets. Below are the key steps in the process that I should understand to create a wallet.

Install Extension into Profile

Before running the script, I need to install the extension in the profile before creating a wallet.

Install from Chrome Web Store

First, open the extension link: https://chromewebstore.google.com/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn

Then, click Add to Chrome and Add extension.

id metamask

id metamask

When the extension appears in the extensions list like this, the installation is successful:

id metamask

After that, I can run the process to create a wallet.

Install Older Versions

I can also install older versions by visiting the official extension page: https://github.com/MetaMask/metamask-extension/releases

Then, select a desired version and download its file:

id metamask

id metamask

After downloading, install the extension in the Manage Extensions section as guided here.

Open Extension on Web Platform

To perform wallet creation actions, I first need to access the Metamask wallet page using the Open Link node with the URL chrome-extension://x/home#onboarding/welcome, where x is the extension ID of the Metamask wallet. To get the ID, I visit chrome://extensions/, enable Developer mode to display all extension IDs, copy the Metamask ID, and replace x with it.

id metamask

Create a Table for Process Data

After accessing the wallet link, I need to create tables in the process to store data generated during execution. To create a table, I click the table icon and set it up in the displayed window.

id metamask

Retrieve Selectors for Elements

To get the selector of any element on a tab, I can click the crosshair icon in nodes requiring a selector.

id metamask

This activates the CSS Selector tool on the active tab, allowing me to select the desired element’s selector. For example, the selector for the I agree to MetaMask's Terms of use checkbox is shown below:

id metamask

After copying the selector, I paste it into a Mouse Click node to interact with the desired element. I can use this node to click the checkbox.

Click CSS Selector

Similarly, for other elements, I can retrieve selectors using the same method or refer to an alternative method in this video.

Insert Important Data

To insert data into a table, I use the Insert Data node. For example, I can generate a random password and insert it into the password column. For more details on random syntax, refer to Expressions.

Insert Data

After inserting the password into the table, I use a Key Press node to input the password into the password field. For more details on retrieving table data syntax, see Expressions.

Key Press

Additionally, for data stored in Temporary Memory, I can use the Temporary Memory node to save it into a table column. For instance, in the image below, I insert data from Temporary Memory into the privateKey column:

Temporary Memory

Memorize and Enter 12 Recovery Words

Beyond basic nodes like Mouse Click, Key Press, and Switch Tab, this process requires addressing the challenge of entering the 12 secret recovery words into empty fields.

First, I click the copy icon to save the secret words to Temporary Memory:

Memorize 12 Words

Then, I use the Temporary Memory node to insert the saved data into a variable keys and the words column:

Temporary Memory

After storing the 12-word string in a variable, I use a JavaScript Code node to convert the string into an array of individual words:

js
const keys = omniloginRefData('variables', 'keys');
const words = keys.split(' ');
omniloginSetVariable('words', words);

With the 12-word array, I use another JavaScript Code node to map the word order to variables:

js
const cum_12_ky_tu = omniloginRefData('variables', 'words');

const thu_tu_trong = Array.from(document.querySelectorAll('.chip__input'))
  .map(elem => 
    elem.getAttribute('data-testid')
    .split('-')
    .slice(-1)[0]
  );
omniloginSetVariable('tu_can_dien', thu_tu_trong.map(t => cum_12_ky_tu[t]));

Next, I use a Data Loop node to iterate over the empty fields, selecting them with the appropriate selector:

Capture Elements

Finally, I use a Key Press node to fill in the missing words:

Fill Words into Empty Fields

These are the key steps in the Metamask wallet creation process. If I encounter difficulties with the remaining steps, I can refer to the tutorial videos in the Automation playlist on the OmniLogin YouTube channel.