https://github.com/bitcoinjs/utxo
https://github.com/bitcoinjs/utxo
bitcoin
Last synced: 12 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/bitcoinjs/utxo
- Owner: bitcoinjs
- License: mit
- Created: 2015-11-08T02:14:10.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2018-09-11T05:29:43.000Z (almost 8 years ago)
- Last Synced: 2025-06-23T17:10:30.130Z (about 1 year ago)
- Topics: bitcoin
- Language: JavaScript
- Size: 10.7 KB
- Stars: 2
- Watchers: 10
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# utxo
[](http://travis-ci.org/dcousens/utxo)
[](https://www.npmjs.org/package/utxo)
[](https://github.com/feross/standard)
## Example
``` javascript
let utxo = require('utxo')
let transactions = {
"2c20ca6ca3a2af32d3ca0c6c1a60f6d3c00101342620a21f3622fc6faf2ddcda": {
"inputs": [
{
"txId": "xxx ...",
"vout": 0
},
{
"txId": "xxx ...",
"vout": 1
}
],
"outputs": [
{ "script": "..." }
]
},
"bdcdd2fafa1c6c0ac3d23fa2a3ac66cf2263f12a03444310100c3d6c06ac02c3": {
"inputs": [
{
"txId": "2c20ca6ca3a2af32d3ca0c6c1a60f6d3c00101342620a21f3622fc6faf2ddcda"
"vout": 0
},
...
],
// etc
}
}
let unspents = utxo(transactions)
// => [{
// "txId": "2c20ca6ca3a2af32d3ca0c6c1a60f6d3c00101342620a21f3622fc6faf2ddcda",
// "vout": 0,
// "script": "..."
// }, ...]
```
**NOTE**: Any 'double spends' are ignored, with priority given to first-seen.
If `.outputs` is undefined, an unspent is only `{ txId, vout }`.
## LICENSE [MIT](LICENSE)