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.
Parameters:
Name | Type | Description |
---|---|---|
item |
TX | Block | Claim | AirdropProof |
- 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) 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) getCoinsByAddress(addrs) → {Promise}
Get coins that pertain to an address from the mempool or chain database. Takes into account spent coins in the mempool.
Parameters:
Name | Type | Description |
---|---|---|
addrs |
Address |
- 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(addrs) → {Promise}
Retrieve transactions pertaining to an address from the mempool or chain database.
Parameters:
Name | Type | Description |
---|---|---|
addrs |
Address |
- 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) getNameStatus(nameHash) → {NameState}
Get current name state.
Parameters:
Name | Type | Description |
---|---|---|
nameHash |
Buffer |
- Source:
Returns:
- Type
- NameState
(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(addrs) → {Promise}
Retrieve transactions pertaining to an address from the mempool or chain database.
Parameters:
Name | Type | Description |
---|---|---|
addrs |
Address |
- 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
(async) relayAirdrop(proof) → {Promise}
Add airdrop proof to mempool, broadcast. Silence errors.
Parameters:
Name | Type | Description |
---|---|---|
proof |
AirdropProof |
- Source:
Returns:
- Type
- Promise
(async) relayClaim(claim) → {Promise}
Add claim to mempool, broadcast. Silence errors.
Parameters:
Name | Type | Description |
---|---|---|
claim |
Claim |
- Source:
Returns:
- Type
- Promise
scan(start, filter, iter) → {Promise}
Rescan for any missed transactions.
Parameters:
Name | Type | Description |
---|---|---|
start |
Number | Hash | Start block. |
filter |
BloomFilter | |
iter |
function | Iterator. |
- Source:
Returns:
- Type
- Promise
scanInteractive(start, filter, iter, fullLockopt) → {Promise}
Interactive rescan for any missed transactions.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
start |
Number | Hash | Start block. |
||
filter |
BloomFilter | |||
iter |
function | Iterator. |
||
fullLock |
Boolean |
<optional> |
false | lock the whole chain instead of per scan. |
- Source:
Returns:
- Type
- Promise
(async) sendAirdrop(proof)
Add airdrop proof to mempool, broadcast.
Parameters:
Name | Type | Description |
---|---|---|
proof |
AirdropProof |
- Source:
(async) sendClaim(claim)
Add claim to mempool, broadcast.
Parameters:
Name | Type | Description |
---|---|---|
claim |
Claim |
- Source:
(async) sendTX(tx)
Add transaction to mempool, broadcast.
Parameters:
Name | Type | Description |
---|---|---|
tx |
TX |
- Source:
startSync()
Start the blockchain sync.
- Source:
stopSync()
Stop syncing the blockchain.
- Source: