Constructor
new FullNode(optionsnullable)
Create a full node.
Extends:
- Node
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
Object |
<nullable> |
- Source:
Extends
- Node
Methods
(async) broadcast(item) → {Promise}
Broadcast a transaction (note that this will not be verified by the mempool - use with care, lest you get banned from bitcoind nodes).
Parameters:
Name | Type | Description |
---|---|---|
item |
TX | Block |
- Source:
Returns:
- Type
- Promise
connect() → {Promise}
Connect to the network.
- Source:
Returns:
- Type
- Promise
disconnect() → {Promise}
Disconnect from the network.
- Source:
Returns:
- Type
- Promise
getBlock(hash) → {Promise}
Retrieve a block from the chain database.
Parameters:
Name | Type | Description |
---|---|---|
hash |
Hash |
- Source:
Returns:
- Returns Block.
- Type
- Promise
(async) getBlockFilter(hash) → {Promise}
Retrieve compact filter by hash.
Parameters:
Name | Type | Description |
---|---|---|
hash |
Hash | Number |
- Source:
Returns:
- Returns Buffer.
- Type
- Promise
(async) getCoin(hash, index) → {Promise}
Retrieve a coin from the mempool or chain database. Takes into account spent coins in the mempool.
Parameters:
Name | Type | Description |
---|---|---|
hash |
Hash | |
index |
Number |
- Source:
Returns:
- Returns Coin.
- Type
- Promise
(async) getMeta(hash) → {Promise}
Retrieve a transaction from the mempool or chain database.
Parameters:
Name | Type | Description |
---|---|---|
hash |
Hash |
- Source:
Returns:
- Returns TXMeta.
- Type
- Promise
(async) getMetaByAddress(addr, options) → {Promise}
Retrieve transactions pertaining to an address from the mempool or chain database.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
addr |
Address | |||||||||||||
options |
Object |
Properties
|
- Source:
Returns:
- Returns TXMeta[].
- Type
- Promise
(async) getMetaView(meta) → {Promise}
Retrieve a spent coin viewpoint from mempool or chain database.
Parameters:
Name | Type | Description |
---|---|---|
meta |
TXMeta |
- Source:
Returns:
- Returns CoinView.
- Type
- Promise
(async) getTX(hash) → {Promise}
Retrieve a transaction from the mempool or chain database.
Parameters:
Name | Type | Description |
---|---|---|
hash |
Hash |
- Source:
Returns:
- Returns TX.
- Type
- Promise
(async) getTXByAddress(addr, options) → {Promise}
Retrieve transactions pertaining to an address from the mempool or chain database.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
addr |
Address | |||||||||||||
options |
Object |
Properties
|
- Source:
Returns:
- Returns TX[].
- Type
- Promise
(async) hasTX(hash) → {Promise}
Test whether the mempool or chain contains a transaction.
Parameters:
Name | Type | Description |
---|---|---|
hash |
Hash |
- Source:
Returns:
- Returns Boolean.
- Type
- Promise
(private) init()
Initialize the node.
- Source:
(async) relay(tx) → {Promise}
Add transaction to mempool, broadcast. Silence errors.
Parameters:
Name | Type | Description |
---|---|---|
tx |
TX |
- Source:
Returns:
- Type
- Promise
scan(start, filter, iter) → {Promise}
Rescan for any missed transactions.
Parameters:
Name | Type | Description |
---|---|---|
start |
Number | Hash | Start block. |
filter |
Bloom | |
iter |
function | Iterator. |
- Source:
Returns:
- Type
- Promise
(async) sendTX(tx) → {Promise}
Add transaction to mempool, broadcast.
Parameters:
Name | Type | Description |
---|---|---|
tx |
TX |
- Source:
Returns:
- Type
- Promise
startSync()
Start the blockchain sync.
- Source:
stopSync()
Stop syncing the blockchain.
- Source: