Name: bip69
Owner: BitcoinJS
Description: Lexicographical Indexing of Transaction Inputs and Outputs
Created: 2015-08-07 02:55:40.0
Updated: 2018-01-17 04:35:45.0
Pushed: 2017-11-04 03:57:16.0
Homepage: null
Size: 26
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Lexicographical Indexing of Transaction Inputs and Outputs.
See BIP69.
* Works only with node.js 0.11 or greater (because require Buffer.compare)
bitcoinjs = require('bitcoinjs-lib')
bip69 = require('bip69')
inputs = [{
"txId": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"vout": 0
..]
outputs = [{
"script": new Buffer("76a9145be32612930b8323add2212a4ec03c1562084f8488ac", "hex"),
"value": 40000000000
..]
..
sortedInputs = bip69.sortInputs(inputs)
sortedOutputs = bip69.sortOutputs(outputs)
txb = new bitcoinjs.TransactionBuilder()
edInputs.forEach(function (input) {
txb.addInput(input.txId, input.vout)
edOutputs.forEach(function (output) {
txb.addOutput(bitcoinjs.Script.fromBuffer(output.script), output.value)
.. and so on