Creating addresses
Generating an NGNT address
To receive NGNT, one needs an address. An NGNT address is also a regular Ethereum address. You can receive ETH, NGNT & all other ERC 20 tokens with the same address.
We prefer to use ethers.js for all account/address generation needs.
Generating an address with a seed phrase
const ethers = require('ethers');
const mnemonic = <seed phrase here>;
// you can generate random seed phrase with await ethers.HDNode.entropyToMnemonic(ethers.utils.randomBytes(16));
const wallet = ethers.Wallet.fromMnemonic(mnemonic);
const address = wallet.address;Generating multiple addresses with the same seed phrase
Here's how to use web3 to generate multiple addresses with the same mnemonic seed phrase.
To do this, we'll need to combine the seed phrase with something called the derivation path. For the purpose of this guide, we should treat the derivation path as an index. We will increment the last digit of the derivation path to create new address with the same phrase.
First address derivation path = m/44'/60'/0'/0/0
Second address derivation path = m/44'/60'/0'/0/1
Third address derivation path = m/44'/60'/0'/0/2
Fourth address derivation path = m/44'/60'/0'/0/3
...and so onAs we can see, the last character of the derivation path acts very similarly to the an array's index.
Ethers.js lets you generate different addresses using the same seed phrase with multiple derivation paths.
Seed phrases are very sensitive and should be kept as private as possible, far away from version control. A seed phrase is essentially your private key, if it falls into the wrong hands, all accounts can lose their funds.
Last updated
Was this helpful?