Skip to content

Instantly share code, notes, and snippets.

@hyunsikjeong
Created October 22, 2018 07:32
Show Gist options
  • Save hyunsikjeong/8497002729b420e4d0e860290934ea4b to your computer and use it in GitHub Desktop.
Save hyunsikjeong/8497002729b420e4d0e860290934ea4b to your computer and use it in GitHub Desktop.
blog_keystore_hdw_example.js
var keystore = require("codechain-keystore");
var CCKey = keystore.CCKey;
async function main() {
var passphrase = "codechain";
var cckey = await CCKey.create({ dbType: "in-memory" });
console.log(cckey);
var seedHash = await cckey.hdwseed.createSeed({ passphrase });
console.log(`Created a seed with hash: ${seedHash}`);
var publicKey = await cckey.hdwseed.getPublicKeyFromSeed({
seedHash,
path: "m/1/2/3",
passphrase
});
console.log(`Created a public key from the hash with the path "m/1/2/3": ${publicKey}`);
}
main().catch(console.error);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment