Skip to content

Instantly share code, notes, and snippets.

@planethouki
Created December 5, 2020 07:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save planethouki/7717d112d55e01cd5ae7f1d2b6838d6a to your computer and use it in GitHub Desktop.
Save planethouki/7717d112d55e01cd5ae7f1d2b6838d6a to your computer and use it in GitHub Desktop.
// node v14.4.0
// symbol-hd-wallets v0.13.0
// dotenv v8.2.0
require('dotenv').config();
const { MnemonicPassPhrase, ExtendedKey, Wallet } = require("symbol-hd-wallets");
const { NetworkType } = require('symbol-sdk');
const DEFAULT_ACCOUNT_PATH = "m/44'/4343'/0'/0'/0'";
const VRF_ACCOUNT_PATH = "m/44'/4343'/0'/1'/0'";
const words = process.env.MNEMONIC;
const mnemonic = new MnemonicPassPhrase(words);
const xkey = ExtendedKey.createFromSeed(mnemonic.toSeed());
const wallet = new Wallet(xkey);
const optInAccount = wallet.getChildAccount(DEFAULT_ACCOUNT_PATH, NetworkType.MAIN_NET);
console.log("opt in account");
console.log(`public key: ${optInAccount.publicKey}`);
console.log(`address: ${optInAccount.address.plain()}`);
console.log(`address: ${optInAccount.address.pretty()}`);
const vrfAccount = wallet.getChildAccount(VRF_ACCOUNT_PATH, NetworkType.MAIN_NET);
console.log("vrf account");
console.log(`private key: ${vrfAccount.privateKey}`);
console.log(`public key: ${vrfAccount.publicKey}`);
console.log(`address: ${vrfAccount.address.plain()}`);
console.log(`address: ${vrfAccount.address.pretty()}`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment