Welcome to bbc1’s documentation!

bbc1 package

Subpackages

bbc1.core package

Subpackages
Submodules
bbc1.core.bbc_app module
bbc1.core.bbc_config module
bbc1.core.bbc_core module
bbc1.core.bbc_error 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

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.

bbc1.core.bbc_network module
bbc1.core.bbc_stats 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

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.

class bbc1.core.bbc_stats.BBcStats[source]

Bases: object

clear_stats()[source]
get_stats()[source]
remove_stat_category(category)[source]
remove_stat_item(category, name)[source]
update_stats(category, name, value)[source]
update_stats_decrement(category, name, value)[source]
update_stats_increment(category, name, value)[source]
bbc1.core.bbclib module
bbc1.core.command module
bbc1.core.data_handler module
bbc1.core.domain0_manager module
bbc1.core.key_exchange_manager 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

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.

class bbc1.core.key_exchange_manager.KeyExchangeManager(networking, domain_id, counter_node_id)[source]

Bases: object

ECDH (Elliptic Curve Diffie-Hellman) key exchange manager

KEY_EXCHANGE_INVOKE_MAX_BACKOFF = 6
KEY_EXCHANGE_RETRY_INTERVAL = 5
KEY_OBSOLETE_TIMER = 10
KEY_REFRESH_INTERVAL = 604800
STATE_CONFIRMING = 2
STATE_ESTABLISHED = 3
STATE_NONE = 0
STATE_REQUESTING = 1
receive_confirmation()[source]

Confirm that the key has been agreed

receive_exchange_request(pubkey, nonce, random_val, hint)[source]

Procedure when receiving message with BBcNetwork.REQUEST_KEY_EXCHANGE

Parameters:
  • pubkey (bytes) – public key
  • nonce (bytes) – nonce value
  • random_val (bytes) – random value in calculating key
receive_exchange_response(pubkey, random_val, hint)[source]

Process ECDH procedure (receiving response)

set_cipher(key_name, hint)[source]

Set key to the encryptor and decryptor

set_invoke_timer(timeout, retry_entry=False)[source]

Set timer for key refreshment

stop_all_timers()[source]

Stop all timers

unset_cipher(key_name=None)[source]

Unset key from the encryptor and decryptor

bbc1.core.key_exchange_manager.remove_old_key(query_entry)[source]
bbc1.core.logger 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

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.

bbc1.core.logger.get_logger(key='', logname='-', level='none')[source]
bbc1.core.message_key_types 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

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.

class bbc1.core.message_key_types.InfraMessageCategory[source]

Bases: object

Types of message for inter-core nodes messaging

CATEGORY_DATA = b'\x00\x03'
CATEGORY_DOMAIN0 = b'\x00\x04'
CATEGORY_NETWORK = b'\x00\x00'
CATEGORY_TOPOLOGY = b'\x00\x01'
CATEGORY_USER = b'\x00\x02'
class bbc1.core.message_key_types.KeyType[source]

Bases: object

Types of items in a message

admin_info = b'\x00\x00\x00\x17'
all_asset_files = b'\x00\x00\x00u'
all_included = b'\x00\x00\x00h'
anycast_ttl = b'\x00\x00\x00\x1a'
asset_file = b'\x00\x00\x00t'
asset_group_id = b'\x00\x00\x00c'
asset_group_ids = b'\x00\x00\x00d'
asset_id = b'\x00\x00\x00e'
bbc_configuration = b'\x00\x00\x00<'
command = b'\x00\x00\x00\t'
compromised_asset_files = b'\x00\x00\x00\x92'
compromised_transaction_data = b'\x00\x00\x00\x90'
compromised_transaction_ids = b'\x00\x00\x00\x93'
compromised_transactions = b'\x00\x00\x00\x91'
count = b'\x00\x00\x00\x0e'
cross_ref = b'\x00\x00\x00w'
cross_ref_verification_info = b'\x00\x00\x00{'
destination_node_id = b'\x00\x00\x00V'
destination_user_id = b'\x00\x00\x00R'
destination_user_ids = b'\x00\x00\x00S'
direction = b'\x00\x00\x00f'
domain_id = b'\x00\x00\x00P'
domain_list = b'\x00\x00\x007'
domain_ping = b'\x00\x00\x00\x15'
ecdh = b'\x00\x00\x00\x11'
external_ip4addr = b'\x00\x00\x004'
external_ip6addr = b'\x00\x00\x005'
forwarding_list = b'\x00\x00\x008'
hint = b'\x00\x00\x00\x10'
hop_count = b'\x00\x00\x00g'
infra_command = b'\x00\x00\x00\n'
infra_msg_type = b'\x00\x00\x00\x08'
ipv4_address = b'\x00\x00\x001'
ipv6_address = b'\x00\x00\x002'
is_anycast = b'\x00\x00\x00\x19'
is_replication = b'\x00\x00\x00\x1b'
ledger_subsys_manip = b'\x00\x00\x00\xa0'
ledger_subsys_register = b'\x00\x00\x00\xa1'
ledger_subsys_verify = b'\x00\x00\x00\xa2'
merkle_tree = b'\x00\x00\x00\xa3'
message = b'\x00\x00\x00\x0c'
message_seq = b'\x00\x00\x00\x14'
neighbor_list = b'\x00\x00\x00:'
node_id = b'\x00\x00\x00T'
node_info = b'\x00\x00\x006'
nodekey_signature = b'\x00\x00\x00\x16'
nonce = b'\x00\x00\x00\r'
notification_list = b'\x00\x00\x00;'
on_multinodes = b'\x00\x00\x00\x18'
outer_domain_id = b'\x00\x00\x00x'
port_number = b'\x00\x00\x003'
query_id = b'\x00\x00\x00\x0b'
random = b'\x00\x00\x00\x12'
reason = b'\x00\x00\x00\x01'
ref_index = b'\x00\x00\x00s'
result = b'\x00\x00\x00\x02'
retry_timer = b'\x00\x00\x00\x13'
signature = b'\x00\x00\x00v'
source_domain_id = b'\x00\x00\x00y'
source_node_id = b'\x00\x00\x00U'
source_user_id = b'\x00\x00\x00Q'
static_entry = b'\x00\x00\x000'
stats = b'\x00\x00\x00\x0f'
status = b'\x00\x00\x00\x00'
transaction_data = b'\x00\x00\x00p'
transaction_data_format = b'\x00\x00\x00|'
transaction_id = b'\x00\x00\x00a'
transaction_id_list = b'\x00\x00\x00b'
transaction_tree = b'\x00\x00\x00r'
transactions = b'\x00\x00\x00q'
txid_having_cross_ref = b'\x00\x00\x00z'
user_id = b'\x00\x00\x00`'
user_list = b'\x00\x00\x009'
class bbc1.core.message_key_types.Message[source]

Bases: object

Message parser

HEADER_LEN = 8
parse()[source]

Parse the message in the buffer

recv(dat)[source]

Append message to the buffer

class bbc1.core.message_key_types.PayloadType[source]

Bases: object

Type_any = 1
Type_binary = 0
Type_encrypted_msgpack = 3
Type_msgpack = 2
bbc1.core.message_key_types.convert_from_binary(data_type, dat)[source]

Deserialization from simple serialization

bbc1.core.message_key_types.derive_shared_key(private_key, serialized_pubkey, shared_info)[source]

Utility for deriving shared key in ECDH procedure

bbc1.core.message_key_types.deserialize_data(payload_type, dat)[source]

Utility for deserializing the received message

bbc1.core.message_key_types.get_ECDH_parameters()[source]

Utility for initialization of ECDH parameters

bbc1.core.message_key_types.make_TLV_formatted_message(msg)[source]

Utility for simple serialization function

bbc1.core.message_key_types.make_binary(dat)[source]

Simple serialize function

Basically, Type-Length-Value format is created for each item.

bbc1.core.message_key_types.make_dictionary_from_TLV_format(dat)[source]

Utility for simple deserialization function

bbc1.core.message_key_types.make_message(payload_type, msg, payload_version=0, key_name=None)[source]

Utility for making serialized message data

bbc1.core.message_key_types.set_cipher(shared_key, nonce, key_name, hint)[source]

Set shared key to the encryptor and decryptor

Encryptor and Decryptor are created for each inter-node connection

bbc1.core.message_key_types.to_2byte(val, offset=0)[source]
bbc1.core.message_key_types.to_4byte(val, offset=0)[source]
bbc1.core.message_key_types.unset_cipher(key_name)[source]
bbc1.core.query_management 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

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.

class bbc1.core.query_management.QueryEntry(expire_after=30, callback_expire=None, callback=None, callback_error=None, interval=0, data={}, retry_count=-1)[source]

Bases: object

Callback manager

callback()[source]

Call a callback function for successful case

callback_error()[source]

Call a callback function for failure case

deactivate()[source]

Deactivate the entry

update(fire_after=None, expire_after=None, callback=None, callback_error=None, init=False)[source]

Update the entry information

Parameters:
  • fire_after (float) – set callback (periodical) to fire after given time (in second)
  • expire_after (float) – set expiration timer to given time (in second)
  • callback (obj) – callback method that will be called periodically
  • callback_error (obj) – callback method that will be called when error happens
  • init (bool) – If True, the scheduler is sorted again
update_expiration_time(expire_after)[source]

Update the expire timer

Parameters:expire_after (float) – new expiration time in second
class bbc1.core.query_management.Ticker(tick_interval=0.049)[source]

Bases: object

Clock ticker for query timers

del_entry(nonce)[source]

Delete an entry from the scheduler identified by nonce

get_entry(nonce)[source]

Get an entry identified by nonce

bbc1.core.query_management.get_ticker(tick_interval=0.049)[source]
bbc1.core.repair_manager module
bbc1.core.topology_manager 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

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.

class bbc1.core.topology_manager.TopologyManagerBase(network=None, config=None, domain_id=None, node_id=None, loglevel='all', logname=None)[source]

Bases: object

Network topology management for a domain

This class defines how to create topology, meaning that who should be neighbors and provides very simple topology management, that is full mesh topology. If P2P routing algorithm is needed, you should override this class to upgrade functions. This class does not manage the neighbor list itself (It’s in BBcNetwork)

NEIGHBOR_LIST_REFRESH_INTERVAL = 300
NOTIFY_NEIGHBOR_LIST = b'\x00\x00'
make_neighbor_list()[source]

make nodelist binary for advertising

notify_neighbor_update(node_id, is_new=True)[source]

Update expiration timer for the notified node_id

Parameters:
  • node_id (bytes) – target node_id
  • is_new (bool) – If True, this node is a new comer node
process_message(msg)[source]

Process received message

Parameters:msg (dict) – received message
stop_all_timers()[source]

Invalidate all running timers

update_refresh_timer_entry(new_entry=True, force_refresh_time=None)[source]

Update expiration timer

bbc1.core.user_message_routing module
Module contents

Module contents

Indices and tables