Module: lib/blockchains

Module with the blockchain abstraction layer to connect with multiple blockchains

Source:
Tutorials:

Methods

(inner) createAccount(blockchain, secret, callback)

Creates blockchain account

Parameters:
Name Type Description
blockchain string

the blockchain for which account needs to be created

secret string

hexadecimal encoded blockchain dependent secret (e.g. private key, wif or seed)

callback bcAccountCb

function called on completion

Source:

(inner) deleteAccount(address, blockchain, callback)

Deletes blockchain account

Parameters:
Name Type Description
address string

the blockchain account address

blockchain string

the blockchain for which the account needs to be deleted

callback bcAccountCb

function called on completion

Source:

(inner) getBinaryAddress(address, blockchain, callback)

Requests a blockchain address in binary encoded form

Parameters:
Name Type Description
address string

the blockchain address

blockchain string

the blockchain for which the binary encoded address is requested

callback bcSendTransactionCb

function called on completion

Source:

(inner) getMessage(wfQuery, callback)

Performs a simple query to find a message by transaction hash

Parameters:
Name Type Description
wfQuery Object

the property of the transaction to look up

callback bcGetMessageCb

function called on completion

Source:

(inner) initBlockchains(callback)

Initialises configured blockchains

Parameters:
Name Type Description
callback blockhainsInitCb

function called on completion

Source:

(inner) reportNoBlockchain(callback)

Calls callback with no blockchains configured error

Parameters:
Name Type Description
callback func

callback function to be called

Source:

(inner) reportNotActive(bcName, callback)

Calls callback with generic blockchain not active error message

Parameters:
Name Type Description
bcName string

the name of the inactive blockchain

callback func

callback function to be called

Source:

(inner) reportUnsupported(bcName, callback)

Calls callback with generic blockchain not active error message

Parameters:
Name Type Description
bcName string

the name of the inactive blockchain

callback func

callback function to be called

Source:

(inner) requestSignature(signPayload, blockchain, callback)

Requests a Whiteflag signature for a specific blockchain address

Parameters:
Name Type Description
signPayload Object

the JWS payload for the Whiteflag signature

blockchain string

the blockchain for which the signature is requested

callback authRequestSignatureCb

function called on completion

Source:

(inner) scanBlocks(firstBlock, lastBlock, blockchain, callback)

Scans a number of blocks for Whiteflag messages

Parameters:
Name Type Description
firstBlock number

the starting block

lastBlock number

the ending block

blockchain string

the blockchain to scan

callback bcScanBlocksCb

function called on completion

Source:

(inner) sendMessage(wfMessage, callback)

Sends an encoded message to the blockchain defined in the metaheader

Parameters:
Name Type Description
wfMessage wfMessage

the Whiteflag message to be sent on the blockchain

callback bcSendTransactionCb

function called on completion

Source:

(inner) transferFunds(transfer, address, blockchain, callback)

Transfers value from one blockchain address to an other address

Parameters:
Name Type Description
transfer wfTransfer

the object with the transaction details to transfer value

address string

the address of the account from which to make the transfer from

blockchain string

the blockchain on which the value must be transdered

callback bcSendTransactionCb

function called on completion

Source:

(inner) updateAccount(account, address, blockchain, callback)

Updates blockchain account

Parameters:
Name Type Description
account wfAccount

the blockchain account to be updated

address string

the address of the account to be updated

blockchain string

the blockchain for which the account needs to be updated

callback bcAccountCb

function called on completion

Source:

(inner) verifySignature(wfSignature, signAddress, orgPubkey, blockchain, callback)

Requests a Whiteflag signature for a specific blockchain address

Parameters:
Name Type Description
wfSignature Object

the Whiteflag authentication signature

signAddress string

the blockchain address in the signature

orgPubkey string

the public key to verify the signature against

blockchain string

the blockchain for which the signature is verified

callback authVerifySignatureCb

function called on completion

Source:

Type Definitions

bcAccountCb(err, result)

Callback for blockchain account functions

Parameters:
Name Type Description
err Error

any error

result wfAccount

the result of the account action

Source:

bcBinaryAddressCb(err, address)

Parameters:
Name Type Description
err Error

any error

address Buffer

the binary blockchain address

Source:

bcInitCb(err, blockchain)

Parameters:
Name Type Description
err Error

any error

blockchain string

the nemae of the blockchain

Source:

bcScanBlocksCb(err, wfMessages)

Parameters:
Name Type Description
err Error

any error

wfMessages Array.<WfMessage>

an array of found Whiteflag messages

Source:

bcSendTransactionCb(err, transactionHash, blockNumber)

Parameters:
Name Type Description
err Error

any error

transactionHash string

the transaction hash of the transaction

blockNumber number

the block number of the transaction

Source:

getBlockHeightCb(err, highestBlock)

Parameters:
Name Type Description
err Error

any error

highestBlock number

the current heighest block

Source:

wfAccount

A Whiteflag account object

Type:
  • Object
Properties:
Name Type Description
address string

the address as encoded for that specific blokchain

publicKey string

the hexedecimal encoded public key

privateKey string

the hexedecimal encoded private key

transactionCount number

the number of transaction sent by the account

balance number

the current balance of the account

Source:

wfTransfer

A blockchain value transfer

Type:
  • Object
Properties:
Name Type Description
fromAddress string

the address of the account to send tokens from

toAddress string

the address to send tokens to

value number

tha value or number of tokens to be sent

Source: