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
_refresh()
Clear any cached values (abstract).
- Source:
(private) fromHead(data)
Inject properties from serialized data.
Parameters:
Name | Type | Description |
---|---|---|
data |
Buffer |
- Source:
hash(encnullable) → {Hash|Buffer}
Hash the block headers.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
enc |
String |
<nullable> |
Can be |
- Source:
Returns:
hash
- Type
- Hash | Buffer
isMemory() → {Boolean}
Test whether the block is a memblock.
- Source:
Returns:
- Type
- Boolean
(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:
readHead(br)
Parse the block headers.
Parameters:
Name | Type | Description |
---|---|---|
br |
BufferReader |
- Source:
refresh()
Clear any cached values.
- Source:
rhash() → {Hash}
Get little-endian block hash.
- Source:
Returns:
- Type
- Hash
toHead() → {Buffer}
Serialize the block headers.
- Source:
Returns:
- Type
- Buffer
toInv() → {InvItem}
Convert the block to an inv item.
- Source:
Returns:
- Type
- InvItem
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: