Constructor
new Miner(options)
Create a bitcoin miner.
Extends:
- EventEmitter
Parameters:
Name | Type | Description |
---|---|---|
options |
Object |
- Source:
Extends
- EventEmitter
Methods
(async, private) _createBlock(tipnullable, addressnullable) → {Promise}
Create a block template (without a lock).
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
tip |
ChainEntry |
<nullable> |
|
address |
Address |
<nullable> |
- Source:
Returns:
- Returns BlockTemplate.
- Type
- Promise
addAddress(address)
Add an address to the address list.
Parameters:
Name | Type | Description |
---|---|---|
address |
Address |
- Source:
assemble(attempt) → {Array.<MempoolEntry>}
Get mempool entries, sort by dependency order. Prioritize by priority and fee rates.
Parameters:
Name | Type | Description |
---|---|---|
attempt |
BlockTemplate |
- Source:
Returns:
- Type
- Array.<MempoolEntry>
(async) close() → {Promise}
Close the miner.
- Source:
Returns:
- Type
- Promise
(async) createBlock(tipnullable, addressnullable) → {Promise}
Create a block template.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
tip |
ChainEntry |
<nullable> |
|
address |
Address |
<nullable> |
- Source:
Returns:
- Returns BlockTemplate.
- Type
- Promise
createJob(tipnullable, addressnullable) → {Promise}
Create a cpu miner job.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
tip |
ChainEntry |
<nullable> |
|
address |
Address |
<nullable> |
- Source:
Returns:
Returns CPUJob.
- Type
- Promise
getAddress() → {Address}
Get a random address from the address list.
- Source:
Returns:
- Type
- Address
init()
Initialize the miner.
- Source:
mineBlock(tipnullable, addressnullable) → {Promise}
Mine a single block.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
tip |
ChainEntry |
<nullable> |
|
address |
Address |
<nullable> |
- Source:
Returns:
Returns Block.
- Type
- Promise
(async) open() → {Promise}
Open the miner, wait for the chain and mempool to load.
- Source:
Returns:
- Type
- Promise
updateTime(attempt)
Update block timestamp.
Parameters:
Name | Type | Description |
---|---|---|
attempt |
BlockTemplate |
- Source: