# bbclib 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.

class `bbclib.``BBcAsset`

  Bases: `object`

  `add`(user_id=None, asset_file=None, asset_body=None)
  `deserialize`(data)
  `digest`()
  `get_asset_file`()
  `recover_asset_file`(asset_file)
  `serialize`(for_digest_calculation=False)

class `bbclib.``BBcCrossRef`(domain_id=None, transaction_id=None)

  Bases: `object`

  `deserialize`(data)
  `serialize`()

class `bbclib.``BBcEvent`(asset_group_id=None)

  Bases: `object`

  `add`(asset_group_id=None, reference_index=None, mandatory_approver=None, option_approver_num_numerator=0, option_approver_num_denominator=0, option_approver=None, asset=None)
  `deserialize`(data)
  `serialize`()

class `bbclib.``BBcPointer`(transaction_id=None, asset_id=None)

  Bases: `object`

  `add`(transaction_id=None, asset_id=None)
  `deserialize`(data)
  `serialize`()

class `bbclib.``BBcReference`(asset_group_id, transaction, ref_transaction=None, event_index_in_ref=0)

  Bases: `object`

  `add_signature`(user_id=None, signature=None)
  `deserialize`(data)
  `get_destinations`()
  `get_referred_transaction`()
  `prepare_reference`(ref_transaction)
  `serialize`()

class `bbclib.``BBcRelation`(asset_group_id=None)

  Bases: `object`

  `add`(asset_group_id=None, asset=None, pointer=None)
  `deserialize`(data)
  `serialize`()

class `bbclib.``BBcSignature`(key_type=1)

  Bases: `object`

  `add`(signature=None, pubkey=None)
  `deserialize`(data)
  `serialize`()
  `verify`(digest)

class `bbclib.``BBcTransaction`(version=0)

  Bases: `object`

  `add`(event=None, reference=None, relation=None, witness=None, cross_ref=None)
  `add_signature`(user_id=None, signature=None)
  `deserialize`(data)
  `digest`()
  `dump`()
  `get_sig_index`(user_id)
  `serialize`(for_id=False)
  `sign`(key_type=1, private_key=None, public_key=None, keypair=None)

    Sign transaction :param key_type: KeyType.ECDSA_SECP256k1 :param private_key: bytes format :param public_key: bytes format :return: BBcSignature object

class `bbclib.``BBcWitness`

  Bases: `object`

  `add_signature`(user_id=None, signature=None)
  `add_witness`(user_id)
  `deserialize`(data)
  `serialize`()

class `bbclib.``KeyPair`(type=1, privkey=None, pubkey=None)

  Bases: `object`

  `generate`()
  `get_private_key_in_der`()
  `get_private_key_in_pem`()
  `mk_keyobj_from_private_key`()
  `mk_keyobj_from_private_key_der`(derdat)
  `mk_keyobj_from_private_key_pem`(pemdat_string)
  `sign`(digest)
  `to_bigint`(dat)
  `to_binary`(dat)
  `verify`(digest, sig)

class `bbclib.``KeyType`

  Bases: `object`

  `ECDSA_SECP256k1` = 1

class `bbclib.``NodeInfo`(node_id=b'x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00', ipv4=None, ipv6=None, port=None)

  Bases: `object`

  node information entry (socket info)

  `detect_disconnect`()
  `get_nodeinfo`()
  `recover_nodeinfo`(node_id, ipv4, ipv6, port, updated_at=0)
  `touch`()
  `update`(ipv4=None, ipv6=None, port=None)

class `bbclib.``ServiceMessageType`

  Bases: `object`

  `CANCEL_INSERT_NOTIFICATION` = 16
  `DOMAIN_PING` = 12
  `MESSAGE` = 34
  `NOTIFY_INSERTED` = 41
  `REGISTER` = 32
  `REQUEST_ALIVE_CHECK` = 20
  `REQUEST_CROSS_REF` = 72
  `REQUEST_GATHER_SIGNATURE` = 35
  `REQUEST_GET_CONFIG` = 8
  `REQUEST_GET_DOMAINLIST` = 13
  `REQUEST_GET_PEERLIST` = 2
  `REQUEST_GET_STATS` = 17
  `REQUEST_INSERT` = 39
  `REQUEST_INSERT_NOTIFICATION` = 15
  `REQUEST_MANIP_LEDGER_SUBSYS` = 10
  `REQUEST_PING_TO_ALL` = 19
  `REQUEST_REGISTER_HASH_IN_SUBSYS` = 128
  `REQUEST_SEARCH_ASSET` = 66
  `REQUEST_SEARCH_TRANSACTION` = 68
  `REQUEST_SEARCH_USERID` = 70
  `REQUEST_SETUP_DOMAIN` = 0
  `REQUEST_SET_STATIC_NODE` = 4
  `REQUEST_SIGNATURE` = 37
  `REQUEST_VERIFY_HASH_IN_SUBSYS` = 130
  `RESPONSE_CROSS_REF` = 73
  `RESPONSE_GATHER_SIGNATURE` = 36
  `RESPONSE_GET_CONFIG` = 9
  `RESPONSE_GET_DOMAINLIST` = 14
  `RESPONSE_GET_PEERLIST` = 3
  `RESPONSE_GET_STATS` = 18
  `RESPONSE_INSERT` = 40
  `RESPONSE_MANIP_LEDGER_SUBSYS` = 11
  `RESPONSE_REGISTER_HASH_IN_SUBSYS` = 129
  `RESPONSE_SEARCH_ASSET` = 67
  `RESPONSE_SEARCH_TRANSACTION` = 69
  `RESPONSE_SEARCH_USERID` = 71
  `RESPONSE_SETUP_DOMAIN` = 1
  `RESPONSE_SET_STATIC_NODE` = 5
  `RESPONSE_SIGNATURE` = 38
  `RESPONSE_VERIFY_HASH_IN_SUBSYS` = 131
  `UNREGISTER` = 33

class `bbclib.``StorageType`

  Bases: `object`

  `FILESYSTEM` = 1
  `NONE` = 0

`bbclib.``add_reference_to_transaction`(asset_group_id, transaction, ref_transaction_obj, event_index_in_ref)

`bbclib.``add_relation_pointer`(relation, transaction_id, asset_id)

`bbclib.``convert_id_to_string`(data, bytelen=32)

`bbclib.``convert_idstring_to_bytes`(datastr, bytelen=32)

`bbclib.``get_bigint`(ptr, dat)

`bbclib.``get_n_byte_int`(ptr, n, dat)

`bbclib.``get_n_bytes`(ptr, n, dat)

`bbclib.``get_new_id`(seed_str=None, include_timestamp=True)

`bbclib.``get_random_id`()

`bbclib.``get_random_value`(length=8)

`bbclib.``get_relation_with_asset_group_id`(txobj, asset_group_id)

`bbclib.``get_relation_with_asset_id`(txobj, asset_id)

`bbclib.``is_less_than`(val_a, val_b)

  return True if val_a is less than val_b (evaluate as integer) :param val_a: :param val_b: :return:

`bbclib.``make_transaction_for_base_asset`(asset_group_id=None, event_num=1, witness=False)

`bbclib.``make_transaction_with_relation`(asset_group_id=None, asset=None, base_transaction=None)

`bbclib.``make_transaction_with_witness`(base_transaction=None)

`bbclib.``recover_signature_object`(data)

`bbclib.``recover_transaction_object_from_rawdata`(data)

`bbclib.``reset_error`()

`bbclib.``set_error`(code=-1, txt='')

`bbclib.``to_2byte`(val)

`bbclib.``to_4byte`(val)

`bbclib.``to_8byte`(val)

`bbclib.``to_bigint`(val, size=32)