$0.02631 -6.34%
TRX · 7w

Open-Source Development - Tron HD Wallet

tron-wallet-hd Tron HD wallet to generate offline private keys, mnemonic seeds and addresses. Installation npm install tron-wallet-hd

Sample recommended usage:

// the seed is stored encrypted by a user-defined password var password = prompt('Enter password for encryption', 'password'); keyStore.createVault({ password: password, // seedPhrase: seedPhrase, // Optionally provide a 12-word seed phrase // salt: fixture.salt, // Optionally provide a salt. // A unique salt will be generated otherwise. }, function (err, ks) { // Some methods will require providing the `pwDerivedKey`, // Allowing you to only decrypt private keys on an as-needed basis. // You can generate that value with this convenient method: ks.keyFromPassword(password, function (err, pwDerivedKey) { if (err) throw err; // generate five new address/private key pairs // the corresponding private keys are also encrypted ks.generateNewAddress(pwDerivedKey, 5); var addr = ks.getAddresses(); ks.passwordProvider = function (callback) { var pw = prompt("Please enter password", "Password"); callback(null, pw); }; }); }); keystore Function definitions

These are the interface functions for the keystore object. The keystore object holds a 12-word seed according to [BIP39][] spec. From this seed you can generate addresses and private keys, and use the private keys to sign transactions.

Usage const hdWallet = require('tron-wallet-hd'); const keyStore=hdWallet.keyStore; Methods keystore.createVault(options, callback)

This is the interface to create a new lightwallet keystore.

Options password: (mandatory) A string used to encrypt the vault when serialized. seedPhrase: (mandatory) A twelve-word mnemonic used to generate all accounts. salt: (optional) The user may supply the salt used to encrypt & decrypt the vault, otherwise a random salt will be generated. keystore.keyFromPa...
Continue on