I have an assignment from my prof to make an ethereum exchange. Is it possible to use HD wallet to generate multiple public address for all the customers? if so, what is the easiest implementation?

| improve this question | | | | |
  • hi i want to create an exchange and i wanna give hd wallet for each members is it possible??? and can i use ledger hd wallet or trezor – mehdi safari Aug 6 '19 at 10:58

Yes, it should be possible.

You can use a library like ethereumjs-wallet that provides an API to manage HD wallets.

const hdkey = require('ethereumjs-wallet/hdkey');

// Bip39 only if you use mnemonic seed
const bip39 = require('bip39');
const mnemonic = "interest plate fix ...";
const seed = bip39.mnemonicToSeed(mnemonic);

// Obtain master wallet
const masterWallet = hdkey.fromMasterSeed(seed);

// Obtain user wallet using derivation path, 
// userId is an integer between 0 and 2^31-1
const userId = 1234;
// For security reasons you likely use a different path
// and have to understand the difference between
// normal and hardened keys
const userPath = "m/44'/60'/0'/0/" + userId;
const userWallet = masterWallet.derivePath(userPath).getWallet();
| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.