new Fullnode(optionsnullable)
Create a fullnode complete with a chain, mempool, miner, wallet, etc.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<nullable> |
Properties
|
Properties:
Name | Type | Description |
---|---|---|
loaded |
Boolean | |
chain |
Chain | |
mempool |
Mempool | |
pool |
Pool | |
miner |
Miner | |
walletdb |
WalletDB | |
http |
HTTPServer |
- Source:
Fires:
- Fullnode#event:block
- Fullnode#event:tx
- Fullnode#event:error
Extends
Methods
broadcast(item, callback)
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 | MTX | Block | |
callback |
function |
- Source:
close(callback)
Close the node, wait for the database to close.
Parameters:
Name | Type | Description |
---|---|---|
callback |
function |
- Source:
connect()
Connect to the network.
- Source:
createWallet(options, callback)
Create a Wallet in the wallet database.
Parameters:
Name | Type | Description |
---|---|---|
options |
Object | See Wallet. |
callback |
function | Returns [Error, Wallet]. |
- Source:
fillCoins(tx, callback)
Fill a transaction with coins from the mempool and chain database (unspent only).
Parameters:
Name | Type | Description |
---|---|---|
tx |
TX | |
callback |
function | Returns [Error, TX]. |
- Source:
fillHistory(tx, callback)
Fill a transaction with all historical coins from the mempool and chain database.
Parameters:
Name | Type | Description |
---|---|---|
tx |
TX | |
callback |
function | Returns [Error, TX]. |
- Source:
getBlock(hash, callback)
Retrieve a block from the chain database.
Parameters:
Name | Type | Description |
---|---|---|
hash |
Hash | |
callback |
function | Returns [Error, Block]. |
- Source:
getCoin(hash, index, callback)
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 | |
callback |
function | Returns [Error, Coin]. |
- Source:
getCoinsByAddress(addresses, callback)
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 |
---|---|---|
addresses |
Base58Address | Array.<Base58Address> | |
callback |
function | Returns [Error, Coin[]]. |
- Source:
getConfidence(tx, callback)
Return bitcoinj-style confidence for a transaction.
Parameters:
Name | Type | Description |
---|---|---|
tx |
Hash | TX | |
callback |
function | Returns [Error, Confidence]. |
- Source:
getFullBlock(hash, callback)
Retrieve a block from the chain database, filled with coins.
Parameters:
Name | Type | Description |
---|---|---|
hash |
Hash | |
callback |
function | Returns [Error, Block]. |
- Source:
getTX(hash, callback)
Retrieve a transaction from the mempool or chain database.
Parameters:
Name | Type | Description |
---|---|---|
hash |
Hash | |
callback |
function | Returns [Error, TX]. |
- Source:
getTXByAddress(addresses, callback)
Retrieve transactions pertaining to an address from the mempool or chain database.
Parameters:
Name | Type | Description |
---|---|---|
addresses |
Base58Address | Array.<Base58Address> | |
callback |
function | Returns [Error, TX[]]. |
- Source:
getWallet(id, passphrasenullable, callback)
Retrieve a wallet from the wallet database.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
id |
String | Wallet ID. |
|
passphrase |
String |
<nullable> |
Wallet key passphrase. |
callback |
function | Returns [Error, Wallet]. |
- Source:
hasTX(hash, callback)
Test whether the mempool or chain contains a transaction.
Parameters:
Name | Type | Description |
---|---|---|
hash |
Hash | |
callback |
function | Returns [Error, Boolean]. |
- Source:
isSpent(hash, index, callback)
Check whether a coin has been spent.
Parameters:
Name | Type | Description |
---|---|---|
hash |
Hash | |
index |
Number | |
callback |
function | Returns [Error, Boolean]. |
- Source:
open(callback)
Open the node and all its child objects, wait for the database to load.
Parameters:
Name | Type | Description |
---|---|---|
callback |
function |
- Source:
scanWallet(wallet, callback)
Scan an HD wallet and allocate addresses according to history.
Parameters:
Name | Type | Description |
---|---|---|
wallet |
Wallet | |
callback |
function |
- Source:
sendBlock(item, callback)
Broadcast a block.
Parameters:
Name | Type | Description |
---|---|---|
item |
Block | |
callback |
function |
- Source:
sendTX(item, waitnullable, callback)
Verify a transaction, add it to the mempool, and broadcast. Safer than Fullnode#broadcast.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
item |
TX | MTX | ||
wait |
Boolean |
<nullable> |
Wait to execute callback until a node requests our TX, rejects it, or the broadcast itself times out. |
callback |
function | Returns [VerifyError|Error]. |
- Source:
Example
node.sendTX(tx, callback);
node.sendTX(tx, true, callback);
startSync()
Start the blockchain sync.
- Source:
stopSync()
Stop syncing the blockchain.
- Source: