exports

exports

The LedgerNodeBlocks class exposes the block management API.

Constructor

new exports()

Source:

Methods

add()

Source:

Adds an event to associate with a ledger given an event and a set of options.

event - the event to associate with a ledger. meta - the metadata that is associated with the event. eventHash - the hash of the event data. callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the operation. event - the event that was committed to storage. meta - the metadata that was committed to storage.

add(block, emit, meta, callback(err))

Source:

Adds a block in the ledger given a block, metadata associated with the block.

Parameters:
Name Type Description
block

the block to create in the ledger. blockHeight - the height of the block. event - an array of events associated with the block.

emit

when true (default), a bedrock event is emitted to inform listeners that a block has been added.

meta

the metadata associated with the block. blockHash - the hash value of the block.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the operation. block - the block that was committed to storage. meta - the metadata that was committed to storage.

add()

Source:

Adds an operation to mutate the state of a ledger.

operation - the operation to perform. options - a set of options used when adding the operation. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

change()

Source:

Submits a new ledgerConfiguration for the ledger. The change will not occur until the current consensus mechanism accepts the ledgerConfiguration and the state machine processes it.

ledgerConfiguration - the new ledgerConfiguration for the ledger. [genesis] - boolean - is this genesis config [genesisBlock] - a genesis block for a ledger callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

difference(eventHash, callback(err,)

Source:

Identify events that are not in storage.

Parameters:
Name Type Description
eventHash

the hash or array of hashes to check.

callback(err,

result) called onced the operation completes.

exists(eventHash, operationHash, callback(err,)

Source:

Determine if operations exist.

Parameters:
Name Type Description
eventHash

the hash of the event associated with the operation

operationHash

the hash or array of hashes of the operation(s).

callback(err,

result) called once the operation completes.

exists(eventHash, callback(err,)

Source:

Determine if an event with a given hash exists.

Parameters:
Name Type Description
eventHash

the hash or array of hashes of the event(s).

callback(err,

result) called once the operation completes.

get()

Source:

Gets the current ledgerConfiguration for the ledger.

callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise. ledgerConfiguration - the latest ledgerConfiguration or null if none.

get(blockId, consensusopt, callback(err,)

Source:

Gets the block that has consensus given a blockId.

Parameters:
Name Type Attributes Description
blockId

the identifier of the block that has consensus.

consensus <optional>

false to retrieve a non-consensus block instead.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block with the given ID that has consensus.

get()

Source:

Gets a record from the ledger given a recordID and a set of options.

[maxBlockHeight] - limit the record history to the specified block height. recordId - the URI of the object to fetch. callback(err, {meta, record}) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

get()

Source:

Gets an event in the ledger given a query and a set of options.

eventHash - the hash of the event to fetch from storage. callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the retrieval event - the event. meta - metadata about the event.

get()

Source:

Gets metadata associated with the ledger, such as most recent configuration block and latest consensus block, given a set of options.

actor - the actor performing the action. options - a set of options used when retrieving the ledger metadata. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise. ledgerMeta - metadata about the ledger.

get()

Source:

Gets an event associated with the ledger given an eventID and a set of options.

eventId - the event to fetch from the ledger. options - a set of options used when retrieving the event. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise. event - the event that was retrieved from the database.

get(blockId, consensusopt, callback(err))

Source:

Gets a block from the ledger given a blockID and a set of options.

Parameters:
Name Type Attributes Description
blockId

the URI of the block to fetch.

consensus <optional>

false to retrieve a non-consensus block.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

getActiveConfig()

Source:

Gets the active configuration based on blockHeight. A ledger configuration is active for blocks that are subsequent to the block that includes the ledger configuration event itself.

blockHeight - the blockHeight used to locate the ledger configuration. callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the retrieval. event - the event. meta - metadata about the event.

getAll(blockId, callback(err,)

Source:

Gets all blocks matching a given blockId even if they have not achieved consensus.

Parameters:
Name Type Description
blockId

the identifier of the block(s) to fetch from the ledger.

callback(err,

iterator) - the callback to call when finished. err - An Error if an error occurred, null otherwise. iterator - an iterator for all of the returned blocks.

getByHeight(blockHeight, callback(err,)

Source:

Gets a block that has consensus given a blockHeight.

Parameters:
Name Type Description
blockHeight

the height of the block that has consensus.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block with the given block height that has consensus.

getCount(consensus, type, callback(err,)

Source:

Gets a count of events.

Parameters:
Name Type Description
consensus

filter events based on consensus status.

type

filter events based on event type.

callback(err,

count) - the callback to call when finished.

getGenesis(callback(err,)

Source:

Retrieves the genesis block from the ledger.

Parameters:
Name Type Description
callback(err,

result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result with the genesis block. genesisBlock - the genesis block and its meta.

getGenesis()

Source:

Gets the genesis block from the ledger.

callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

getLatest(callback(err))

Source:

Gets the latest blocks from the ledger.

Parameters:
Name Type Description
callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

getLatest(callback(err,)

Source:

Retrieves the latest block from the ledger.

Parameters:
Name Type Description
callback(err,

result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the block. eventBlock - the latest events block and meta.

getLatestConfig()

Source:

Gets the latest configuration event that has consensus.

callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the retrieval. event - the event. meta - metadata about the event.

getLatestSummary(callback(err,)

Source:

Retrieves a summary of the latest block from the ledger.

Parameters:
Name Type Description
callback(err,

result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the block. eventBlock - the latest events block summary.

getSummary(blockId, consensusopt, eventHashopt, callback(err,)

Source:

Gets the block summary for consensus block given a blockId.

Parameters:
Name Type Attributes Description
blockId

the identifier of the block that has consensus.

consensus <optional>

false to retrieve a summary for a non-consensus block instead.

eventHash <optional>

true to get all event hashes from event.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block summary for the given ID that has consensus.

getSummaryByHeight(blockHeight, consensusopt, eventHashopt, callback(err,)

Source:

Gets the block summary for consensus block given a blockHeight.

Parameters:
Name Type Attributes Description
blockHeight

the height of the block that has consensus.

consensus <optional>

false to retrieve a summary for a non-consensus

eventHash <optional>

true to get all event hashes from event.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block summary for the given ID that has consensus.

remove()

Source:

Delete an event associated with the ledger given an event hash and a set of options.

eventHash - the hash of the event to delete. options - a set of options used when deleting the event. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

remove(blockHash, callback(err))

Source:

Delete a block in the ledger given a block hash and a set of options.

Parameters:
Name Type Description
blockHash

the hash of the block to delete.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

update()

Source:

Update an existing event associated with the ledger given an eventId, an array of patch instructions, and a set of options.

eventHash - the ID of the event to update patch - a list of patch commands for the event callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the value of the updated event.

update(blockHash, patch, callback(err))

Source:

Update an existing block in the ledger given a block hash, an array of patch instructions, and a set of options.

Parameters:
Name Type Description
blockHash

the hash of the block to update.

patch

the patch instructions to execute on the block.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

validate()

Source:

Validates an operation against the current configuration.

operation - the operation to validate. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

validate()

Source:

Validates a ledgerConfiguration.

ledgerConfiguration - the ledgerConfiguration to validate. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

exports

The blocks API is used to perform operations on blocks associated with a particular ledger.

Methods

add()

Source:

Adds an event to associate with a ledger given an event and a set of options.

event - the event to associate with a ledger. meta - the metadata that is associated with the event. eventHash - the hash of the event data. callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the operation. event - the event that was committed to storage. meta - the metadata that was committed to storage.

add(block, emit, meta, callback(err))

Source:

Adds a block in the ledger given a block, metadata associated with the block.

Parameters:
Name Type Description
block

the block to create in the ledger. blockHeight - the height of the block. event - an array of events associated with the block.

emit

when true (default), a bedrock event is emitted to inform listeners that a block has been added.

meta

the metadata associated with the block. blockHash - the hash value of the block.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the operation. block - the block that was committed to storage. meta - the metadata that was committed to storage.

add()

Source:

Adds an operation to mutate the state of a ledger.

operation - the operation to perform. options - a set of options used when adding the operation. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

change()

Source:

Submits a new ledgerConfiguration for the ledger. The change will not occur until the current consensus mechanism accepts the ledgerConfiguration and the state machine processes it.

ledgerConfiguration - the new ledgerConfiguration for the ledger. [genesis] - boolean - is this genesis config [genesisBlock] - a genesis block for a ledger callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

difference(eventHash, callback(err,)

Source:

Identify events that are not in storage.

Parameters:
Name Type Description
eventHash

the hash or array of hashes to check.

callback(err,

result) called onced the operation completes.

exists(eventHash, operationHash, callback(err,)

Source:

Determine if operations exist.

Parameters:
Name Type Description
eventHash

the hash of the event associated with the operation

operationHash

the hash or array of hashes of the operation(s).

callback(err,

result) called once the operation completes.

exists(eventHash, callback(err,)

Source:

Determine if an event with a given hash exists.

Parameters:
Name Type Description
eventHash

the hash or array of hashes of the event(s).

callback(err,

result) called once the operation completes.

get()

Source:

Gets the current ledgerConfiguration for the ledger.

callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise. ledgerConfiguration - the latest ledgerConfiguration or null if none.

get(blockId, consensusopt, callback(err,)

Source:

Gets the block that has consensus given a blockId.

Parameters:
Name Type Attributes Description
blockId

the identifier of the block that has consensus.

consensus <optional>

false to retrieve a non-consensus block instead.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block with the given ID that has consensus.

get()

Source:

Gets a record from the ledger given a recordID and a set of options.

[maxBlockHeight] - limit the record history to the specified block height. recordId - the URI of the object to fetch. callback(err, {meta, record}) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

get()

Source:

Gets an event in the ledger given a query and a set of options.

eventHash - the hash of the event to fetch from storage. callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the retrieval event - the event. meta - metadata about the event.

get()

Source:

Gets metadata associated with the ledger, such as most recent configuration block and latest consensus block, given a set of options.

actor - the actor performing the action. options - a set of options used when retrieving the ledger metadata. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise. ledgerMeta - metadata about the ledger.

get()

Source:

Gets an event associated with the ledger given an eventID and a set of options.

eventId - the event to fetch from the ledger. options - a set of options used when retrieving the event. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise. event - the event that was retrieved from the database.

get(blockId, consensusopt, callback(err))

Source:

Gets a block from the ledger given a blockID and a set of options.

Parameters:
Name Type Attributes Description
blockId

the URI of the block to fetch.

consensus <optional>

false to retrieve a non-consensus block.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

getActiveConfig()

Source:

Gets the active configuration based on blockHeight. A ledger configuration is active for blocks that are subsequent to the block that includes the ledger configuration event itself.

blockHeight - the blockHeight used to locate the ledger configuration. callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the retrieval. event - the event. meta - metadata about the event.

getAll(blockId, callback(err,)

Source:

Gets all blocks matching a given blockId even if they have not achieved consensus.

Parameters:
Name Type Description
blockId

the identifier of the block(s) to fetch from the ledger.

callback(err,

iterator) - the callback to call when finished. err - An Error if an error occurred, null otherwise. iterator - an iterator for all of the returned blocks.

getByHeight(blockHeight, callback(err,)

Source:

Gets a block that has consensus given a blockHeight.

Parameters:
Name Type Description
blockHeight

the height of the block that has consensus.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block with the given block height that has consensus.

getCount(consensus, type, callback(err,)

Source:

Gets a count of events.

Parameters:
Name Type Description
consensus

filter events based on consensus status.

type

filter events based on event type.

callback(err,

count) - the callback to call when finished.

getGenesis(callback(err,)

Source:

Retrieves the genesis block from the ledger.

Parameters:
Name Type Description
callback(err,

result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result with the genesis block. genesisBlock - the genesis block and its meta.

getGenesis()

Source:

Gets the genesis block from the ledger.

callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

getLatest(callback(err))

Source:

Gets the latest blocks from the ledger.

Parameters:
Name Type Description
callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

getLatest(callback(err,)

Source:

Retrieves the latest block from the ledger.

Parameters:
Name Type Description
callback(err,

result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the block. eventBlock - the latest events block and meta.

getLatestConfig()

Source:

Gets the latest configuration event that has consensus.

callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the retrieval. event - the event. meta - metadata about the event.

getLatestSummary(callback(err,)

Source:

Retrieves a summary of the latest block from the ledger.

Parameters:
Name Type Description
callback(err,

result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the block. eventBlock - the latest events block summary.

getSummary(blockId, consensusopt, eventHashopt, callback(err,)

Source:

Gets the block summary for consensus block given a blockId.

Parameters:
Name Type Attributes Description
blockId

the identifier of the block that has consensus.

consensus <optional>

false to retrieve a summary for a non-consensus block instead.

eventHash <optional>

true to get all event hashes from event.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block summary for the given ID that has consensus.

getSummaryByHeight(blockHeight, consensusopt, eventHashopt, callback(err,)

Source:

Gets the block summary for consensus block given a blockHeight.

Parameters:
Name Type Attributes Description
blockHeight

the height of the block that has consensus.

consensus <optional>

false to retrieve a summary for a non-consensus

eventHash <optional>

true to get all event hashes from event.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block summary for the given ID that has consensus.

remove()

Source:

Delete an event associated with the ledger given an event hash and a set of options.

eventHash - the hash of the event to delete. options - a set of options used when deleting the event. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

remove(blockHash, callback(err))

Source:

Delete a block in the ledger given a block hash and a set of options.

Parameters:
Name Type Description
blockHash

the hash of the block to delete.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

update()

Source:

Update an existing event associated with the ledger given an eventId, an array of patch instructions, and a set of options.

eventHash - the ID of the event to update patch - a list of patch commands for the event callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the value of the updated event.

update(blockHash, patch, callback(err))

Source:

Update an existing block in the ledger given a block hash, an array of patch instructions, and a set of options.

Parameters:
Name Type Description
blockHash

the hash of the block to update.

patch

the patch instructions to execute on the block.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

validate()

Source:

Validates an operation against the current configuration.

operation - the operation to validate. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

validate()

Source:

Validates a ledgerConfiguration.

ledgerConfiguration - the ledgerConfiguration to validate. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

exports

Ledger Node class that exposes the blocks, events, and meta APIs.

Constructor

new exports()

Source:

Methods

add()

Source:

Adds an event to associate with a ledger given an event and a set of options.

event - the event to associate with a ledger. meta - the metadata that is associated with the event. eventHash - the hash of the event data. callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the operation. event - the event that was committed to storage. meta - the metadata that was committed to storage.

add(block, emit, meta, callback(err))

Source:

Adds a block in the ledger given a block, metadata associated with the block.

Parameters:
Name Type Description
block

the block to create in the ledger. blockHeight - the height of the block. event - an array of events associated with the block.

emit

when true (default), a bedrock event is emitted to inform listeners that a block has been added.

meta

the metadata associated with the block. blockHash - the hash value of the block.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the operation. block - the block that was committed to storage. meta - the metadata that was committed to storage.

add()

Source:

Adds an operation to mutate the state of a ledger.

operation - the operation to perform. options - a set of options used when adding the operation. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

change()

Source:

Submits a new ledgerConfiguration for the ledger. The change will not occur until the current consensus mechanism accepts the ledgerConfiguration and the state machine processes it.

ledgerConfiguration - the new ledgerConfiguration for the ledger. [genesis] - boolean - is this genesis config [genesisBlock] - a genesis block for a ledger callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

difference(eventHash, callback(err,)

Source:

Identify events that are not in storage.

Parameters:
Name Type Description
eventHash

the hash or array of hashes to check.

callback(err,

result) called onced the operation completes.

exists(eventHash, operationHash, callback(err,)

Source:

Determine if operations exist.

Parameters:
Name Type Description
eventHash

the hash of the event associated with the operation

operationHash

the hash or array of hashes of the operation(s).

callback(err,

result) called once the operation completes.

exists(eventHash, callback(err,)

Source:

Determine if an event with a given hash exists.

Parameters:
Name Type Description
eventHash

the hash or array of hashes of the event(s).

callback(err,

result) called once the operation completes.

get()

Source:

Gets the current ledgerConfiguration for the ledger.

callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise. ledgerConfiguration - the latest ledgerConfiguration or null if none.

get(blockId, consensusopt, callback(err,)

Source:

Gets the block that has consensus given a blockId.

Parameters:
Name Type Attributes Description
blockId

the identifier of the block that has consensus.

consensus <optional>

false to retrieve a non-consensus block instead.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block with the given ID that has consensus.

get()

Source:

Gets a record from the ledger given a recordID and a set of options.

[maxBlockHeight] - limit the record history to the specified block height. recordId - the URI of the object to fetch. callback(err, {meta, record}) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

get()

Source:

Gets an event in the ledger given a query and a set of options.

eventHash - the hash of the event to fetch from storage. callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the retrieval event - the event. meta - metadata about the event.

get()

Source:

Gets metadata associated with the ledger, such as most recent configuration block and latest consensus block, given a set of options.

actor - the actor performing the action. options - a set of options used when retrieving the ledger metadata. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise. ledgerMeta - metadata about the ledger.

get()

Source:

Gets an event associated with the ledger given an eventID and a set of options.

eventId - the event to fetch from the ledger. options - a set of options used when retrieving the event. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise. event - the event that was retrieved from the database.

get(blockId, consensusopt, callback(err))

Source:

Gets a block from the ledger given a blockID and a set of options.

Parameters:
Name Type Attributes Description
blockId

the URI of the block to fetch.

consensus <optional>

false to retrieve a non-consensus block.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

getActiveConfig()

Source:

Gets the active configuration based on blockHeight. A ledger configuration is active for blocks that are subsequent to the block that includes the ledger configuration event itself.

blockHeight - the blockHeight used to locate the ledger configuration. callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the retrieval. event - the event. meta - metadata about the event.

getAll(blockId, callback(err,)

Source:

Gets all blocks matching a given blockId even if they have not achieved consensus.

Parameters:
Name Type Description
blockId

the identifier of the block(s) to fetch from the ledger.

callback(err,

iterator) - the callback to call when finished. err - An Error if an error occurred, null otherwise. iterator - an iterator for all of the returned blocks.

getByHeight(blockHeight, callback(err,)

Source:

Gets a block that has consensus given a blockHeight.

Parameters:
Name Type Description
blockHeight

the height of the block that has consensus.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block with the given block height that has consensus.

getCount(consensus, type, callback(err,)

Source:

Gets a count of events.

Parameters:
Name Type Description
consensus

filter events based on consensus status.

type

filter events based on event type.

callback(err,

count) - the callback to call when finished.

getGenesis(callback(err,)

Source:

Retrieves the genesis block from the ledger.

Parameters:
Name Type Description
callback(err,

result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result with the genesis block. genesisBlock - the genesis block and its meta.

getGenesis()

Source:

Gets the genesis block from the ledger.

callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

getLatest(callback(err))

Source:

Gets the latest blocks from the ledger.

Parameters:
Name Type Description
callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

getLatest(callback(err,)

Source:

Retrieves the latest block from the ledger.

Parameters:
Name Type Description
callback(err,

result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the block. eventBlock - the latest events block and meta.

getLatestConfig()

Source:

Gets the latest configuration event that has consensus.

callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the retrieval. event - the event. meta - metadata about the event.

getLatestSummary(callback(err,)

Source:

Retrieves a summary of the latest block from the ledger.

Parameters:
Name Type Description
callback(err,

result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the block. eventBlock - the latest events block summary.

getSummary(blockId, consensusopt, eventHashopt, callback(err,)

Source:

Gets the block summary for consensus block given a blockId.

Parameters:
Name Type Attributes Description
blockId

the identifier of the block that has consensus.

consensus <optional>

false to retrieve a summary for a non-consensus block instead.

eventHash <optional>

true to get all event hashes from event.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block summary for the given ID that has consensus.

getSummaryByHeight(blockHeight, consensusopt, eventHashopt, callback(err,)

Source:

Gets the block summary for consensus block given a blockHeight.

Parameters:
Name Type Attributes Description
blockHeight

the height of the block that has consensus.

consensus <optional>

false to retrieve a summary for a non-consensus

eventHash <optional>

true to get all event hashes from event.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block summary for the given ID that has consensus.

remove()

Source:

Delete an event associated with the ledger given an event hash and a set of options.

eventHash - the hash of the event to delete. options - a set of options used when deleting the event. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

remove(blockHash, callback(err))

Source:

Delete a block in the ledger given a block hash and a set of options.

Parameters:
Name Type Description
blockHash

the hash of the block to delete.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

update()

Source:

Update an existing event associated with the ledger given an eventId, an array of patch instructions, and a set of options.

eventHash - the ID of the event to update patch - a list of patch commands for the event callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the value of the updated event.

update(blockHash, patch, callback(err))

Source:

Update an existing block in the ledger given a block hash, an array of patch instructions, and a set of options.

Parameters:
Name Type Description
blockHash

the hash of the block to update.

patch

the patch instructions to execute on the block.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

validate()

Source:

Validates an operation against the current configuration.

operation - the operation to validate. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

validate()

Source:

Validates a ledgerConfiguration.

ledgerConfiguration - the ledgerConfiguration to validate. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

exports

The LedgerNodeRecords class exposes the records API.

Constructor

new exports()

Source:

Methods

add()

Source:

Adds an event to associate with a ledger given an event and a set of options.

event - the event to associate with a ledger. meta - the metadata that is associated with the event. eventHash - the hash of the event data. callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the operation. event - the event that was committed to storage. meta - the metadata that was committed to storage.

add(block, emit, meta, callback(err))

Source:

Adds a block in the ledger given a block, metadata associated with the block.

Parameters:
Name Type Description
block

the block to create in the ledger. blockHeight - the height of the block. event - an array of events associated with the block.

emit

when true (default), a bedrock event is emitted to inform listeners that a block has been added.

meta

the metadata associated with the block. blockHash - the hash value of the block.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the operation. block - the block that was committed to storage. meta - the metadata that was committed to storage.

add()

Source:

Adds an operation to mutate the state of a ledger.

operation - the operation to perform. options - a set of options used when adding the operation. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

change()

Source:

Submits a new ledgerConfiguration for the ledger. The change will not occur until the current consensus mechanism accepts the ledgerConfiguration and the state machine processes it.

ledgerConfiguration - the new ledgerConfiguration for the ledger. [genesis] - boolean - is this genesis config [genesisBlock] - a genesis block for a ledger callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

difference(eventHash, callback(err,)

Source:

Identify events that are not in storage.

Parameters:
Name Type Description
eventHash

the hash or array of hashes to check.

callback(err,

result) called onced the operation completes.

exists(eventHash, operationHash, callback(err,)

Source:

Determine if operations exist.

Parameters:
Name Type Description
eventHash

the hash of the event associated with the operation

operationHash

the hash or array of hashes of the operation(s).

callback(err,

result) called once the operation completes.

exists(eventHash, callback(err,)

Source:

Determine if an event with a given hash exists.

Parameters:
Name Type Description
eventHash

the hash or array of hashes of the event(s).

callback(err,

result) called once the operation completes.

get()

Source:

Gets the current ledgerConfiguration for the ledger.

callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise. ledgerConfiguration - the latest ledgerConfiguration or null if none.

get(blockId, consensusopt, callback(err,)

Source:

Gets the block that has consensus given a blockId.

Parameters:
Name Type Attributes Description
blockId

the identifier of the block that has consensus.

consensus <optional>

false to retrieve a non-consensus block instead.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block with the given ID that has consensus.

get()

Source:

Gets a record from the ledger given a recordID and a set of options.

[maxBlockHeight] - limit the record history to the specified block height. recordId - the URI of the object to fetch. callback(err, {meta, record}) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

get()

Source:

Gets an event in the ledger given a query and a set of options.

eventHash - the hash of the event to fetch from storage. callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the retrieval event - the event. meta - metadata about the event.

get()

Source:

Gets metadata associated with the ledger, such as most recent configuration block and latest consensus block, given a set of options.

actor - the actor performing the action. options - a set of options used when retrieving the ledger metadata. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise. ledgerMeta - metadata about the ledger.

get()

Source:

Gets an event associated with the ledger given an eventID and a set of options.

eventId - the event to fetch from the ledger. options - a set of options used when retrieving the event. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise. event - the event that was retrieved from the database.

get(blockId, consensusopt, callback(err))

Source:

Gets a block from the ledger given a blockID and a set of options.

Parameters:
Name Type Attributes Description
blockId

the URI of the block to fetch.

consensus <optional>

false to retrieve a non-consensus block.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

getActiveConfig()

Source:

Gets the active configuration based on blockHeight. A ledger configuration is active for blocks that are subsequent to the block that includes the ledger configuration event itself.

blockHeight - the blockHeight used to locate the ledger configuration. callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the retrieval. event - the event. meta - metadata about the event.

getAll(blockId, callback(err,)

Source:

Gets all blocks matching a given blockId even if they have not achieved consensus.

Parameters:
Name Type Description
blockId

the identifier of the block(s) to fetch from the ledger.

callback(err,

iterator) - the callback to call when finished. err - An Error if an error occurred, null otherwise. iterator - an iterator for all of the returned blocks.

getByHeight(blockHeight, callback(err,)

Source:

Gets a block that has consensus given a blockHeight.

Parameters:
Name Type Description
blockHeight

the height of the block that has consensus.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block with the given block height that has consensus.

getCount(consensus, type, callback(err,)

Source:

Gets a count of events.

Parameters:
Name Type Description
consensus

filter events based on consensus status.

type

filter events based on event type.

callback(err,

count) - the callback to call when finished.

getGenesis(callback(err,)

Source:

Retrieves the genesis block from the ledger.

Parameters:
Name Type Description
callback(err,

result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result with the genesis block. genesisBlock - the genesis block and its meta.

getGenesis()

Source:

Gets the genesis block from the ledger.

callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

getLatest(callback(err))

Source:

Gets the latest blocks from the ledger.

Parameters:
Name Type Description
callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

getLatest(callback(err,)

Source:

Retrieves the latest block from the ledger.

Parameters:
Name Type Description
callback(err,

result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the block. eventBlock - the latest events block and meta.

getLatestConfig()

Source:

Gets the latest configuration event that has consensus.

callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the retrieval. event - the event. meta - metadata about the event.

getLatestSummary(callback(err,)

Source:

Retrieves a summary of the latest block from the ledger.

Parameters:
Name Type Description
callback(err,

result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the block. eventBlock - the latest events block summary.

getSummary(blockId, consensusopt, eventHashopt, callback(err,)

Source:

Gets the block summary for consensus block given a blockId.

Parameters:
Name Type Attributes Description
blockId

the identifier of the block that has consensus.

consensus <optional>

false to retrieve a summary for a non-consensus block instead.

eventHash <optional>

true to get all event hashes from event.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block summary for the given ID that has consensus.

getSummaryByHeight(blockHeight, consensusopt, eventHashopt, callback(err,)

Source:

Gets the block summary for consensus block given a blockHeight.

Parameters:
Name Type Attributes Description
blockHeight

the height of the block that has consensus.

consensus <optional>

false to retrieve a summary for a non-consensus

eventHash <optional>

true to get all event hashes from event.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block summary for the given ID that has consensus.

remove()

Source:

Delete an event associated with the ledger given an event hash and a set of options.

eventHash - the hash of the event to delete. options - a set of options used when deleting the event. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

remove(blockHash, callback(err))

Source:

Delete a block in the ledger given a block hash and a set of options.

Parameters:
Name Type Description
blockHash

the hash of the block to delete.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

update()

Source:

Update an existing event associated with the ledger given an eventId, an array of patch instructions, and a set of options.

eventHash - the ID of the event to update patch - a list of patch commands for the event callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the value of the updated event.

update(blockHash, patch, callback(err))

Source:

Update an existing block in the ledger given a block hash, an array of patch instructions, and a set of options.

Parameters:
Name Type Description
blockHash

the hash of the block to update.

patch

the patch instructions to execute on the block.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

validate()

Source:

Validates an operation against the current configuration.

operation - the operation to validate. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

validate()

Source:

Validates a ledgerConfiguration.

ledgerConfiguration - the ledgerConfiguration to validate. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

exports

The events API is used to perform operations on events associated with a particular ledger.

Methods

add()

Source:

Adds an event to associate with a ledger given an event and a set of options.

event - the event to associate with a ledger. meta - the metadata that is associated with the event. eventHash - the hash of the event data. callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the operation. event - the event that was committed to storage. meta - the metadata that was committed to storage.

add(block, emit, meta, callback(err))

Source:

Adds a block in the ledger given a block, metadata associated with the block.

Parameters:
Name Type Description
block

the block to create in the ledger. blockHeight - the height of the block. event - an array of events associated with the block.

emit

when true (default), a bedrock event is emitted to inform listeners that a block has been added.

meta

the metadata associated with the block. blockHash - the hash value of the block.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the operation. block - the block that was committed to storage. meta - the metadata that was committed to storage.

add()

Source:

Adds an operation to mutate the state of a ledger.

operation - the operation to perform. options - a set of options used when adding the operation. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

change()

Source:

Submits a new ledgerConfiguration for the ledger. The change will not occur until the current consensus mechanism accepts the ledgerConfiguration and the state machine processes it.

ledgerConfiguration - the new ledgerConfiguration for the ledger. [genesis] - boolean - is this genesis config [genesisBlock] - a genesis block for a ledger callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

difference(eventHash, callback(err,)

Source:

Identify events that are not in storage.

Parameters:
Name Type Description
eventHash

the hash or array of hashes to check.

callback(err,

result) called onced the operation completes.

exists(eventHash, operationHash, callback(err,)

Source:

Determine if operations exist.

Parameters:
Name Type Description
eventHash

the hash of the event associated with the operation

operationHash

the hash or array of hashes of the operation(s).

callback(err,

result) called once the operation completes.

exists(eventHash, callback(err,)

Source:

Determine if an event with a given hash exists.

Parameters:
Name Type Description
eventHash

the hash or array of hashes of the event(s).

callback(err,

result) called once the operation completes.

get()

Source:

Gets the current ledgerConfiguration for the ledger.

callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise. ledgerConfiguration - the latest ledgerConfiguration or null if none.

get(blockId, consensusopt, callback(err,)

Source:

Gets the block that has consensus given a blockId.

Parameters:
Name Type Attributes Description
blockId

the identifier of the block that has consensus.

consensus <optional>

false to retrieve a non-consensus block instead.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block with the given ID that has consensus.

get()

Source:

Gets a record from the ledger given a recordID and a set of options.

[maxBlockHeight] - limit the record history to the specified block height. recordId - the URI of the object to fetch. callback(err, {meta, record}) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

get()

Source:

Gets an event in the ledger given a query and a set of options.

eventHash - the hash of the event to fetch from storage. callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the retrieval event - the event. meta - metadata about the event.

get()

Source:

Gets metadata associated with the ledger, such as most recent configuration block and latest consensus block, given a set of options.

actor - the actor performing the action. options - a set of options used when retrieving the ledger metadata. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise. ledgerMeta - metadata about the ledger.

get()

Source:

Gets an event associated with the ledger given an eventID and a set of options.

eventId - the event to fetch from the ledger. options - a set of options used when retrieving the event. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise. event - the event that was retrieved from the database.

get(blockId, consensusopt, callback(err))

Source:

Gets a block from the ledger given a blockID and a set of options.

Parameters:
Name Type Attributes Description
blockId

the URI of the block to fetch.

consensus <optional>

false to retrieve a non-consensus block.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

getActiveConfig()

Source:

Gets the active configuration based on blockHeight. A ledger configuration is active for blocks that are subsequent to the block that includes the ledger configuration event itself.

blockHeight - the blockHeight used to locate the ledger configuration. callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the retrieval. event - the event. meta - metadata about the event.

getAll(blockId, callback(err,)

Source:

Gets all blocks matching a given blockId even if they have not achieved consensus.

Parameters:
Name Type Description
blockId

the identifier of the block(s) to fetch from the ledger.

callback(err,

iterator) - the callback to call when finished. err - An Error if an error occurred, null otherwise. iterator - an iterator for all of the returned blocks.

getByHeight(blockHeight, callback(err,)

Source:

Gets a block that has consensus given a blockHeight.

Parameters:
Name Type Description
blockHeight

the height of the block that has consensus.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block with the given block height that has consensus.

getCount(consensus, type, callback(err,)

Source:

Gets a count of events.

Parameters:
Name Type Description
consensus

filter events based on consensus status.

type

filter events based on event type.

callback(err,

count) - the callback to call when finished.

getGenesis(callback(err,)

Source:

Retrieves the genesis block from the ledger.

Parameters:
Name Type Description
callback(err,

result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result with the genesis block. genesisBlock - the genesis block and its meta.

getGenesis()

Source:

Gets the genesis block from the ledger.

callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

getLatest(callback(err))

Source:

Gets the latest blocks from the ledger.

Parameters:
Name Type Description
callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

getLatest(callback(err,)

Source:

Retrieves the latest block from the ledger.

Parameters:
Name Type Description
callback(err,

result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the block. eventBlock - the latest events block and meta.

getLatestConfig()

Source:

Gets the latest configuration event that has consensus.

callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the retrieval. event - the event. meta - metadata about the event.

getLatestSummary(callback(err,)

Source:

Retrieves a summary of the latest block from the ledger.

Parameters:
Name Type Description
callback(err,

result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the block. eventBlock - the latest events block summary.

getSummary(blockId, consensusopt, eventHashopt, callback(err,)

Source:

Gets the block summary for consensus block given a blockId.

Parameters:
Name Type Attributes Description
blockId

the identifier of the block that has consensus.

consensus <optional>

false to retrieve a summary for a non-consensus block instead.

eventHash <optional>

true to get all event hashes from event.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block summary for the given ID that has consensus.

getSummaryByHeight(blockHeight, consensusopt, eventHashopt, callback(err,)

Source:

Gets the block summary for consensus block given a blockHeight.

Parameters:
Name Type Attributes Description
blockHeight

the height of the block that has consensus.

consensus <optional>

false to retrieve a summary for a non-consensus

eventHash <optional>

true to get all event hashes from event.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block summary for the given ID that has consensus.

remove()

Source:

Delete an event associated with the ledger given an event hash and a set of options.

eventHash - the hash of the event to delete. options - a set of options used when deleting the event. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

remove(blockHash, callback(err))

Source:

Delete a block in the ledger given a block hash and a set of options.

Parameters:
Name Type Description
blockHash

the hash of the block to delete.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

update()

Source:

Update an existing event associated with the ledger given an eventId, an array of patch instructions, and a set of options.

eventHash - the ID of the event to update patch - a list of patch commands for the event callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the value of the updated event.

update(blockHash, patch, callback(err))

Source:

Update an existing block in the ledger given a block hash, an array of patch instructions, and a set of options.

Parameters:
Name Type Description
blockHash

the hash of the block to update.

patch

the patch instructions to execute on the block.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

validate()

Source:

Validates an operation against the current configuration.

operation - the operation to validate. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

validate()

Source:

Validates a ledgerConfiguration.

ledgerConfiguration - the ledgerConfiguration to validate. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

exports

The operation API is used to perform operations on operations associated with a particular event.

Methods

add()

Source:

Adds an event to associate with a ledger given an event and a set of options.

event - the event to associate with a ledger. meta - the metadata that is associated with the event. eventHash - the hash of the event data. callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the operation. event - the event that was committed to storage. meta - the metadata that was committed to storage.

add(block, emit, meta, callback(err))

Source:

Adds a block in the ledger given a block, metadata associated with the block.

Parameters:
Name Type Description
block

the block to create in the ledger. blockHeight - the height of the block. event - an array of events associated with the block.

emit

when true (default), a bedrock event is emitted to inform listeners that a block has been added.

meta

the metadata associated with the block. blockHash - the hash value of the block.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the operation. block - the block that was committed to storage. meta - the metadata that was committed to storage.

add()

Source:

Adds an operation to mutate the state of a ledger.

operation - the operation to perform. options - a set of options used when adding the operation. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

change()

Source:

Submits a new ledgerConfiguration for the ledger. The change will not occur until the current consensus mechanism accepts the ledgerConfiguration and the state machine processes it.

ledgerConfiguration - the new ledgerConfiguration for the ledger. [genesis] - boolean - is this genesis config [genesisBlock] - a genesis block for a ledger callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

difference(eventHash, callback(err,)

Source:

Identify events that are not in storage.

Parameters:
Name Type Description
eventHash

the hash or array of hashes to check.

callback(err,

result) called onced the operation completes.

exists(eventHash, operationHash, callback(err,)

Source:

Determine if operations exist.

Parameters:
Name Type Description
eventHash

the hash of the event associated with the operation

operationHash

the hash or array of hashes of the operation(s).

callback(err,

result) called once the operation completes.

exists(eventHash, callback(err,)

Source:

Determine if an event with a given hash exists.

Parameters:
Name Type Description
eventHash

the hash or array of hashes of the event(s).

callback(err,

result) called once the operation completes.

get()

Source:

Gets the current ledgerConfiguration for the ledger.

callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise. ledgerConfiguration - the latest ledgerConfiguration or null if none.

get(blockId, consensusopt, callback(err,)

Source:

Gets the block that has consensus given a blockId.

Parameters:
Name Type Attributes Description
blockId

the identifier of the block that has consensus.

consensus <optional>

false to retrieve a non-consensus block instead.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block with the given ID that has consensus.

get()

Source:

Gets a record from the ledger given a recordID and a set of options.

[maxBlockHeight] - limit the record history to the specified block height. recordId - the URI of the object to fetch. callback(err, {meta, record}) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

get()

Source:

Gets an event in the ledger given a query and a set of options.

eventHash - the hash of the event to fetch from storage. callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the retrieval event - the event. meta - metadata about the event.

get()

Source:

Gets metadata associated with the ledger, such as most recent configuration block and latest consensus block, given a set of options.

actor - the actor performing the action. options - a set of options used when retrieving the ledger metadata. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise. ledgerMeta - metadata about the ledger.

get()

Source:

Gets an event associated with the ledger given an eventID and a set of options.

eventId - the event to fetch from the ledger. options - a set of options used when retrieving the event. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise. event - the event that was retrieved from the database.

get(blockId, consensusopt, callback(err))

Source:

Gets a block from the ledger given a blockID and a set of options.

Parameters:
Name Type Attributes Description
blockId

the URI of the block to fetch.

consensus <optional>

false to retrieve a non-consensus block.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

getActiveConfig()

Source:

Gets the active configuration based on blockHeight. A ledger configuration is active for blocks that are subsequent to the block that includes the ledger configuration event itself.

blockHeight - the blockHeight used to locate the ledger configuration. callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the retrieval. event - the event. meta - metadata about the event.

getAll(blockId, callback(err,)

Source:

Gets all blocks matching a given blockId even if they have not achieved consensus.

Parameters:
Name Type Description
blockId

the identifier of the block(s) to fetch from the ledger.

callback(err,

iterator) - the callback to call when finished. err - An Error if an error occurred, null otherwise. iterator - an iterator for all of the returned blocks.

getByHeight(blockHeight, callback(err,)

Source:

Gets a block that has consensus given a blockHeight.

Parameters:
Name Type Description
blockHeight

the height of the block that has consensus.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block with the given block height that has consensus.

getCount(consensus, type, callback(err,)

Source:

Gets a count of events.

Parameters:
Name Type Description
consensus

filter events based on consensus status.

type

filter events based on event type.

callback(err,

count) - the callback to call when finished.

getGenesis(callback(err,)

Source:

Retrieves the genesis block from the ledger.

Parameters:
Name Type Description
callback(err,

result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result with the genesis block. genesisBlock - the genesis block and its meta.

getGenesis()

Source:

Gets the genesis block from the ledger.

callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

getLatest(callback(err))

Source:

Gets the latest blocks from the ledger.

Parameters:
Name Type Description
callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

getLatest(callback(err,)

Source:

Retrieves the latest block from the ledger.

Parameters:
Name Type Description
callback(err,

result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the block. eventBlock - the latest events block and meta.

getLatestConfig()

Source:

Gets the latest configuration event that has consensus.

callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the retrieval. event - the event. meta - metadata about the event.

getLatestSummary(callback(err,)

Source:

Retrieves a summary of the latest block from the ledger.

Parameters:
Name Type Description
callback(err,

result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the block. eventBlock - the latest events block summary.

getSummary(blockId, consensusopt, eventHashopt, callback(err,)

Source:

Gets the block summary for consensus block given a blockId.

Parameters:
Name Type Attributes Description
blockId

the identifier of the block that has consensus.

consensus <optional>

false to retrieve a summary for a non-consensus block instead.

eventHash <optional>

true to get all event hashes from event.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block summary for the given ID that has consensus.

getSummaryByHeight(blockHeight, consensusopt, eventHashopt, callback(err,)

Source:

Gets the block summary for consensus block given a blockHeight.

Parameters:
Name Type Attributes Description
blockHeight

the height of the block that has consensus.

consensus <optional>

false to retrieve a summary for a non-consensus

eventHash <optional>

true to get all event hashes from event.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block summary for the given ID that has consensus.

remove()

Source:

Delete an event associated with the ledger given an event hash and a set of options.

eventHash - the hash of the event to delete. options - a set of options used when deleting the event. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

remove(blockHash, callback(err))

Source:

Delete a block in the ledger given a block hash and a set of options.

Parameters:
Name Type Description
blockHash

the hash of the block to delete.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

update()

Source:

Update an existing event associated with the ledger given an eventId, an array of patch instructions, and a set of options.

eventHash - the ID of the event to update patch - a list of patch commands for the event callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the value of the updated event.

update(blockHash, patch, callback(err))

Source:

Update an existing block in the ledger given a block hash, an array of patch instructions, and a set of options.

Parameters:
Name Type Description
blockHash

the hash of the block to update.

patch

the patch instructions to execute on the block.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

validate()

Source:

Validates an operation against the current configuration.

operation - the operation to validate. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

validate()

Source:

Validates a ledgerConfiguration.

ledgerConfiguration - the ledgerConfiguration to validate. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

exports

The LedgerNodeOperations class exposes the operation management API.

Constructor

new exports()

Source:

Methods

add()

Source:

Adds an event to associate with a ledger given an event and a set of options.

event - the event to associate with a ledger. meta - the metadata that is associated with the event. eventHash - the hash of the event data. callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the operation. event - the event that was committed to storage. meta - the metadata that was committed to storage.

add(block, emit, meta, callback(err))

Source:

Adds a block in the ledger given a block, metadata associated with the block.

Parameters:
Name Type Description
block

the block to create in the ledger. blockHeight - the height of the block. event - an array of events associated with the block.

emit

when true (default), a bedrock event is emitted to inform listeners that a block has been added.

meta

the metadata associated with the block. blockHash - the hash value of the block.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the operation. block - the block that was committed to storage. meta - the metadata that was committed to storage.

add()

Source:

Adds an operation to mutate the state of a ledger.

operation - the operation to perform. options - a set of options used when adding the operation. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

change()

Source:

Submits a new ledgerConfiguration for the ledger. The change will not occur until the current consensus mechanism accepts the ledgerConfiguration and the state machine processes it.

ledgerConfiguration - the new ledgerConfiguration for the ledger. [genesis] - boolean - is this genesis config [genesisBlock] - a genesis block for a ledger callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

difference(eventHash, callback(err,)

Source:

Identify events that are not in storage.

Parameters:
Name Type Description
eventHash

the hash or array of hashes to check.

callback(err,

result) called onced the operation completes.

exists(eventHash, operationHash, callback(err,)

Source:

Determine if operations exist.

Parameters:
Name Type Description
eventHash

the hash of the event associated with the operation

operationHash

the hash or array of hashes of the operation(s).

callback(err,

result) called once the operation completes.

exists(eventHash, callback(err,)

Source:

Determine if an event with a given hash exists.

Parameters:
Name Type Description
eventHash

the hash or array of hashes of the event(s).

callback(err,

result) called once the operation completes.

get()

Source:

Gets the current ledgerConfiguration for the ledger.

callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise. ledgerConfiguration - the latest ledgerConfiguration or null if none.

get(blockId, consensusopt, callback(err,)

Source:

Gets the block that has consensus given a blockId.

Parameters:
Name Type Attributes Description
blockId

the identifier of the block that has consensus.

consensus <optional>

false to retrieve a non-consensus block instead.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block with the given ID that has consensus.

get()

Source:

Gets a record from the ledger given a recordID and a set of options.

[maxBlockHeight] - limit the record history to the specified block height. recordId - the URI of the object to fetch. callback(err, {meta, record}) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

get()

Source:

Gets an event in the ledger given a query and a set of options.

eventHash - the hash of the event to fetch from storage. callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the retrieval event - the event. meta - metadata about the event.

get()

Source:

Gets metadata associated with the ledger, such as most recent configuration block and latest consensus block, given a set of options.

actor - the actor performing the action. options - a set of options used when retrieving the ledger metadata. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise. ledgerMeta - metadata about the ledger.

get()

Source:

Gets an event associated with the ledger given an eventID and a set of options.

eventId - the event to fetch from the ledger. options - a set of options used when retrieving the event. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise. event - the event that was retrieved from the database.

get(blockId, consensusopt, callback(err))

Source:

Gets a block from the ledger given a blockID and a set of options.

Parameters:
Name Type Attributes Description
blockId

the URI of the block to fetch.

consensus <optional>

false to retrieve a non-consensus block.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

getActiveConfig()

Source:

Gets the active configuration based on blockHeight. A ledger configuration is active for blocks that are subsequent to the block that includes the ledger configuration event itself.

blockHeight - the blockHeight used to locate the ledger configuration. callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the retrieval. event - the event. meta - metadata about the event.

getAll(blockId, callback(err,)

Source:

Gets all blocks matching a given blockId even if they have not achieved consensus.

Parameters:
Name Type Description
blockId

the identifier of the block(s) to fetch from the ledger.

callback(err,

iterator) - the callback to call when finished. err - An Error if an error occurred, null otherwise. iterator - an iterator for all of the returned blocks.

getByHeight(blockHeight, callback(err,)

Source:

Gets a block that has consensus given a blockHeight.

Parameters:
Name Type Description
blockHeight

the height of the block that has consensus.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block with the given block height that has consensus.

getCount(consensus, type, callback(err,)

Source:

Gets a count of events.

Parameters:
Name Type Description
consensus

filter events based on consensus status.

type

filter events based on event type.

callback(err,

count) - the callback to call when finished.

getGenesis(callback(err,)

Source:

Retrieves the genesis block from the ledger.

Parameters:
Name Type Description
callback(err,

result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result with the genesis block. genesisBlock - the genesis block and its meta.

getGenesis()

Source:

Gets the genesis block from the ledger.

callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

getLatest(callback(err))

Source:

Gets the latest blocks from the ledger.

Parameters:
Name Type Description
callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

getLatest(callback(err,)

Source:

Retrieves the latest block from the ledger.

Parameters:
Name Type Description
callback(err,

result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the block. eventBlock - the latest events block and meta.

getLatestConfig()

Source:

Gets the latest configuration event that has consensus.

callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the retrieval. event - the event. meta - metadata about the event.

getLatestSummary(callback(err,)

Source:

Retrieves a summary of the latest block from the ledger.

Parameters:
Name Type Description
callback(err,

result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the block. eventBlock - the latest events block summary.

getSummary(blockId, consensusopt, eventHashopt, callback(err,)

Source:

Gets the block summary for consensus block given a blockId.

Parameters:
Name Type Attributes Description
blockId

the identifier of the block that has consensus.

consensus <optional>

false to retrieve a summary for a non-consensus block instead.

eventHash <optional>

true to get all event hashes from event.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block summary for the given ID that has consensus.

getSummaryByHeight(blockHeight, consensusopt, eventHashopt, callback(err,)

Source:

Gets the block summary for consensus block given a blockHeight.

Parameters:
Name Type Attributes Description
blockHeight

the height of the block that has consensus.

consensus <optional>

false to retrieve a summary for a non-consensus

eventHash <optional>

true to get all event hashes from event.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block summary for the given ID that has consensus.

remove()

Source:

Delete an event associated with the ledger given an event hash and a set of options.

eventHash - the hash of the event to delete. options - a set of options used when deleting the event. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

remove(blockHash, callback(err))

Source:

Delete a block in the ledger given a block hash and a set of options.

Parameters:
Name Type Description
blockHash

the hash of the block to delete.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

update()

Source:

Update an existing event associated with the ledger given an eventId, an array of patch instructions, and a set of options.

eventHash - the ID of the event to update patch - a list of patch commands for the event callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the value of the updated event.

update(blockHash, patch, callback(err))

Source:

Update an existing block in the ledger given a block hash, an array of patch instructions, and a set of options.

Parameters:
Name Type Description
blockHash

the hash of the block to update.

patch

the patch instructions to execute on the block.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

validate()

Source:

Validates an operation against the current configuration.

operation - the operation to validate. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

validate()

Source:

Validates a ledgerConfiguration.

ledgerConfiguration - the ledgerConfiguration to validate. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

exports

LedgerNodeMeta exposes the ledger node metadata API.

Constructor

new exports()

Source:

Methods

add()

Source:

Adds an event to associate with a ledger given an event and a set of options.

event - the event to associate with a ledger. meta - the metadata that is associated with the event. eventHash - the hash of the event data. callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the operation. event - the event that was committed to storage. meta - the metadata that was committed to storage.

add(block, emit, meta, callback(err))

Source:

Adds a block in the ledger given a block, metadata associated with the block.

Parameters:
Name Type Description
block

the block to create in the ledger. blockHeight - the height of the block. event - an array of events associated with the block.

emit

when true (default), a bedrock event is emitted to inform listeners that a block has been added.

meta

the metadata associated with the block. blockHash - the hash value of the block.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the operation. block - the block that was committed to storage. meta - the metadata that was committed to storage.

add()

Source:

Adds an operation to mutate the state of a ledger.

operation - the operation to perform. options - a set of options used when adding the operation. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

change()

Source:

Submits a new ledgerConfiguration for the ledger. The change will not occur until the current consensus mechanism accepts the ledgerConfiguration and the state machine processes it.

ledgerConfiguration - the new ledgerConfiguration for the ledger. [genesis] - boolean - is this genesis config [genesisBlock] - a genesis block for a ledger callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

difference(eventHash, callback(err,)

Source:

Identify events that are not in storage.

Parameters:
Name Type Description
eventHash

the hash or array of hashes to check.

callback(err,

result) called onced the operation completes.

exists(eventHash, operationHash, callback(err,)

Source:

Determine if operations exist.

Parameters:
Name Type Description
eventHash

the hash of the event associated with the operation

operationHash

the hash or array of hashes of the operation(s).

callback(err,

result) called once the operation completes.

exists(eventHash, callback(err,)

Source:

Determine if an event with a given hash exists.

Parameters:
Name Type Description
eventHash

the hash or array of hashes of the event(s).

callback(err,

result) called once the operation completes.

get()

Source:

Gets the current ledgerConfiguration for the ledger.

callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise. ledgerConfiguration - the latest ledgerConfiguration or null if none.

get(blockId, consensusopt, callback(err,)

Source:

Gets the block that has consensus given a blockId.

Parameters:
Name Type Attributes Description
blockId

the identifier of the block that has consensus.

consensus <optional>

false to retrieve a non-consensus block instead.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block with the given ID that has consensus.

get()

Source:

Gets a record from the ledger given a recordID and a set of options.

[maxBlockHeight] - limit the record history to the specified block height. recordId - the URI of the object to fetch. callback(err, {meta, record}) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

get()

Source:

Gets an event in the ledger given a query and a set of options.

eventHash - the hash of the event to fetch from storage. callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the retrieval event - the event. meta - metadata about the event.

get()

Source:

Gets metadata associated with the ledger, such as most recent configuration block and latest consensus block, given a set of options.

actor - the actor performing the action. options - a set of options used when retrieving the ledger metadata. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise. ledgerMeta - metadata about the ledger.

get()

Source:

Gets an event associated with the ledger given an eventID and a set of options.

eventId - the event to fetch from the ledger. options - a set of options used when retrieving the event. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise. event - the event that was retrieved from the database.

get(blockId, consensusopt, callback(err))

Source:

Gets a block from the ledger given a blockID and a set of options.

Parameters:
Name Type Attributes Description
blockId

the URI of the block to fetch.

consensus <optional>

false to retrieve a non-consensus block.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

getActiveConfig()

Source:

Gets the active configuration based on blockHeight. A ledger configuration is active for blocks that are subsequent to the block that includes the ledger configuration event itself.

blockHeight - the blockHeight used to locate the ledger configuration. callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the retrieval. event - the event. meta - metadata about the event.

getAll(blockId, callback(err,)

Source:

Gets all blocks matching a given blockId even if they have not achieved consensus.

Parameters:
Name Type Description
blockId

the identifier of the block(s) to fetch from the ledger.

callback(err,

iterator) - the callback to call when finished. err - An Error if an error occurred, null otherwise. iterator - an iterator for all of the returned blocks.

getByHeight(blockHeight, callback(err,)

Source:

Gets a block that has consensus given a blockHeight.

Parameters:
Name Type Description
blockHeight

the height of the block that has consensus.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block with the given block height that has consensus.

getCount(consensus, type, callback(err,)

Source:

Gets a count of events.

Parameters:
Name Type Description
consensus

filter events based on consensus status.

type

filter events based on event type.

callback(err,

count) - the callback to call when finished.

getGenesis(callback(err,)

Source:

Retrieves the genesis block from the ledger.

Parameters:
Name Type Description
callback(err,

result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result with the genesis block. genesisBlock - the genesis block and its meta.

getGenesis()

Source:

Gets the genesis block from the ledger.

callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

getLatest(callback(err))

Source:

Gets the latest blocks from the ledger.

Parameters:
Name Type Description
callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

getLatest(callback(err,)

Source:

Retrieves the latest block from the ledger.

Parameters:
Name Type Description
callback(err,

result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the block. eventBlock - the latest events block and meta.

getLatestConfig()

Source:

Gets the latest configuration event that has consensus.

callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the retrieval. event - the event. meta - metadata about the event.

getLatestSummary(callback(err,)

Source:

Retrieves a summary of the latest block from the ledger.

Parameters:
Name Type Description
callback(err,

result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the block. eventBlock - the latest events block summary.

getSummary(blockId, consensusopt, eventHashopt, callback(err,)

Source:

Gets the block summary for consensus block given a blockId.

Parameters:
Name Type Attributes Description
blockId

the identifier of the block that has consensus.

consensus <optional>

false to retrieve a summary for a non-consensus block instead.

eventHash <optional>

true to get all event hashes from event.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block summary for the given ID that has consensus.

getSummaryByHeight(blockHeight, consensusopt, eventHashopt, callback(err,)

Source:

Gets the block summary for consensus block given a blockHeight.

Parameters:
Name Type Attributes Description
blockHeight

the height of the block that has consensus.

consensus <optional>

false to retrieve a summary for a non-consensus

eventHash <optional>

true to get all event hashes from event.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block summary for the given ID that has consensus.

remove()

Source:

Delete an event associated with the ledger given an event hash and a set of options.

eventHash - the hash of the event to delete. options - a set of options used when deleting the event. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

remove(blockHash, callback(err))

Source:

Delete a block in the ledger given a block hash and a set of options.

Parameters:
Name Type Description
blockHash

the hash of the block to delete.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

update()

Source:

Update an existing event associated with the ledger given an eventId, an array of patch instructions, and a set of options.

eventHash - the ID of the event to update patch - a list of patch commands for the event callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the value of the updated event.

update(blockHash, patch, callback(err))

Source:

Update an existing block in the ledger given a block hash, an array of patch instructions, and a set of options.

Parameters:
Name Type Description
blockHash

the hash of the block to update.

patch

the patch instructions to execute on the block.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

validate()

Source:

Validates an operation against the current configuration.

operation - the operation to validate. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

validate()

Source:

Validates a ledgerConfiguration.

ledgerConfiguration - the ledgerConfiguration to validate. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

exports

The LedgerNodeEvents class exposes the event management API.

Constructor

new exports()

Source:

Methods

add()

Source:

Adds an event to associate with a ledger given an event and a set of options.

event - the event to associate with a ledger. meta - the metadata that is associated with the event. eventHash - the hash of the event data. callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the operation. event - the event that was committed to storage. meta - the metadata that was committed to storage.

add(block, emit, meta, callback(err))

Source:

Adds a block in the ledger given a block, metadata associated with the block.

Parameters:
Name Type Description
block

the block to create in the ledger. blockHeight - the height of the block. event - an array of events associated with the block.

emit

when true (default), a bedrock event is emitted to inform listeners that a block has been added.

meta

the metadata associated with the block. blockHash - the hash value of the block.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the operation. block - the block that was committed to storage. meta - the metadata that was committed to storage.

add()

Source:

Adds an operation to mutate the state of a ledger.

operation - the operation to perform. options - a set of options used when adding the operation. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

change()

Source:

Submits a new ledgerConfiguration for the ledger. The change will not occur until the current consensus mechanism accepts the ledgerConfiguration and the state machine processes it.

ledgerConfiguration - the new ledgerConfiguration for the ledger. [genesis] - boolean - is this genesis config [genesisBlock] - a genesis block for a ledger callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

difference(eventHash, callback(err,)

Source:

Identify events that are not in storage.

Parameters:
Name Type Description
eventHash

the hash or array of hashes to check.

callback(err,

result) called onced the operation completes.

exists(eventHash, operationHash, callback(err,)

Source:

Determine if operations exist.

Parameters:
Name Type Description
eventHash

the hash of the event associated with the operation

operationHash

the hash or array of hashes of the operation(s).

callback(err,

result) called once the operation completes.

exists(eventHash, callback(err,)

Source:

Determine if an event with a given hash exists.

Parameters:
Name Type Description
eventHash

the hash or array of hashes of the event(s).

callback(err,

result) called once the operation completes.

get()

Source:

Gets the current ledgerConfiguration for the ledger.

callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise. ledgerConfiguration - the latest ledgerConfiguration or null if none.

get(blockId, consensusopt, callback(err,)

Source:

Gets the block that has consensus given a blockId.

Parameters:
Name Type Attributes Description
blockId

the identifier of the block that has consensus.

consensus <optional>

false to retrieve a non-consensus block instead.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block with the given ID that has consensus.

get()

Source:

Gets a record from the ledger given a recordID and a set of options.

[maxBlockHeight] - limit the record history to the specified block height. recordId - the URI of the object to fetch. callback(err, {meta, record}) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

get()

Source:

Gets an event in the ledger given a query and a set of options.

eventHash - the hash of the event to fetch from storage. callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the retrieval event - the event. meta - metadata about the event.

get()

Source:

Gets metadata associated with the ledger, such as most recent configuration block and latest consensus block, given a set of options.

actor - the actor performing the action. options - a set of options used when retrieving the ledger metadata. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise. ledgerMeta - metadata about the ledger.

get()

Source:

Gets an event associated with the ledger given an eventID and a set of options.

eventId - the event to fetch from the ledger. options - a set of options used when retrieving the event. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise. event - the event that was retrieved from the database.

get(blockId, consensusopt, callback(err))

Source:

Gets a block from the ledger given a blockID and a set of options.

Parameters:
Name Type Attributes Description
blockId

the URI of the block to fetch.

consensus <optional>

false to retrieve a non-consensus block.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

getActiveConfig()

Source:

Gets the active configuration based on blockHeight. A ledger configuration is active for blocks that are subsequent to the block that includes the ledger configuration event itself.

blockHeight - the blockHeight used to locate the ledger configuration. callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the retrieval. event - the event. meta - metadata about the event.

getAll(blockId, callback(err,)

Source:

Gets all blocks matching a given blockId even if they have not achieved consensus.

Parameters:
Name Type Description
blockId

the identifier of the block(s) to fetch from the ledger.

callback(err,

iterator) - the callback to call when finished. err - An Error if an error occurred, null otherwise. iterator - an iterator for all of the returned blocks.

getByHeight(blockHeight, callback(err,)

Source:

Gets a block that has consensus given a blockHeight.

Parameters:
Name Type Description
blockHeight

the height of the block that has consensus.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block with the given block height that has consensus.

getCount(consensus, type, callback(err,)

Source:

Gets a count of events.

Parameters:
Name Type Description
consensus

filter events based on consensus status.

type

filter events based on event type.

callback(err,

count) - the callback to call when finished.

getGenesis(callback(err,)

Source:

Retrieves the genesis block from the ledger.

Parameters:
Name Type Description
callback(err,

result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result with the genesis block. genesisBlock - the genesis block and its meta.

getGenesis()

Source:

Gets the genesis block from the ledger.

callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

getLatest(callback(err))

Source:

Gets the latest blocks from the ledger.

Parameters:
Name Type Description
callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

getLatest(callback(err,)

Source:

Retrieves the latest block from the ledger.

Parameters:
Name Type Description
callback(err,

result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the block. eventBlock - the latest events block and meta.

getLatestConfig()

Source:

Gets the latest configuration event that has consensus.

callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the retrieval. event - the event. meta - metadata about the event.

getLatestSummary(callback(err,)

Source:

Retrieves a summary of the latest block from the ledger.

Parameters:
Name Type Description
callback(err,

result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the block. eventBlock - the latest events block summary.

getSummary(blockId, consensusopt, eventHashopt, callback(err,)

Source:

Gets the block summary for consensus block given a blockId.

Parameters:
Name Type Attributes Description
blockId

the identifier of the block that has consensus.

consensus <optional>

false to retrieve a summary for a non-consensus block instead.

eventHash <optional>

true to get all event hashes from event.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block summary for the given ID that has consensus.

getSummaryByHeight(blockHeight, consensusopt, eventHashopt, callback(err,)

Source:

Gets the block summary for consensus block given a blockHeight.

Parameters:
Name Type Attributes Description
blockHeight

the height of the block that has consensus.

consensus <optional>

false to retrieve a summary for a non-consensus

eventHash <optional>

true to get all event hashes from event.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block summary for the given ID that has consensus.

remove()

Source:

Delete an event associated with the ledger given an event hash and a set of options.

eventHash - the hash of the event to delete. options - a set of options used when deleting the event. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

remove(blockHash, callback(err))

Source:

Delete a block in the ledger given a block hash and a set of options.

Parameters:
Name Type Description
blockHash

the hash of the block to delete.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

update()

Source:

Update an existing event associated with the ledger given an eventId, an array of patch instructions, and a set of options.

eventHash - the ID of the event to update patch - a list of patch commands for the event callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the value of the updated event.

update(blockHash, patch, callback(err))

Source:

Update an existing block in the ledger given a block hash, an array of patch instructions, and a set of options.

Parameters:
Name Type Description
blockHash

the hash of the block to update.

patch

the patch instructions to execute on the block.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

validate()

Source:

Validates an operation against the current configuration.

operation - the operation to validate. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

validate()

Source:

Validates a ledgerConfiguration.

ledgerConfiguration - the ledgerConfiguration to validate. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

exports

The LedgerNodeConfig class exposes the config management API.

Constructor

new exports()

Source:

Methods

add()

Source:

Adds an event to associate with a ledger given an event and a set of options.

event - the event to associate with a ledger. meta - the metadata that is associated with the event. eventHash - the hash of the event data. callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the operation. event - the event that was committed to storage. meta - the metadata that was committed to storage.

add(block, emit, meta, callback(err))

Source:

Adds a block in the ledger given a block, metadata associated with the block.

Parameters:
Name Type Description
block

the block to create in the ledger. blockHeight - the height of the block. event - an array of events associated with the block.

emit

when true (default), a bedrock event is emitted to inform listeners that a block has been added.

meta

the metadata associated with the block. blockHash - the hash value of the block.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the operation. block - the block that was committed to storage. meta - the metadata that was committed to storage.

add()

Source:

Adds an operation to mutate the state of a ledger.

operation - the operation to perform. options - a set of options used when adding the operation. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

change()

Source:

Submits a new ledgerConfiguration for the ledger. The change will not occur until the current consensus mechanism accepts the ledgerConfiguration and the state machine processes it.

ledgerConfiguration - the new ledgerConfiguration for the ledger. [genesis] - boolean - is this genesis config [genesisBlock] - a genesis block for a ledger callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

difference(eventHash, callback(err,)

Source:

Identify events that are not in storage.

Parameters:
Name Type Description
eventHash

the hash or array of hashes to check.

callback(err,

result) called onced the operation completes.

exists(eventHash, operationHash, callback(err,)

Source:

Determine if operations exist.

Parameters:
Name Type Description
eventHash

the hash of the event associated with the operation

operationHash

the hash or array of hashes of the operation(s).

callback(err,

result) called once the operation completes.

exists(eventHash, callback(err,)

Source:

Determine if an event with a given hash exists.

Parameters:
Name Type Description
eventHash

the hash or array of hashes of the event(s).

callback(err,

result) called once the operation completes.

get()

Source:

Gets the current ledgerConfiguration for the ledger.

callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise. ledgerConfiguration - the latest ledgerConfiguration or null if none.

get(blockId, consensusopt, callback(err,)

Source:

Gets the block that has consensus given a blockId.

Parameters:
Name Type Attributes Description
blockId

the identifier of the block that has consensus.

consensus <optional>

false to retrieve a non-consensus block instead.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block with the given ID that has consensus.

get()

Source:

Gets a record from the ledger given a recordID and a set of options.

[maxBlockHeight] - limit the record history to the specified block height. recordId - the URI of the object to fetch. callback(err, {meta, record}) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

get()

Source:

Gets an event in the ledger given a query and a set of options.

eventHash - the hash of the event to fetch from storage. callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the retrieval event - the event. meta - metadata about the event.

get()

Source:

Gets metadata associated with the ledger, such as most recent configuration block and latest consensus block, given a set of options.

actor - the actor performing the action. options - a set of options used when retrieving the ledger metadata. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise. ledgerMeta - metadata about the ledger.

get()

Source:

Gets an event associated with the ledger given an eventID and a set of options.

eventId - the event to fetch from the ledger. options - a set of options used when retrieving the event. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise. event - the event that was retrieved from the database.

get(blockId, consensusopt, callback(err))

Source:

Gets a block from the ledger given a blockID and a set of options.

Parameters:
Name Type Attributes Description
blockId

the URI of the block to fetch.

consensus <optional>

false to retrieve a non-consensus block.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

getActiveConfig()

Source:

Gets the active configuration based on blockHeight. A ledger configuration is active for blocks that are subsequent to the block that includes the ledger configuration event itself.

blockHeight - the blockHeight used to locate the ledger configuration. callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the retrieval. event - the event. meta - metadata about the event.

getAll(blockId, callback(err,)

Source:

Gets all blocks matching a given blockId even if they have not achieved consensus.

Parameters:
Name Type Description
blockId

the identifier of the block(s) to fetch from the ledger.

callback(err,

iterator) - the callback to call when finished. err - An Error if an error occurred, null otherwise. iterator - an iterator for all of the returned blocks.

getByHeight(blockHeight, callback(err,)

Source:

Gets a block that has consensus given a blockHeight.

Parameters:
Name Type Description
blockHeight

the height of the block that has consensus.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block with the given block height that has consensus.

getCount(consensus, type, callback(err,)

Source:

Gets a count of events.

Parameters:
Name Type Description
consensus

filter events based on consensus status.

type

filter events based on event type.

callback(err,

count) - the callback to call when finished.

getGenesis(callback(err,)

Source:

Retrieves the genesis block from the ledger.

Parameters:
Name Type Description
callback(err,

result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result with the genesis block. genesisBlock - the genesis block and its meta.

getGenesis()

Source:

Gets the genesis block from the ledger.

callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

getLatest(callback(err))

Source:

Gets the latest blocks from the ledger.

Parameters:
Name Type Description
callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

getLatest(callback(err,)

Source:

Retrieves the latest block from the ledger.

Parameters:
Name Type Description
callback(err,

result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the block. eventBlock - the latest events block and meta.

getLatestConfig()

Source:

Gets the latest configuration event that has consensus.

callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the result of the retrieval. event - the event. meta - metadata about the event.

getLatestSummary(callback(err,)

Source:

Retrieves a summary of the latest block from the ledger.

Parameters:
Name Type Description
callback(err,

result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the block. eventBlock - the latest events block summary.

getSummary(blockId, consensusopt, eventHashopt, callback(err,)

Source:

Gets the block summary for consensus block given a blockId.

Parameters:
Name Type Attributes Description
blockId

the identifier of the block that has consensus.

consensus <optional>

false to retrieve a summary for a non-consensus block instead.

eventHash <optional>

true to get all event hashes from event.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block summary for the given ID that has consensus.

getSummaryByHeight(blockHeight, consensusopt, eventHashopt, callback(err,)

Source:

Gets the block summary for consensus block given a blockHeight.

Parameters:
Name Type Attributes Description
blockHeight

the height of the block that has consensus.

consensus <optional>

false to retrieve a summary for a non-consensus

eventHash <optional>

true to get all event hashes from event.

callback(err,

block) - the callback to call when finished. err - An Error if an error occurred, null otherwise. block - the block summary for the given ID that has consensus.

remove()

Source:

Delete an event associated with the ledger given an event hash and a set of options.

eventHash - the hash of the event to delete. options - a set of options used when deleting the event. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

remove(blockHash, callback(err))

Source:

Delete a block in the ledger given a block hash and a set of options.

Parameters:
Name Type Description
blockHash

the hash of the block to delete.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

update()

Source:

Update an existing event associated with the ledger given an eventId, an array of patch instructions, and a set of options.

eventHash - the ID of the event to update patch - a list of patch commands for the event callback(err, result) - the callback to call when finished. err - An Error if an error occurred, null otherwise. result - the value of the updated event.

update(blockHash, patch, callback(err))

Source:

Update an existing block in the ledger given a block hash, an array of patch instructions, and a set of options.

Parameters:
Name Type Description
blockHash

the hash of the block to update.

patch

the patch instructions to execute on the block.

callback(err)

the callback to call when finished. err - An Error if an error occurred, null otherwise.

validate()

Source:

Validates an operation against the current configuration.

operation - the operation to validate. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.

validate()

Source:

Validates a ledgerConfiguration.

ledgerConfiguration - the ledgerConfiguration to validate. callback(err) - the callback to call when finished. err - An Error if an error occurred, null otherwise.