new MinerBlock(options)
MinerBlock
Parameters:
Name | Type | Description | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
Properties:
Name | Type | Description |
---|---|---|
block |
Block | |
coinbase |
TX | |
hashes |
BN | Number of hashes attempted. |
rate |
Number | Hash rate. |
- Source:
Fires:
- MinerBlock#event:status
Methods
addTX(tx) → {Boolean}
Add a transaction to the block. Rebuilds the merkle tree, updates coinbase and commitment.
Parameters:
Name | Type | Description |
---|---|---|
tx |
TX |
- Source:
Returns:
Whether the transaction was successfully added.
- Type
- Boolean
destroy()
Destroy the minerblock. Stop mining. Clear timeout.
- Source:
findNonce() → {Boolean}
Hash until the nonce overflows, increment extraNonce, rebuild merkletree.
- Source:
Returns:
Whether the nonce was found.
- Type
- Boolean
mine(callback)
Mine until the block is found. Will take a breather for 100ms every time the nonce overflows.
Parameters:
Name | Type | Description |
---|---|---|
callback |
function | Returns [Error, Block]. |
- Source:
mineAsync(callback)
Attempt to mine the block on the worker pool.
Parameters:
Name | Type | Description |
---|---|---|
callback |
function | Returns [Error, Block]. |
- Source:
mineSync() → {Block}
Mine synchronously until the block is found.
- Source:
Returns:
- Type
- Block
sendStatus()
Send a progress report (emits status
).
- Source:
updateCoinbase()
Update the extranonce and coinbase reward.
- Source:
updateCommitment()
Update the commitment output for segwit.
- Source:
updateMerkle()
Rebuild the merkle tree and update merkle root as well as the timestamp (also calls MinerBlock#updateCommitment if segwit is enabled).
- Source: