Can someone please explain how to get Master Seed when a new HD keys is created using Bitcore APIs?
My purpose is to implement wallet service in my application using Bitcore APIs.
Refer this link here
Bitcoin Stack Exchange is a question and answer site for Bitcoin crypto-currency enthusiasts. It only takes a minute to sign up.Sign up to join this community
In case you are talking about mnemonic seed use this -
npm install bitcore-mnemonic bower install bitcore-mnemonic
Then use it to generate mnemonic seed -
var Mnemonic = require('bitcore-mnemonic'); var code = new Mnemonic(Mnemonic.Words.ENGLISH); code.toString(); // army van defense carry jealous true garbage claim echo media make crunch... var xpriv = code.toHDPrivateKey();
If you just want to generate a private from bitcore api you can use this function -
var bitcore = require('bitcore'); var HDPrivateKey = bitcore.HDPrivateKey;
Please note there is no rule to generate a private key. A private key is just a random string. It could even be your name or a whole article. But you must create a private key that is 'random' in nature. Also never use programming language functions like md5 hash or something to generate a private key because they are not truly random.
Bitcore api, however, provides an easy way to generate a private key using the above method. From there you can proceed as usual.
var bitcore = require('bitcore'); var HDPrivateKey = bitcore.HDPrivateKey; var hdPrivateKey = new HDPrivateKey(); var retrieved = new HDPrivateKey('xpriv...'); var derived = hdPrivateKey.derive("m/0'"); var derivedByNumber = hdPrivateKey.derive(1).derive(2, true); var derivedByArgument = hdPrivateKey.derive("m/1/2'"); assert(derivedByNumber.xprivkey === derivedByArgument.xprivkey); var address = derived.privateKey.toAddress(); // obtain HDPublicKey var hdPublicKey = hdPrivateKey.hdPublicKey;