new MinerBlock(options)
MinerBlock (block attempt)
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
Members
(static, constant) INTERVAL :Number
Nonce range interval.
Type:
- Number
- Source:
Methods
(private) _init()
Initialize the block.
- Source:
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
commit() → {Block}
Commit and finalize mined block.
- Source:
Returns:
- Type
- Block
destroy()
Destroy the minerblock. Stop mining.
- Source:
extraNonce() → {Buffer}
Render extraNonce.
- Source:
Returns:
- Type
- Buffer
findNonce() → {Boolean}
Hash until the nonce overflows.
- Source:
Returns:
Whether the nonce was found.
- Type
- Boolean
findNonceAsync() → {Promise}
Hash until the nonce overflows.
- Source:
Returns:
- Returns Boolean.
- Type
- Promise
getHashes() → {Number}
Calculate number of hashes.
- Source:
Returns:
- Type
- Number
getRate() → {Number}
Calculate hashrate.
- Source:
Returns:
- Type
- Number
iterate()
Increment extraNonce, rebuild merkletree.
- Source:
mine() → {Block}
Mine synchronously until the block is found.
- Source:
Returns:
- Type
- Block
mineAsync() → {Promise}
Mine asynchronously until the block is found.
- Source:
Returns:
- Returns Block.
- Type
- Promise
refresh()
Update coinbase, witness commitment, and merkle root.
- Source:
sendStatus()
Send a progress report (emits status
).
- Source:
updateCoinbase()
Update the extra nonce and coinbase reward.
- Source:
updateCommitment()
Update the commitment output for segwit.
- Source:
updateMerkle()
Rebuild the merkle tree and update merkle root.
- Source:
updateNonce()
Increment the extraNonce.
- Source: