0

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?

  • 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 06 '19 at 10:58

1 Answers1

1

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();
Ismael
  • 30,570
  • 21
  • 53
  • 96