Created
March 2, 2018 02:24
-
-
Save lengshuiyulangcn/f77cd9378a77aebace2cbfcc8f9790cd to your computer and use it in GitHub Desktop.
nem create account script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var nem = require("nem-sdk").default; | |
// Create random bytes from PRNG | |
var rBytes = nem.crypto.nacl.randomBytes(32); | |
// Convert the random bytes to hex | |
var privateKey = nem.utils.convert.ua2hex(rBytes); | |
var keyPair = nem.crypto.keyPair.create(privateKey); | |
var publicKey = keyPair.publicKey.toString(); | |
//Mainnet (104): N | |
//Testnet (-104): T | |
//Mijin (96): M | |
var address = nem.model.address.toAddress(publicKey, -104) | |
console.log("--------") | |
console.log(`privateKey: ${privateKey}`) | |
console.log(`publicKey: ${publicKey}`) | |
console.log(`address: ${address}`) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment