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:
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
(private) fromHead(data)
Inject properties from serialized data.
Parameters:
Name | Type | Description |
---|---|---|
data |
Buffer |
- Source:
fromMiner(data)
Decode from miner serialization.
Parameters:
Name | Type | Description |
---|---|---|
data |
Buffer |
- Source:
hash() → {Hash}
Hash the block header.
- Source:
Returns:
hash
- 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
(private) parseJSON(json)
Inject properties from json object.
Parameters:
Name | Type | Description |
---|---|---|
json |
Object |
- Source:
(private) 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 |
BufferReader |
- Source:
refresh()
Clear any cached values.
- Source:
shareHash() → {Buffer}
Calculate share hash.
- Source:
Returns:
- Type
- Buffer
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)
Serialize the block headers.
Parameters:
Name | Type | Description |
---|---|---|
bw |
BufferWriter |
- Source: