bbc1.core.bbc_core module

:” .

exec python “$0” “$@”

class bbc1.core.bbc_core.BBcCoreService(p2p_port=None, core_port=None, use_domain0=False, ip4addr=None, ip6addr=None, workingdir='.bbc1', configfile=None, use_nodekey=None, use_ledger_subsystem=False, default_conffile=None, loglevel='all', logname='-', server_start=True)[source]

Bases: object

Base service object of BBc-1

count_transactions(domain_id, asset_group_id=None, asset_id=None, user_id=None, start_from=None, until=None)[source]

Count transactions that match given conditions

When Multiple conditions are given, they are considered as AND condition.

Parameters
  • domain_id (bytes) – target domain_id

  • asset_group_id (bytes) – asset_group_id that target transactions should have

  • asset_id (bytes) – asset_id that target transactions should have

  • user_id (bytes) – user_id that target transactions should have

  • start_from (int) – the starting timestamp to search

  • until (int) – the end timestamp to search

Returns

the number of transactions

Return type

int

insert_transaction(domain_id, txdata, asset_files)[source]

Insert transaction into ledger

Parameters
  • domain_id (bytes) – target domain_id

  • txdata (bytes) – serialized transaction data

  • asset_files (dict) – dictionary of {asset_id: content} for the transaction

Returns

inserted transaction_id or error message

Return type

dict|str

quit_program()[source]

Processes when quiting program

remove_from_notification_list(domain_id, asset_group_id, user_id)[source]

Remove entry from insert completion notification list

This method checks validation only.

Parameters
  • domain_id (bytes) – target domain_id

  • asset_group_id (bytes) – target asset_group_id of which you want to get notification about the insertion

  • user_id (bytes) – user_id that registers in the list

search_transaction_with_condition(domain_id, asset_group_id=None, asset_id=None, user_id=None, start_from=None, until=None, direction=0, count=0)[source]

Search transactions that match given conditions

When Multiple conditions are given, they are considered as AND condition.

Parameters
  • domain_id (bytes) – target domain_id

  • asset_group_id (bytes) – asset_group_id that target transactions should have

  • asset_id (bytes) – asset_id that target transactions should have

  • user_id (bytes) – user_id that target transactions should have

  • start_from (int) – the starting timestamp to search

  • until (int) – the end timestamp to search

  • direction (int) – 0: descend, 1: ascend

  • count (int) – The maximum number of transactions to retrieve (if count <= 0, then self.search_max_count is applied)

Returns

dictionary having transaction_id, serialized transaction data, asset files

Return type

dict

send_inserted_notification(domain_id, asset_group_ids, transaction_id, only_registered_user=False)[source]

Broadcast NOTIFY_INSERTED

Parameters
  • domain_id (bytes) – target domain_id

  • asset_group_ids (list) – list of asset_group_ids

  • transaction_id (bytes) – transaction_id that has just inserted

  • only_registered_user (bool) – If True, notification is not sent to other nodes

validate_transaction(txdata, asset_files=None)[source]

Validate transaction by verifying signature

Parameters
  • txdata (bytes) – serialized transaction data

  • asset_files (dict) – dictionary of {asset_id: content} for the transaction

Returns

if validation fails, None returns. int (short): 2-byte value of BBcFormat type or None

Return type

BBcTransaction

bbc1.core.bbc_core.activate_ledgersubsystem()[source]

Load module of ledger_subsystem if installed

bbc1.core.bbc_core.daemonize(pidfile='/tmp/bbc1.pid')[source]

Run in background