Using the code to construct Keys, Addresses and Transactions.
npm install bitcoin-KAT
var bitcoin = require('bitcoin-KAT')Generate keys randomly
bitcoin.keys()Generate keys with given private key
bitcoin.keys(privateKey) //privateKey: private key hexGenerate keys for Testnet
bitcoin.keys_testnet()Generate an address
bitcoin.address(publicKey) //publicKey: public key hexGenerate an address for Testnet
bitcoin.address_testnet(publicKey)Generate a transaction rawdata, take a look at this transaction for example. Currently support P2PKH only.
var payment = [
{
from: 'n4j1MtzGZpivsqbvrcAqPV4GS74B3kS7qG', //payer's address
to: 'mwCwTceJvYV27KXBc3NJZys6CjsgsoeHmf', //payee's address
value: 0.64, //payment amount in BTC
prevHash: '0e512b5ab9220e473928b0c2728aaa74ec66a1cc827caa29a744eb508d15f850', //the UTXO refers to previous tx's hash
prevIndex: 0 //the index of UTXO refers to previous tx's output
}
]
bitcoin.transaction(privateKey, payment) //privateKey: private key in WIFRun npm test