aergo.herapy.utils package

Submodules

aergo.herapy.utils.converter module

Common utility module for converting types.

aergo.herapy.utils.converter.bigint_to_bytes(v: int) → bytes[source]
aergo.herapy.utils.converter.bytes_to_int_str(v)[source]
aergo.herapy.utils.converter.bytes_to_public_key(v, curve=SECP256k1)[source]
aergo.herapy.utils.converter.convert_aergo_conf_to_toml(aergo_conf: aergo.herapy.obj.aergo_conf.AergoConfig) → str[source]
aergo.herapy.utils.converter.convert_bigint_to_bytes(number: int) → bytes[source]
aergo.herapy.utils.converter.convert_bytes_to_hex_str(v)[source]
aergo.herapy.utils.converter.convert_bytes_to_int_str(v)[source]
aergo.herapy.utils.converter.convert_bytes_to_public_key(v: bytes, curve: ecdsa.curves.Curve = SECP256k1) → ecdsa.ecdsa.Public_key[source]
aergo.herapy.utils.converter.convert_ip_bytes_to_str(ip)[source]
aergo.herapy.utils.converter.convert_public_key_to_bytes(pubkey, curve=SECP256k1, compressed=True) → bytes[source]
aergo.herapy.utils.converter.convert_toml_to_aergo_conf(v: str) → aergo.herapy.obj.aergo_conf.AergoConfig[source]
aergo.herapy.utils.converter.convert_tx_to_formatted_json(tx)[source]
aergo.herapy.utils.converter.convert_tx_to_grpc_tx(tx)[source]
aergo.herapy.utils.converter.convert_tx_to_json(tx)[source]
aergo.herapy.utils.converter.get_hash(*strings, no_rand: bool = False, no_encode: bool = False) → Union[str, bytes, None][source]
aergo.herapy.utils.converter.privkey_to_address(privkey: bytes, curve: ecdsa.curves.Curve = SECP256k1, compressed: bool = True) → str[source]
aergo.herapy.utils.converter.public_key_to_bytes(pubkey, curve=SECP256k1, compressed=True)[source]
aergo.herapy.utils.converter.tx_to_formatted_json(v)[source]
aergo.herapy.utils.converter.tx_to_grpc_tx(v)[source]
aergo.herapy.utils.converter.tx_to_json(v)[source]

aergo.herapy.utils.encoding module

aergo.herapy.utils.encoding.decode_address(address: str) → bytes[source]
aergo.herapy.utils.encoding.decode_b58(v: Union[str, bytes, None]) → Optional[bytes][source]
aergo.herapy.utils.encoding.decode_b58_check(v: Union[str, bytes, None]) → Optional[bytes][source]
aergo.herapy.utils.encoding.decode_b64(v)[source]
aergo.herapy.utils.encoding.decode_block_hash(block_hash: str) → Optional[bytes][source]
aergo.herapy.utils.encoding.decode_payload(payload_str)[source]
aergo.herapy.utils.encoding.decode_private_key(private_key: Optional[str]) → Optional[bytes][source]
aergo.herapy.utils.encoding.decode_public_key(public_key, curve=SECP256k1)[source]
aergo.herapy.utils.encoding.decode_root(root: Union[str, bytes, None]) → Optional[bytes][source]
aergo.herapy.utils.encoding.decode_signature(sign: Optional[str]) → Optional[bytes][source]
aergo.herapy.utils.encoding.decode_tx_hash(tx_hash: Union[str, bytes, None]) → Optional[bytes][source]
aergo.herapy.utils.encoding.encode_address(address: bytes) → str[source]
aergo.herapy.utils.encoding.encode_b58(v: Union[str, bytes, None]) → Optional[str][source]
aergo.herapy.utils.encoding.encode_b58_check(v: Union[str, bytes, None]) → Optional[str][source]
aergo.herapy.utils.encoding.encode_b64(v)[source]
aergo.herapy.utils.encoding.encode_block_hash(block_hash: bytes) → Optional[str][source]
aergo.herapy.utils.encoding.encode_payload(payload: Union[str, bytes, None]) → Optional[str][source]
aergo.herapy.utils.encoding.encode_private_key(private_key: bytes) → Optional[str][source]
aergo.herapy.utils.encoding.encode_signature(sign: Optional[bytes]) → Optional[str][source]
aergo.herapy.utils.encoding.encode_tx_hash(tx_hash: Optional[bytes]) → Optional[str][source]
aergo.herapy.utils.encoding.is_empty(v: Union[str, bytes, None]) → bool[source]

aergo.herapy.utils.merkle_proof module

aergo.herapy.utils.merkle_proof.bit_is_set(bits: bytes, i: int) → bool[source]
aergo.herapy.utils.merkle_proof.verify_exclusion(root: bytes, ap: List[bytes], key: bytes, proofKey: bytes, proofVal: bytes) → bool[source]

verify_exclusion verifies the merkle proof that a default node (bytes([0]) is included on the path of the ‘key’, or that the proofKey/proofVal key pair is included on the path of the ‘key’

aergo.herapy.utils.merkle_proof.verify_exclusion_c(root: bytes, ap: List[bytes], length: int, bitmap: bytes, key: bytes, proofKey: bytes, proofVal: bytes) → bool[source]

verify_exclusion_c verifies the compressed merkle proof that a default node (bytes([0]) is included on the path of the ‘key’, or that the proofKey/proofVal key pair is included on the path of the ‘key’

aergo.herapy.utils.merkle_proof.verify_inclusion(ap: List[bytes], root: bytes, key: bytes, value: bytes) → bool[source]

verify_inclusion verifies the merkle proof ‘ap’ (audit path) that the key/value pair in included in the trie with root ‘root’.

aergo.herapy.utils.merkle_proof.verify_inclusion_c(ap: List[bytes], height: int, bitmap: bytes, root: bytes, key: bytes, value: bytes) → bool[source]

verify_inclusion verifies the compressed merkle proof ‘ap’ (audit path) that the key/value pair in included in the trie with root ‘root’.

aergo.herapy.utils.merkle_proof.verify_proof(ap: List[bytes], key_index: int, key: bytes, leaf_hash: bytes) → bytes[source]

verify_proof recursively hashes the result with the proof nodes in the audit path ‘ap’

aergo.herapy.utils.merkle_proof.verify_proof_c(bitmap: bytes, key: bytes, leaf_hash: bytes, ap: List[bytes], length: int, key_index: int, ap_index: int) → bytes[source]

verify_proof_c recursively hashes the result with the proof nodes in the compressed audit path ‘ap’

aergo.herapy.utils.signature module

aergo.herapy.utils.signature.canonicalize_int(n, order)[source]
aergo.herapy.utils.signature.deserialize_sig(sig)[source]
aergo.herapy.utils.signature.serialize_sig(r, s, order) → bytes[source]
aergo.herapy.utils.signature.uncompress_key(compressed_key_hex)[source]

base source : https://stackoverflow.com/questions/43629265/deriving-an- ecdsa-uncompressed-public-key-from-a-compressed-one?rq=1 The code from bitcointalk sometimes produces a hex string uncompressed key of uneven length.

aergo.herapy.utils.signature.verify_sig(msg, sig, address)[source]

Verify that the signature ‘sig’ of the message ‘msg’ was made by ‘address’)

Module contents