3.1. Unit¶
This module implements unit - a basic building block of Aleph protocol.
-
class
aleph.data_structures.unit.
Unit
(creator_id, parents, txs, signature=None, coin_shares=None)¶ This class is the building block for the poset
- Parameters
creator_id (int) – indentification number of a process creating this unit
parents (list) – list of parent units; first parent has to be the last unit created by the process creator_id
txs (list) – list of transactions
signature (bytes) – signature made by a process creating this unit preventing forging units by Byzantine processes
coin_shares (list) – list of coin_shares if this is a prime unit, None otherwise
-
bytestring
()¶ Create a bytestring with all essential info about this unit for the purpose of signature creation and checking.
-
hash
()¶ Return the value of hash of this unit.
-
short_name
()¶ Returns a 12 character string (surrounded by ‘< >’ brackets) – a shorter hash of the unit. To be used for printing units in logs. NOTE: this has collision resistance as long there are roughly <= 10^9 units considered simultaneusly. NOTE: this uses only characters in the set A-Z, 2-7 (base32 encoding)
-
transactions
()¶ Iterate over transactions (instances of Tx class) belonging to this unit.
-
aleph.data_structures.unit.
pretty_hash
(some_hash)¶ Returns a 12 character string (surrounded by ‘< >’ brackets) – a shorter hash. To be used for printing hashes in logs. NOTE: this has collision resistance as long there are roughly <= 10^9 units considered simultaneusly. NOTE: this uses only characters in the set A-Z, 2-7 (base32 encoding)