Library to assist in payment processing on tron. It first allows for generation of address according to the BIP44 standard.
Some work is inspired off of the prior work done by tron-bip44
Coming soon: tools to sign transactions passed down from the server connected to web3.
npm install --save tron-payments
Create a new wallet (DON'T DO THIS ON PRODUCTION):
let tronPayments =let keys = tronPaymentsconsoleconsole
Generate an tron deposit address from a public seed (xpub). This is useful if you are a hot wallet and don't store the private key. You will need to keep track of which path node you are on (increasing INT):
let depositAddress = tronPayments // for path m/44'/195'/0/1234console
Get the private key for an address on a specific path:
let privateKey = tronPayments // for path m/44'/195'/0/1234
Get the public key from a private key:
let address = tronPayments // for path m/44'/195'/0/1234ifaddress === depositAddressconsoleelseconsole
Get the derived xpub key from a hardened private key:
let xpub = tronPayments // for path m/44'/195'/0'/0/1234
Get the balance of an address:
Generate a sweep transaction for a deposit address, then broadcast it:
Generate a simple send transaction
Get a transaction and check if it is confirmed based on a number of blocks:
// 2 blocks is considered confirmedtronPayments
See test/test.js for more utilities
Note: It is suggested to generate your Private key offline with FAR more entropy than the default function, then use getXpubFromXprv. You have been warned!