Module: lib/blockchains/ethereum

Module to use Ethereum as underlying blockchain for Whiteflag

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

Methods

(inner) createAccount(ethPrivateKeyopt, callback)

Creates a new Ethereum blockchain account

Parameters:
Name Type Attributes Description
ethPrivateKey string <optional>

hexadecimal string with private key (without 0x prefix)

callback bcAccountCb

function called on completion

Source:

(inner) deleteAccount(ethAddress, callback)

Deletes Ethereum blockchain account

Parameters:
Name Type Description
ethAddress string

the address of the account to be deleted

callback bcAccountCb

function called on completion

Source:

(inner) getBinaryAddress(ethAddress, callback)

Returns an Ethereum address in binary encoded form

Parameters:
Name Type Description
ethAddress string

the blockchain address

callback bcBinaryAddressCb

function called on completion

Source:

(inner) getMessage(wfQuery, callback)

Performs a simple query to find a message on Ethereum 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) initEthereum(ethConfig, callback)

Initialises the Ethereum blockchain

Parameters:
Name Type Description
ethConfig Object

the blockchain configuration

callback bcInitCb

function called after intitialising Ethereum

Source:

(inner) requestSignature(wfSignPayload, callback)

Requests a Whiteflag signature for the specified Ethereum 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 Ethereum blockchain

Parameters:
Name Type Description
wfMessage wfMessage

the Whiteflag message to be sent on Ethereum

callback bcSendTransactionCb

function called after sending Whiteflag message

Source:

(inner) transferFunds(transfer, callback)

Transfers ether from one Ethereum address to an other address

Parameters:
Name Type Description
transfer wfTransfer

the object with the transaction details to transfer funds

callback bcSendTransactionCb

function called on completion

Source:

(inner) updateAccount(account, callback)

Updates Ethereum 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, ethAddress, ethPublicKey, callback)

Verifies a Whiteflag signature for the specified Ethereum public key

Parameters:
Name Type Description
wfSignature wfSignature

the Whiteflag authentication signature

ethAddress string

the address of the Whiteflag signature

ethPublicKey string

the Ethereum 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