Module: lib/blockchains/bitcoin/accounts

Module for managing Bitcoin accounts for Whiteflag

Source:

Methods

(inner) checkAccount(address) → {Promise}

Verifies if an account exists and is not syncing

Parameters:
Name Type Description
address string

the Bitcoin account address

Source:
Returns:

the account data

Type
Promise

(inner) createAccount(wif) → {Promise}

Creates a new Bitcoin account from an existing or a new key pair

Parameters:
Name Type Description
wif string

Wallet Import Format

Source:
Returns:

resolves to the account data

Type
Promise

(inner) deleteAccount(address, callback)

Deletes a Bitcoin blockchain account

Parameters:
Name Type Description
address string

the address of the account information object with updated informationto be deleted

callback blockchainDeleteAccountCb

function to be called upon completion

Source:

(inner) getAccount(address) → {Promise}

Gets account data of a Bitcoin blockchain account by address

Parameters:
Name Type Description
address string

the Bitcoin account address

Source:
Returns:

the account data

Type
Promise

(inner) initAccounts(bcConfig, bcState)

Initialises Bitcoin accounts management

Parameters:
Name Type Description
bcConfig Object

the Bitcoin blockchain configuration

bcState Object

the Bitcoin blockchain state

Source:

(inner) processBlockUtxos(blockNumber, block)

Processes block to check for incoming UTXOs for each account

Parameters:
Name Type Description
blockNumber number

the blocknumer

block Object

the full block including transactions

Source:

(inner) updateAccount(account) → {Promise}

Updates a Bitcoin blockchain account attributes

Parameters:
Name Type Description
account string

the account information object with updated information

Source:
Returns:

resolves to the account data

Type
Promise

(inner) updateAccountBalance(account)

Updates the account balance based on unspent UTXOs

Parameters:
Name Type Description
account Object

the account to be updated

Source:

(inner) updateAccountUtxos(account, spentUtxos) → {Object}

Updates the status of the UTXOs for an account

Parameters:
Name Type Description
account Object

the Bitcoin account

spentUtxos Array

the UTXOs spent by a transaction

Source:
Returns:

the updated account

Type
Object