Matrix AI Network integration tutorials — Part 1: Converting an ETH address to MAN address (JS, NodeJS), Beginner level

Matrix AI Network
4 min readAug 6, 2021

Author: Delbypoc

This tutorial is for educational purposes only, I’m not responsible for any losses, damages, or other liabilities which may occur by using any info/code provided here(or anywhere else it is posted).

I’m under no circumstances a Javascript professional (or a JS Ninja/Expert)!

The code is not production ready! (only for learning purposes)

In this guide, I’m going to show you how to convert an ETH address to an MAN address (Mainnet).

The language picked for this guide will be JavaScript with Node.js as a runtime environment. (as a prerequisite you’ll have to install Node.js,,make sure to also install npm, an editor like and create a folder on which we will have the project on, somewhere)

Let’s first start by opening a cmd prompt.

To open a terminal you can type cmd into the start search bar, the start search bar is at the bottom left of the screen (if no themes were applied)

After opening the terminal we are going to cd into the folder we created (in my case, AddressCoverter): cd AddressConverter

Now we are going to create a new npm package by running npm init in a command prompt (pointing at a folder of your choice, I’ll use my folder on Desktop for this test, named AddressConverter) and provide the right info (or skip through it by pressing enter and writing yes at the end of the ‘setup’ (Is this Ok?), it should look similar to this:

Also, run the following commands on the cmd you got open at the package location (we install some packages which we will be using for our mini-application):

npm install buffer

npm install polycrc

npm install bs58

Now open Visual Studio Code on that folder location, create a file named index.js, install any required extensions (js lint or anything that is suggested by Visual Studio Code for node.js/js) and let’s start coding.

We start by including the modules we previously installed:

Now let’s create a function that checks if the address we provided is VALID (has valid characters, we will use regex for that, make sure that the provided address starts with 0x then it is followed by a string of 40 hexadecimal characters: a…f, A…F, 0…9, the i modifier is used to perform case-insensitive matching):

Now we call another function named getConvertedManAddress, this one will convert it into a Matrix AI Network Mainnet format (Base58, the excluded characters are 0, O, I, l):

Whole program (

For `0x5Fd71CF221e450E619638338bD21871229835261` it should return `MAN.2LSfiVSmKx8PD9YUbdVGuHEhDY3Jz`

For `0x5Fd71CF221e450E619638338bD21871229835261z` it should return `0x5Fd71CF221e450E619638338bD21871229835261z is not a valid ETH address`

For more documentation on the packages used, you can check:

Also, check out the official Matrix AI Network Developer Portal:



Matrix AI Network

The Matrix AI Network was founded in 2017. In 2023, we enter Matrix 3.0 blending neuroscience with our previous work to realize the vision of the Matrix films.