new BlockHeader() → {BlockHeader}
Instantiate a BlockHeader from a Buffer, JSON object, or Object with the properties of the BlockHeader
Parameters:
| Type | Description |
|---|---|
| * | A Buffer, JSON string, or Object |
- Source:
Returns:
- An instance of block header
- Type
- BlockHeader
Methods
-
<private, static> _from(arg) → {Object}
-
Parameters:
Name Type Description arg* A Buffer, JSON string or Object
- Source:
Throws:
-
- If the argument was not recognized
- Type
- TypeError
Returns:
- An object representing block header data
- Type
- Object
-
<private, static> _fromBufferReader(br) → {Object}
-
Parameters:
Name Type Description brBufferReader A BufferReader of the block header
- Source:
Returns:
- An object representing block header data
- Type
- Object
-
<private, static> _fromJSON(data) → {Object}
-
Parameters:
Name Type Description dataString | Object A JSON string or object
- Source:
Returns:
- An object representing block header data
- Type
- Object
-
<static> fromBuffer(buf) → {BlockHeader}
-
Parameters:
Name Type Description bufBuffer A buffer of the block header
- Source:
Returns:
- An instance of block header
- Type
- BlockHeader
-
<static> fromBufferReader(br) → {BlockHeader}
-
Parameters:
Name Type Description brBufferReader A BufferReader of the block header
- Source:
Returns:
- An instance of block header
- Type
- BlockHeader
-
<static> fromJSON(json) → {BlockHeader}
-
Parameters:
Name Type Description jsonString | Object A JSON string or object
- Source:
Returns:
- An instance of block header
- Type
- BlockHeader
-
<static> fromRawBlock(data) → {BlockHeader}
-
Parameters:
Name Type Description dataBinary Raw block binary data or buffer
- Source:
Returns:
- An instance of block header
- Type
- BlockHeader
-
<static> fromString(str) → {BlockHeader}
-
Parameters:
Name Type Description strString A hex encoded buffer of the block header
- Source:
Returns:
- An instance of block header
- Type
- BlockHeader
-
_getHash() → {Buffer}
-
- Source:
Returns:
- The little endian hash buffer of the header
- Type
- Buffer
-
getTargetDifficulty() → {BN}
-
- Source:
Returns:
- An instance of BN with the decoded difficulty bits
- Type
- BN
-
inspect() → {String}
-
- Source:
Returns:
- A string formated for the console
- Type
- String
-
toBuffer() → {Buffer}
-
- Source:
Returns:
- A Buffer of the BlockHeader
- Type
- Buffer
-
toBufferWriter(bw) → {BufferWriter}
-
Parameters:
Name Type Description bwBufferWriter An existing instance BufferWriter
- Source:
Returns:
- An instance of BufferWriter representation of the BlockHeader
- Type
- BufferWriter
-
toJSON() → {String}
-
- Source:
Returns:
- A JSON string
- Type
- String
-
toObject() → {Object}
-
- Source:
Returns:
- A plain object of the BlockHeader
- Type
- Object
-
toString() → {String}
-
- Source:
Returns:
- A hex encoded string of the BlockHeader
- Type
- String
-
validProofOfWork() → {Boolean}
-
- Source:
Returns:
- If the proof-of-work hash satisfies the target difficulty
- Type
- Boolean
-
validTimestamp() → {Boolean}
-
- Source:
Returns:
- If timestamp is not too far in the future
- Type
- Boolean