Intro
Installable via npm install --save ipld-bitcoin
, it can also be used directly in the browser.
Download
The source is available for download from GitHub. Alternatively, you can install using npm:
$ npm install --save ipld-bitcoin
You can then require()
ipld-bitcoin as normal:
const ipldBitcoin = require('ipld-bitcoin')
In the Browser
Ipld-bitcoin should work in any ES2015 environment out of the box.
Usage:
<script type="text/javascript" src="index.js"></script>
The portable versions of ipld-bitcoin, including index.js
and index.min.js
, are included in the /dist
folder. Ipld-bitcoin can also be found on unpkg.com under
resolve
Resolves a path within a Bitcoin block.
Returns the value or a link and the partial mising path. This way the IPLD Resolver can fetch the link and continue to resolve.
Parameters
tree
Return all available paths of a block.
Parameters
binaryBlob: Buffer
:Binary representation of a Bitcoin block
serialize
Serialize internal representation into a binary Bitcoin block.
Parameters
dagNode: BitcoinBlock
:Internal representation of a Bitcoin block
Returns
deserialize
Deserialize Bitcoin block into the internal representation.
Parameters
binaryBlob: Buffer
:Binary representation of a Bitcoin block
Returns
BitcoinBlock