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
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
[source]
Bases: object
-
add
(user_id=None, asset_file=None, asset_body=None)[source]
-
deserialize
(data)[source]
-
digest
()[source]
-
get_asset_file
()[source]
-
recover_asset_file
(asset_file)[source]
-
serialize
(for_digest_calculation=False)[source]
-
class
bbclib.
BBcCrossRef
(asset_group_id=None, transaction_id=None)[source]
Bases: object
-
deserialize
(data)[source]
-
serialize
()[source]
-
class
bbclib.
BBcEvent
(asset_group_id=None)[source]
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)[source]
-
deserialize
(data)[source]
-
serialize
()[source]
-
class
bbclib.
BBcReference
(asset_group_id, transaction, ref_transaction=None, event_index_in_ref=0)[source]
Bases: object
-
add_signature
(user_id=None, signature=None)[source]
-
deserialize
(data)[source]
-
get_destinations
()[source]
-
get_referred_transaction
()[source]
-
prepare_reference
(ref_transaction)[source]
-
serialize
()[source]
-
class
bbclib.
BBcSignature
(key_type=1)[source]
Bases: object
-
add
(signature=None, pubkey=None)[source]
-
deserialize
(data)[source]
-
serialize
()[source]
-
verify
(digest)[source]
-
class
bbclib.
BBcTransaction
(version=0)[source]
Bases: object
-
add
(event=None, reference=None, cross_ref=None)[source]
-
add_signature
(user_id=None, signature=None)[source]
-
deserialize
(data)[source]
-
digest
()[source]
-
dump
()[source]
-
get_sig_index
(user_id)[source]
-
serialize
(for_id=False)[source]
-
sign
(key_type=1, private_key=None, public_key=None, keypair=None)[source]
Sign transaction
:param key_type: KeyType.ECDSA_SECP256k1
:param private_key: bytes format
:param public_key: bytes format
:return: BBcSignature object
-
class
bbclib.
KeyPair
(type=1, privkey=None, pubkey=None)[source]
Bases: object
-
generate
()[source]
-
get_private_key_in_der
()[source]
-
get_private_key_in_pem
()[source]
-
mk_keyobj_from_private_key
()[source]
-
mk_keyobj_from_private_key_der
(derdat)[source]
-
to_bigint
(dat)[source]
-
to_binary
(dat)[source]
-
class
bbclib.
KeyType
[source]
Bases: object
-
ECDSA_SECP256k1
= 1
-
class
bbclib.
NodeInfo
(node_id=b'x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00x00', ipv4=None, ipv6=None, port=None)[source]
Bases: object
node information entry (socket info)
-
detect_disconnect
()[source]
-
get_nodeinfo
()[source]
-
recover_nodeinfo
(node_id, ipv4, ipv6, port)[source]
-
touch
()[source]
-
update
(ipv4=None, ipv6=None, port=None)[source]
-
class
bbclib.
ServiceMessageType
[source]
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
[source]
Bases: object
-
FILESYSTEM
= 1
-
NONE
= 0
-
bbclib.
add_reference_to_transaction
(asset_group_id, transaction, ref_transaction_obj, event_index_in_ref)[source]
-
bbclib.
convert_id_to_string
(data, bytelen=32)[source]
-
bbclib.
convert_idstring_to_bytes
(datastr, bytelen=32)[source]
-
bbclib.
get_bigint
(ptr, dat)[source]
-
bbclib.
get_n_byte_int
(ptr, n, dat)[source]
-
bbclib.
get_n_bytes
(ptr, n, dat)[source]
-
bbclib.
get_new_id
(seed_str=None, include_timestamp=True)[source]
-
bbclib.
get_random_id
()[source]
-
bbclib.
get_random_value
(length=8)[source]
-
bbclib.
is_less_than
(val_a, val_b)[source]
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)[source]
-
bbclib.
recover_signature_object
(data)[source]
-
bbclib.
recover_transaction_object_from_rawdata
(data)[source]
-
bbclib.
reset_error
()[source]
-
bbclib.
set_error
(code=-1, txt='')[source]
-
bbclib.
to_2byte
(val)[source]
-
bbclib.
to_4byte
(val)[source]
-
bbclib.
to_8byte
(val)[source]
-
bbclib.
to_bigint
(val, size=32)[source]