ledger_subsystem module — BBc1 0.7 documentation

# ledger_subsystem module

Copyright (c) 2017 beyond-blockchain.org.

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

> http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

`LedgerSubsystem`(config[, core, enabled, …]) | Abstraction of an underlying ledger subsystem that is typically a blockchain.

class `ledger_subsystem.` `LedgerSubsystem`(config, core=None, enabled=False, dbtype='sqlite', loglevel='all', logname=None)

  Bases: `object`

  Abstraction of an underlying ledger subsystem that is typically a blockchain. This takes one transaction each to record and verifies its existence. It forms some Merkle trees of transaction IDs, and writes their root digests only to the underlying ledger.

  `append_msg`(msg)
  `close_merkle_tree`(jTemp)
  `disable`()

    Disables communication with the underlying ledger.

    Returns: |

  `enable`()

    Enables communication with the underlying ledger.

    Returns: |

  `get_merkle_base`(digest)
  `register_transaction`(asset_group_id, transaction_id)

    Registers a transaction.

    Parameters: | asset_group_id – asset group transaction_id – transaction to register
    Returns: |

  `set_domain`(domain_id)
  `set_domain_internal`(domain_id)
  `subsystem_loop`()
  `subsystem_timer`()
  `verify_digest`(digest, dic)
  `verify_transaction`(asset_group_id, transaction_id)

    Verifies whether the specified transaction is registered or not.

    Parameters: | asset_group_id – asset group transaction_id – transaction to verify its existence
    Returns: | dictionary containing the result (and a Merkle subtree)

  `write_branch`(digest=None, left=None, right=None)
  `write_leaf`(jTemp, digest=None, left=None, right=None)
  `write_merkle_root`(root)
  `write_root`(root=None, spec=None)

class `ledger_subsystem.` `Queue`

  Bases: `object`

  `append_msg`(msg)
  `wait_msg`(flash_others=False)