How can we create multiple addresses under one hdwallet?


(sukeerthi) #1

Hi,

I tried to create hd private create key but it is giving an error

If possible please share any link i want to create multiple addresses under one hdwallet.
If possible please share any link i want to create multiple addresses under one hdwallet.

here is my code

var bitcore = require(‘bitcore’);

var explorers = require(‘bitcore-explorers’);

var insight = new explorers.Insight(‘testnet’);

bitcore.Networks.defaultNetwork= bitcore.Networks.testnet;

var HDPrivateKey = bitcore.HDPrivateKey;

var hdPrivateKey =‘tprv8ZgxMBicQKsPeqBh7KCjBDUs7mnUWbzeZ8T3zzVFbfSY5fxgWTNaygo8NRe1c2LgFdcMWgYJNLX46dbW73qusSoioR8LaQx47b7i3FqBUvD’// new HDPrivateKey();

var retrieved = new HDPrivateKey(hdPrivateKey);

var derived = hdPrivateKey.derive(“m/0’”);

var derivedByNumber = hdPrivateKey.derive(1).derive(2, true);

var derivedByArgument = hdPrivateKey.derive(“m/1/2’”);

var hdPublicKey = ‘tpubD6NzVbkrYhZ4YJDUzxsKad8ygoJQfwBZ8S3qHWXZ1wEvvADT8rCBABQzYaJWW75UTx9YW39Ci1TcsAzT7kKcKhHYSaepiWAafL8LQaXzSQV’//hdPrivateKey.hdPublicKey;

var address = derived.privateKey.toAddress();

I am getting this error

/home/ahex/Desktop/tokenize.node/controllers/bitcore.js:11
var derived = hdPrivateKey.derive(“m/0’”);
^

TypeError: hdPrivateKey.derive is not a function
at Object. (/home/ahex/Desktop/tokenize.node/controllers/bitcore.js:11:28)
at Module._compile (module.js:653:30)
at Object.Module._extensions…js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object. (/home/ahex/Desktop/tokenize.node/routes/routes.js:81:15)
at Module._compile (module.js:653:30)
at Object.Module._extensions…js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)

Thanks.