Class: Headers

primitives.Headers(options)

Headers Represents block headers obtained from the network via headers.

Constructor

new Headers(options)

Create headers.

Extends:
  • AbstractBlock
Parameters:
Name Type Description
options Object
Source:

Extends

  • AbstractBlock

Methods

(static) fromBlock(block) → {Headers}

Convert the block to a headers object.

Parameters:
Name Type Description
block Block | MerkleBlock
Source:
Returns:
Type
Headers

(static) fromEntry(entry) → {Headers}

Instantiate headers from a chain entry.

Parameters:
Name Type Description
entry ChainEntry
Source:
Returns:
Type
Headers

(static) fromHead(data) → {Headers}

Instantiate headers from serialized data.

Parameters:
Name Type Description
data Buffer
Source:
Returns:
Type
Headers

(static) isHeaders(obj) → {Boolean}

Test an object to see if it is a Headers object.

Parameters:
Name Type Description
obj Object
Source:
Returns:
Type
Boolean

format(view, height) → {Object}

Inspect the headers and return a more user-friendly representation of the data.

Parameters:
Name Type Description
view CoinView
height Number
Source:
Returns:
Type
Object

(private) fromJSON(json)

Inject properties from json object.

Parameters:
Name Type Description
json Object
Source:

getJSON(network, view, height) → {Object}

Convert the block to an object suitable for JSON serialization.

Parameters:
Name Type Description
network Network
view CoinView
height Number
Source:
Returns:
Type
Object

getSize() → {Number}

Get size of the headers.

Source:
Returns:
Type
Number

(private) read(data)

Inject properties from buffer reader.

Parameters:
Name Type Description
data Buffer
Source:

toHeaders() → {Headers}

Convert the block to a headers object.

Source:
Returns:
Type
Headers

verifyBody() → {Boolean}

Perform non-contextual verification on the headers.

Source:
Returns:
Type
Boolean

write(bw)

Serialize the headers to a buffer writer.

Parameters:
Name Type Description
bw BufferWriter
Source: