Class: AbstractBlock

(abstract) primitives.AbstractBlock()

Abstract Block The class which all block-like objects inherit from.

Constructor

(abstract) new AbstractBlock()

Create an abstract block.

Properties:
Name Type Description
version Number
prevBlock Hash
merkleRoot Hash
time Number
bits Number
nonce Number
Source:

Members

(nullable) _hash :Buffer

Type:
  • Buffer
Source:

(nullable) _maskHash :Buffer

Type:
  • Buffer
Source:

Methods

(static) fromMiner(data)

Decode from miner serialization.

Parameters:
Name Type Description
data Buffer
Source:

_refresh()

Clear any cached values (abstract).

Source:

commitHash() → {Buffer}

Compute commitment hash.

Source:
Returns:
Type
Buffer

fromHead(data) → {this}

Inject properties from serialized data.

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

fromMiner(data)

Decode from miner serialization.

Parameters:
Name Type Description
data Buffer
Source:

hash() → {Hash}

Hash the block header.

Source:
Returns:
Type
Hash

hashHex() → {String}

Hash the block header.

Source:
Returns:
Type
String

isMemory() → {Boolean}

Test whether the block is a memblock.

Source:
Returns:
Type
Boolean

maskHash() → {Buffer}

Compute xor bytes hash.

Source:
Returns:
Type
Buffer

padding(size) → {Buffer}

Retrieve deterministically random padding.

Parameters:
Name Type Description
size Number
Source:
Returns:
Type
Buffer

parseJSON(json)

Inject properties from json object.

Parameters:
Name Type Description
json Object
Source:

parseOptions(options)

Inject properties from options object.

Parameters:
Name Type Description
options Object
Source:

powHash() → {Buffer}

Calculate PoW hash.

Source:
Returns:
Type
Buffer

readHead(br)

Parse the block headers.

Parameters:
Name Type Description
br bio.BufferReader
Source:

refresh()

Clear any cached values.

Source:

shareHash() → {Hash}

Calculate share hash.

Source:
Returns:
Type
Hash

sizeHead() → {Number}

Get header size.

Source:
Returns:
Type
Number

subHash() → {Buffer}

Compute subheader hash.

Source:
Returns:
Type
Buffer

toHead() → {Buffer}

Serialize the block headers.

Source:
Returns:
Type
Buffer

toInv() → {InvItem}

Convert the block to an inv item.

Source:
Returns:
Type
InvItem

toMiner() → {Buffer}

Encode to miner serialization.

Source:
Returns:
Type
Buffer

toPrehead() → {Buffer}

Serialize preheader.

Source:
Returns:
Type
Buffer

toSubhead() → {Buffer}

Serialize subheader for proof.

Source:
Returns:
Type
Buffer

verify() → {Boolean}

Verify the block.

Source:
Returns:
Type
Boolean

verifyBody() → {Boolean}

Verify the block.

Source:
Returns:
Type
Boolean

verifyPOW() → {Boolean}

Verify proof-of-work.

Source:
Returns:
Type
Boolean

writeHead(bw) → {BufioWriter}

Serialize the block headers.

Parameters:
Name Type Description
bw BufioWriter
Source:
Returns:
Type
BufioWriter