PPC ADDR GEN

node v8.17.0
version: master
endpointsharetweet
This is a playground to test JavaScript. It runs a completely standard copy of Node.js on a virtual server created just for you. Every one of npm’s 300,000+ packages are pre-installed, so try it out:
const EC = require('elliptic').ec; const SHA256 = require('js-sha256').sha256; const RIPEMD160 = require('ripemd160'); const BASE58CHECK = require('base58check'); const BA = require('binascii'); const EC_INSTANCE = new EC('secp256k1'); const KEY_PAIR = EC_INSTANCE.genKeyPair(); const NETWORK = "37"; const privateKey = KEY_PAIR.getPrivate('hex'); const key = BA.unhexlify(KEY_PAIR.getPublic('hex')); const keyHash = NETWORK + new RIPEMD160().update(SHA256(key)).digest('hex'); const checksum = SHA256(SHA256(keyHash)).substr(0, 4); const address = BASE58CHECK.encode(keyHash + checksum); // Output generated address/priv. key console.log(`Address (Wallet): ${address} (length: ${address.length})`); console.log(`Private Key: ${privateKey}`);
Loading…

no comments

    sign in to comment