Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bitcoinjs/bip69
Lexicographical Indexing of Transaction Inputs and Outputs
https://github.com/bitcoinjs/bip69
bip69 bitcoin
Last synced: 25 days ago
JSON representation
Lexicographical Indexing of Transaction Inputs and Outputs
- Host: GitHub
- URL: https://github.com/bitcoinjs/bip69
- Owner: bitcoinjs
- License: mit
- Created: 2015-08-07T02:55:40.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-11-04T03:57:16.000Z (about 7 years ago)
- Last Synced: 2024-08-08T15:21:05.375Z (4 months ago)
- Topics: bip69, bitcoin
- Language: JavaScript
- Size: 25.4 KB
- Stars: 4
- Watchers: 6
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-cryptocoinjs - bitcoin
README
# bip69
[![NPM Package](https://img.shields.io/npm/v/bip69.svg?style=flat-square)](https://www.npmjs.org/package/bip69)
[![Build Status](https://img.shields.io/travis/bitcoinjs/bip69.svg?branch=master&style=flat-square)](https://travis-ci.org/bitcoinjs/bip69)[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
Lexicographical Indexing of Transaction Inputs and Outputs.
See [BIP69](https://github.com/bitcoin/bips/blob/master/bip-0069.mediawiki).
\* *Works only with node.js 0.11 or greater (because require Buffer.compare)*
## Example
``` javascript
var bitcoinjs = require('bitcoinjs-lib')
var bip69 = require('bip69')var inputs = [{
"txId": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"vout": 0
}, ...]
var outputs = [{
"script": new Buffer("76a9145be32612930b8323add2212a4ec03c1562084f8488ac", "hex"),
"value": 40000000000
}, ...]// ...
var sortedInputs = bip69.sortInputs(inputs)
var sortedOutputs = bip69.sortOutputs(outputs)var txb = new bitcoinjs.TransactionBuilder()
sortedInputs.forEach(function (input) {
txb.addInput(input.txId, input.vout)
})sortedOutputs.forEach(function (output) {
txb.addOutput(bitcoinjs.Script.fromBuffer(output.script), output.value)
})// ... and so on
```## LICENSE [MIT](LICENSE)