Module: lib/blockchains/bitcoin

Module to use Bitcoin as underlying blockchain for Whiteflag

Source:
Tutorials:
To Do:
  • The Bitcoin module has not been maintained and needs evaluation

Methods

(inner) createAccount(wifopt, callback)

Creates a new Bitcoin blockchain account

Parameters:
Name Type Attributes Description
wif string <optional>

the private key in Wallet Input Format

callback bcAccountCb

function called on completion

Source:

(inner) deleteAccount(btcAddress, callback)

Deletes Bitcoin blockchain account

Parameters:
Name Type Description
btcAddress string

the address of the account to be deleted

callback bcAccountCb

function called on completion

Source:

(inner) getBinaryAddress(btcAddress, callback)

Returns a Bitcoin address in binary encoded form

Parameters:
Name Type Description
btcAddress string

the Bitcoin blockchain address

callback bcBinaryAddressCb

function called on completion

Source:

(inner) getMessage(wfQuery, callback)

Performs a simple query to find a message on Bitcoin by transaction hash

Parameters:
Name Type Description
wfQuery Object

the property of the transaction to look up

callback bcGetMessageCb

function called after Whiteflag message lookup

Source:

(inner) initBitcoin(btcConfig, callback)

Initialises the Bitcoin blockchain

Parameters:
Name Type Description
btcConfig Object

the Bitcoin blockchain configuration

callback bcInitCb

function called after intitialising Bitcoin

Source:

(inner) requestSignature(wfSignPayload, callback)

Requests a Whiteflag signature for the specified Bitcoin address

Parameters:
Name Type Description
wfSignPayload wfSignPayload

the JWS payload for the Whiteflag signature

callback authRequestSignatureCb

function called on completion

Source:
To Do:
  • Refactor to use with new JWS functions and native blockchain signature

(inner) scanBlocks(firstBlock, lastBlock, callback)

Scans a number of blocks for Whiteflag messages

Parameters:
Name Type Description
firstBlock number

the starting block

lastBlock number

the ending block

callback bcScanBlocksCb

function called on completion

Source:

(inner) sendMessage(wfMessage, callback)

Sends an encoded message on the Bitcoin blockchain

Parameters:
Name Type Description
wfMessage wfMessage

the Whiteflag message to be sent on Bitcoin

callback bcSendTransactionCb

function called after sending Whiteflag message

Source:

(inner) transferFunds(transfer, callback)

Transfers bitcoin from one Bitcoin address to an other address

Parameters:
Name Type Description
transfer wfTransfer

the transaction details for the funds transfer

callback bcSendTransactionCb

function called on completion

Source:

(inner) updateAccount(account, callback)

Updates Bitcoin blockchain account attributes

Parameters:
Name Type Description
account wfAccount

the account information including address to be updated

callback bcAccountCb

function called on completion

Source:

(inner) verifySignature(wfSignature, btcAddress, btcPublicKey, callback)

Verifies a Whiteflag signature for the specified Bitcoin public key

Parameters:
Name Type Description
wfSignature wfSignature

the Whiteflag authentication signature

btcAddress string

the address of the Whiteflag signature

btcPublicKey string

the Bitcoin public key to verify against

callback authVerifySignatureCb

function called on completion

Source:
To Do:
  • Refactor to use with new JWS functions and native blockchain signature