Class: SPVNode

node~SPVNode(optionsnullable)

SPV Node Create an spv node which only maintains a chain, a pool, and an http server.

Constructor

new SPVNode(optionsnullable)

Create SPV node.

Extends:
  • Node
Parameters:
Name Type Attributes Description
options Object <nullable>
Properties
Name Type Attributes Description
sslKey Buffer <nullable>
sslCert Buffer <nullable>
httpPort Number <nullable>
httpHost String <nullable>
Source:

Extends

  • Node

Methods

(async) broadcast(item) → {Promise}

Broadcast a transaction.

Parameters:
Name Type Description
item TX | Block
Source:
Returns:
Type
Promise

(async) close() → {Promise}

Close the node, wait for the database to close.

Source:
Returns:
Type
Promise

connect() → {Promise}

Connect to the network.

Source:
Returns:
Type
Promise

disconnect() → {Promise}

Disconnect from the network.

Source:
Returns:
Type
Promise

(async) getNameStatus(nameHash) → {NameState}

Get current name state.

Parameters:
Name Type Description
nameHash Buffer
Source:
Returns:
Type
NameState

(private) init()

Initialize the node.

Source:

(async) open() → {Promise}

Open the node and all its child objects, wait for the database to load.

Source:
Returns:
Type
Promise

relay(tx) → {Promise}

Broadcast a transaction. Silence errors.

Parameters:
Name Type Description
tx TX
Source:
Returns:
Type
Promise

relayAirdrop(proof) → {Promise}

Broadcast an airdrop proof. Silence errors.

Parameters:
Name Type Description
proof AirdropProof
Source:
Returns:
Type
Promise

relayClaim(claim) → {Promise}

Broadcast a claim. Silence errors.

Parameters:
Name Type Description
claim Claim
Source:
Returns:
Type
Promise

(async) scan(start, filter, iter) → {Promise}

Scan for any missed transactions. Note that this will replay the blockchain sync.

Parameters:
Name Type Description
start Number | Hash

Start block.

filter Bloom
iter function

Iterator.

Source:
Returns:
Type
Promise

sendAirdrop(proof) → {Promise}

Broadcast an airdrop proof.

Parameters:
Name Type Description
proof AirdropProof
Source:
Returns:
Type
Promise

sendClaim(claim) → {Promise}

Broadcast a claim.

Parameters:
Name Type Description
claim Claim
Source:
Returns:
Type
Promise

sendTX(tx) → {Promise}

Broadcast a transaction.

Parameters:
Name Type Description
tx TX
Source:
Returns:
Type
Promise

startSync()

Start the blockchain sync.

Source:

stopSync()

Stop syncing the blockchain.

Source:

(async) watchBlock(entry, block) → {Promise}

Handled watched block.

Parameters:
Name Type Description
entry ChainEntry
block MerkleBlock
Source:
Returns:
Type
Promise

watchUntil(height, iter) → {Promise}

Watch the blockchain until a certain height.

Parameters:
Name Type Description
height Number
iter function
Source:
Returns:
Type
Promise