symbolchain.symbol package

Submodules

symbolchain.symbol.IdGenerator module

symbolchain.symbol.IdGenerator.generate_mosaic_alias_id(fully_qualified_name)

Generates a mosaic id from a fully qualified mosaic alias name.

symbolchain.symbol.IdGenerator.generate_mosaic_id(owner_address, nonce)

Generates a mosaic id from an owner address and a nonce.

symbolchain.symbol.IdGenerator.generate_namespace_id(name, parent_namespace_id=0)

Generates a namespace id from a name and an optional parent namespace id.

symbolchain.symbol.IdGenerator.generate_namespace_path(fully_qualified_name)

Parses a fully qualified namespace name into a path.

symbolchain.symbol.IdGenerator.is_valid_namespace_name(name)

Returns true if a name is a valid namespace name.

symbolchain.symbol.KeyPair module

class symbolchain.symbol.KeyPair.KeyPair(private_key)

Bases: object

Represents an ED25519 private and public key.

property private_key

Gets the private key.

property public_key

Gets the public key.

sign(message)

Signs a message with the private key.

class symbolchain.symbol.KeyPair.Verifier(public_key)

Bases: object

Verifies signatures signed by a single key pair.

verify(message, signature)

Verifies a message signature.

symbolchain.symbol.Merkle module

class symbolchain.symbol.Merkle.BranchNode(path, links)

Bases: TreeNode

Branch node in a compact patricia tree.

calculate_hash()

Calculates node hash.

class symbolchain.symbol.Merkle.LeafNode(path, value)

Bases: TreeNode

Leaf node in a compact patricia tree.

calculate_hash()

Calculates node hash.

class symbolchain.symbol.Merkle.MerkleHashBuilder

Bases: object

Builder for creating a merkle hash.

final()

Calculates the merkle hash.

update(component_hash)

Adds a hash to the merkle hash.

class symbolchain.symbol.Merkle.MerklePart(hash, is_left)

Bases: tuple

hash

Alias for field number 0

is_left

Alias for field number 1

class symbolchain.symbol.Merkle.PatriciaMerkleProofResult(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Possible results of a patricia merkle proof.

INCONCLUSIVE = 16385
LEAF_VALUE_MISMATCH = 32771
PATH_MISMATCH = 32773
STATE_HASH_DOES_NOT_MATCH_ROOTS = 32769
UNANCHORED_PATH_TREE = 32770
UNLINKED_NODE = 32772
VALID_NEGATIVE = 2
VALID_POSITIVE = 1
class symbolchain.symbol.Merkle.PatriciaTreePath(path, size)

Bases: tuple

path

Alias for field number 0

size

Alias for field number 1

class symbolchain.symbol.Merkle.TreeNode(path)

Bases: object

Node in a compact patricia tree.

property hex_path

Gets hex representation of path.

symbolchain.symbol.Merkle.deserialize_patricia_tree_nodes(buffer)
symbolchain.symbol.Merkle.prove_merkle(leaf_hash, merkle_path, root_hash)

Proves a merkle hash. Merkle hash chain path is ordered from leaf to root, where each element is MerklePart.

symbolchain.symbol.Merkle.prove_patricia_merkle(encoded_key, value_to_test, merkle_path, state_hash, subcache_merkle_roots)

Proves a patricia merkle hash. Merkle node path is ordered from root to leaf, where each element is either BranchNode or LeafNode.

symbolchain.symbol.MessageEncoder module

class symbolchain.symbol.MessageEncoder.MessageEncoder(key_pair: KeyPair)

Bases: object

Encrypts and encodes messages between two parties.

encode(recipient_public_key: PublicKey, message: bytes)

Encodes message to recipient using recommended format.

encode_deprecated(recipient_public_key: PublicKey, message: bytes)

Encodes message to recipient using (deprecated) wallet format.

static encode_persistent_harvesting_delegation(node_public_key, remote_key_pair, vrf_root_key_pair)

Encodes persistent harvesting delegation to node.

property public_key

Public key used for message encoding.

try_decode(recipient_public_key, encoded_message)

Tries to decode encoded message, returns tuple: * True, message - if message has been decoded and decrypted * False, encoded_message - otherwise

try_decode_deprecated(recipient_public_key, encoded_message)

Tries to decode encoded wallet message, returns tuple: * True, message - if message has been decoded and decrypted * False, encoded_message - otherwise

symbolchain.symbol.Metadata module

symbolchain.symbol.Metadata.metadata_generate_key(seed)

Generates a metadata key from a string.

symbolchain.symbol.Metadata.metadata_update_value(old_value, new_value)

Creates a metadata payload for updating old value to new value.

symbolchain.symbol.Network module

class symbolchain.symbol.Network.Address(address)

Bases: ByteArray

Represents a Symbol address.

ENCODED_SIZE = 39
SIZE = 24
static from_decoded_address_hex_string(hex_string)

Creates an address from a decoded address hex string (typically from REST).

static from_namespace_id(namespace_id, network_identifier)

Creates an address from a namespace id.

to_namespace_id()

Attempts to convert this address into a namespace id.

class symbolchain.symbol.Network.Network(name, identifier, epoch_time, generation_hash_seed=None)

Bases: Network

Represents a Symbol network.

MAINNET = <symbolchain.symbol.Network.Network object>
NETWORKS = [<symbolchain.symbol.Network.Network object>, <symbolchain.symbol.Network.Network object>]
TESTNET = <symbolchain.symbol.Network.Network object>
address_hasher()

Gets the primary hasher to use in the public key to address conversion.

create_address(address_without_checksum, checksum)

Creates an encoded address from an address without checksum and checksum bytes.

class symbolchain.symbol.Network.NetworkTimestamp(timestamp)

Bases: NetworkTimestamp

Represents a symbol network timestamp with millisecond resolution.

add_milliseconds(count)

Adds a specified number of milliseconds to this timestamp.

add_seconds(count)

Adds a specified number of seconds to this timestamp.

symbolchain.symbol.SharedKey module

class symbolchain.symbol.SharedKey.SharedKey

Bases: SharedKey

static derive_shared_key(key_pair, other_public_key)

Derives shared encryption key from private key and public key.

symbolchain.symbol.TransactionFactory module

class symbolchain.symbol.TransactionFactory.TransactionFactory(network, type_rule_overrides=None)

Bases: object

Factory for creating Symbol transactions.

static attach_signature(transaction, signature)

Attaches a signature to a transaction.

create(transaction_descriptor, autosort=True)

Creates a transaction from a transaction descriptor. When autosort is set (default), descriptor arrays requiring ordering will be automatically sorted. When unset, descriptor arrays will be presumed to be already sorted.

create_embedded(transaction_descriptor, autosort=True)

Creates an embedded transaction from a transaction descriptor. When autosort is set (default), descriptor arrays requiring ordering will be automatically sorted. When unset, descriptor arrays will be presumed to be already sorted.

static deserialize(payload)

Deserializes a transaction from a binary payload.

static deserialize_embedded(payload)

Deserializes an embedded transaction from a binary payload.

static lookup_transaction_name(transaction_type, transaction_version)

Looks up the friendly name for the specified transaction.

symbolchain.symbol.VotingKeysGenerator module

class symbolchain.symbol.VotingKeysGenerator.VotingKeysGenerator(root_key_pair, private_key_generator=<function PrivateKey.random>)

Bases: object

Generates symbol voting keys.

generate(start_epoch, end_epoch)

Generates voting keys for specified epochs.

Module contents