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.

resolve(binaryBlob: Uint8Array, path: string): Object
Parameters
binaryBlob (Uint8Array) Binary representation of a Bitcoin block
path (string = '/') Path that should be resolved
Returns
Object: result - Result of the path it it was resolved successfully
Returns
any: result.value - Value the path resolves to
Returns
string: result.remainderPath - If the path resolves half-way to a link, then the remainderPath is the part after the link that can be used for further resolving

Return all available paths of a block.

tree(binaryBlob: Uint8Array)
Parameters
binaryBlob (Uint8Array) Binary representation of a Bitcoin block

serialize

src/util.js

Serialize internal representation into a binary Bitcoin block.

serialize
Parameters
dagNode (BitcoinBlock) Internal representation of a Bitcoin block
Returns
Uint8Array:

deserialize

src/util.js

Deserialize Bitcoin block into the internal representation.

deserialize
Parameters
binaryBlob (Uint8Array) Binary representation of a Bitcoin block
Returns
BitcoinBlock:

Calculate the CID of the binary blob.

cid
Parameters
binaryBlob (Object) Encoded IPLD Node
userOptions (Object?) Options to create the CID
Name Description
userOptions.cidVersion number (default 1) CID version number
Returns
Promise<CID>: