Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

Sign XRP TX using HEX privateKey

node v8.17.0
version: 2.0.0
endpointsharetweet
const ripple = require('ripplelib') const sign = require('ripple-sign-keypairs') // NOTE! ripplelib isn't working in Safari 10.1 (wrong public key generated from private key) - use // ripple-keypairs, as displayed in: // > https://runkit.com/wietsewind/hex-private-key-to-address-with-ripple-lib // > https://runkit.com/wietsewind/mnemonic-with-ripple-keypairs-w-o-ripplelib // var privateKey = '0762EED5BA4F378FFA60621C6DEF72F4A0A579112ADA5F5D6B2A35EC27E893A5' // const key = ripple.KeyPair.from_json(privateKey) // const keyPair = { privateKey: '00' + key.to_hex_pri(), publicKey: key.to_hex_pub() } // console.log('privateKey: ' + keyPair.privateKey) // console.log('privateKeyWif: ' + key.to_pri_string()) // to_wif // console.log('publicKey: ' + keyPair.publicKey) // console.log('address: ' + key.to_address_string()) // // Now sign a transaction... // var tx = { // TransactionType: 'Payment', // Account: key.to_address_string(), // Fee : (0.000012 * 1000 * 1000) + '', // Destination: 'rPEPPER7kfTD9w2To4CQk6UCfuHM9c6GDY', // DestinationTag : 2, // Amount: (1 * 1000 * 1000) + '', // Sequence: 0 // } // var txJSON = JSON.stringify(tx) // var txSign = sign(txJSON, keyPair) // console.log(txSign) // return txSign
Loading…

no comments

    sign in to comment