bbclib module — BBc1 0.7 documentation

# 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`(asset_group_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.` `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.` `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, 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_XY/X :param private_key: bytes format :param public_key: bytes format :return: BBcSignature object

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_pem`(pemdat)
  `mk_public_keyobj`()
  `to_bigint`(dat)
  `to_binary`(dat)

class `bbclib.` `KeyType`

  Bases: `object`

  `ECDSA_SECP256k1_X` = 2
  `ECDSA_SECP256k1_XY` = 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)
  `touch`()
  `update`(ipv4=None, ipv6=None, port=None)

class `bbclib.` `ServiceMessageType`

  Bases: `object`

  `DOMAIN_PING` = 12
  `MESSAGE` = 34
  `REGISTER` = 32
  `REQUEST_CROSS_REF` = 70
  `REQUEST_GATHER_SIGNATURE` = 35
  `REQUEST_GET_CONFIG` = 8
  `REQUEST_GET_DOMAINLIST` = 13
  `REQUEST_GET_PEERLIST` = 2
  `REQUEST_INSERT` = 39
  `REQUEST_MANIP_LEDGER_SUBSYS` = 10
  `REQUEST_REGISTER_HASH_IN_SUBSYS` = 128
  `REQUEST_SEARCH_ASSET` = 66
  `REQUEST_SEARCH_TRANSACTION` = 68
  `REQUEST_SETUP_ASSET_GROUP` = 6
  `REQUEST_SETUP_DOMAIN` = 0
  `REQUEST_SET_STATIC_NODE` = 4
  `REQUEST_SIGNATURE` = 37
  `REQUEST_VERIFY_HASH_IN_SUBSYS` = 130
  `RESPONSE_CROSS_REF` = 71
  `RESPONSE_GATHER_SIGNATURE` = 36
  `RESPONSE_GET_CONFIG` = 9
  `RESPONSE_GET_DOMAINLIST` = 14
  `RESPONSE_GET_PEERLIST` = 3
  `RESPONSE_INSERT` = 40
  `RESPONSE_MANIP_LEDGER_SUBSYS` = 11
  `RESPONSE_REGISTER_HASH_IN_SUBSYS` = 129
  `RESPONSE_SEARCH_ASSET` = 67
  `RESPONSE_SEARCH_TRANSACTION` = 69
  `RESPONSE_SETUP_ASSET_GROUP` = 7
  `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.` `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.` `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)

`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)