symbolchain package

Subpackages

Submodules

symbolchain.AccountDescriptorRepository module

class symbolchain.AccountDescriptorRepository.AccountDescriptor(descriptor_yaml)

Bases: object

Represents an account.

class symbolchain.AccountDescriptorRepository.AccountDescriptorRepository(yaml_input)

Bases: object

Loads read-only account descriptors from YAML.

find_all_by_role(role)

Finds all account descriptors with a matching role.

find_by_address(address)

Finds the account descriptor with a matching address.

find_by_public_key(public_key)

Finds the account descriptor with a matching public key.

to_type_parsing_rules_map(type_to_property_mapping)

Builds a type to parsing rule map.

try_find_by_name(name)

Finds the account descriptor with a matching name or None if no matching descriptors are found.

symbolchain.ArrayHelpers module

class symbolchain.ArrayHelpers.ArrayHelpers

Bases: object

static align_up(size, alignment)

Calculates aligned size.

static get_bytes(view, size)

Returns first size bytes of view.

static read_array(view, factory_class, accessor=None)

Reads array of objects.

static read_array_count(view, factory_class, count, accessor=None)

Reads array of deterministic number of objects.

static read_variable_size_elements(view, factory_class, alignment, skip_last_element_padding=False)

Reads array of variable size objects.

static size(elements, alignment=0, skip_last_element_padding=False)

Calculates size of variable size objects.

static write_array(elements, accessor=None)

Writes array of objects.

static write_array_count(elements, count, accessor=None)

Writes array of deterministic number of objects.

static write_variable_size_elements(elements, alignment, skip_last_element_padding=False)

Writes array of variable size objects.

symbolchain.ArrayHelpers.read_array_impl(view, factory_class, accessor, should_continue)
symbolchain.ArrayHelpers.write_array_impl(elements, count, accessor)

symbolchain.BaseValue module

class symbolchain.BaseValue.BaseValue(size, value, tag=None, signed=False)

Bases: Ordered

Represents a base int.

to_json()

Returns representation of this object that can be stored in JSON.

symbolchain.Bip32 module

class symbolchain.Bip32.Bip32(curve_name='ed25519', mnemonic_language='english')

Bases: object

Factory of BIP32 root nodes

from_mnemonic(mnemonic, password)

Creates a BIP32 root node from a BIP39 mnemonic and password.

from_seed(seed)

Creates a BIP32 root node from a seed.

random(seed_length=32)

Creates a random BIP32 mnemonic.

class symbolchain.Bip32.Bip32Node(hmac_key, data)

Bases: object

Representation of a BIP32 node.

derive_one(identifier)

Derives a direct child node with specified identifier.

derive_path(path)

Derives a descendent node with specified path.

symbolchain.BlockchainSettings module

class symbolchain.BlockchainSettings.BlockchainSettings(settings_dict)

Bases: object

Settings describing a blockchain.

static load_from_yaml(yaml_input)

Loads settings from YAML.

symbolchain.BufferReader module

class symbolchain.BufferReader.BufferReader(buffer, byte_order='little')

Bases: object

Reads data from an in memory buffer.

property eof

Returns true if the reader is at eof.

read_bytes(count)

Reads bytes.

read_hex_string(count)

Reads a hex string.

read_int(count)

Reads an integer.

read_string(count)

Reads a string.

symbolchain.BufferWriter module

class symbolchain.BufferWriter.BufferWriter(byte_order='little')

Bases: object

Writes data to an in memory buffer.

write_bytes(value)

Writes bytes.

write_hex_string(value)

Writes a hex string.

write_int(value, count)

Writes an integer.

write_string(value)

Writes a string.

symbolchain.ByteArray module

class symbolchain.ByteArray.ByteArray(fixed_size, array_input, tag=None)

Bases: Ordered

Represents a fixed size byte array.

to_json()

Returns representation of this object that can be stored in JSON.

symbolchain.Cipher module

class symbolchain.Cipher.AesCbcCipher(aes_key)

Bases: object

Performs AES CBC encryption and decryption with a given key.

decrypt(cipher_text, iv)

Decrypts cipher text.

encrypt(clear_text, iv)

Encrypts clear text.

class symbolchain.Cipher.AesGcmCipher(aes_key)

Bases: object

Performs AES GCM encryption and decryption with a given key.

TAG_SIZE = 16
decrypt(cipher_text, iv)

Decrypts cipher text with appended tag.

encrypt(clear_text, iv)

Encrypts clear text and appends tag to encrypted payload.

symbolchain.CodeWordsEncoder module

class symbolchain.CodeWordsEncoder.CodeWords(words)

Bases: object

Represents a group of words that encode some binary data.

class symbolchain.CodeWordsEncoder.CodeWordsEncoder(wordlist='english')

Bases: object

Encodes and decodes values using wordlists.

decode_int(code_words)

Decodes one or more code words into an integer.

encode_int(value)

Encodes an integer into one or more code words.

symbolchain.CryptoTypes module

class symbolchain.CryptoTypes.Hash256(hash256)

Bases: ByteArray

Represents a 256-bit hash.

SIZE = 32
static zero()

Creates a zeroed hash.

class symbolchain.CryptoTypes.PrivateKey(private_key)

Bases: ByteArray

Represents a private key.

SIZE = 32
static random()

Generates a random private key.

class symbolchain.CryptoTypes.PublicKey(public_key)

Bases: ByteArray

Represents a public key.

SIZE = 32
class symbolchain.CryptoTypes.SharedKey256(key)

Bases: ByteArray

Represents 256-bit symmetric encryption key.

SIZE = 32
class symbolchain.CryptoTypes.Signature(signature)

Bases: ByteArray

Represents a signature.

SIZE = 64
static zero()

Creates a zeroed signature.

symbolchain.DiceMnemonicGenerator module

class symbolchain.DiceMnemonicGenerator.DiceMnemonicGenerator(num_die_sides=6, mnemonic_language='english')

Bases: object

Generates BIP39 mnemonics from dice rolls.

add_roll(value)

Adds a roll.

frequencies()

Gets the number of times each number was rolled.

to_mnemonic(shrink_wrap=False)

Generates a mnemonic by hashing the roll input. Disabling shrink_wrap is the same method used by coldcard wallet.

symbolchain.Network module

class symbolchain.Network.Network(name, identifier, datetime_converter, address_class, network_timestamp_class)

Bases: object

Represents a network.

abstract address_hasher()

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

abstract create_address(address_without_checksum, checksum)

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

from_datetime(reference_datetime)

Converts a datetime to a network timestamp.

is_valid_address(address)

Checks if an address is valid and belongs to this network.

is_valid_address_string(address_string)

Checks if an address string is valid and belongs to this network.

public_key_to_address(public_key)

Converts a public key to an address.

to_datetime(reference_network_timestamp)

Converts a network timestamp to a datetime.

class symbolchain.Network.NetworkLocator

Bases: object

Provides utility functions for finding a network.

static find_by_identifier(networks, identifiers)

Finds a network with a specified identifier within a list of networks.

static find_by_name(networks, names)

Finds a network with a specified name within a list of networks.

symbolchain.NetworkTimestamp module

class symbolchain.NetworkTimestamp.NetworkTimestamp(timestamp)

Bases: object

Represents a network timestamp.

add_hours(count)

Adds a specified number of hours to this timestamp.

add_minutes(count)

Adds a specified number of minutes to this timestamp.

abstract add_seconds(count)

Adds a specified number of seconds to this timestamp.

property is_epochal

Determines if this is the epochal timestamp.

class symbolchain.NetworkTimestamp.NetworkTimestampDatetimeConverter(epoch, time_units)

Bases: object

Provides utilities for converting between network timestamps and datetimes.

to_datetime(raw_timestamp)

Converts a network timestamp to a datetime.

to_difference(reference_datetime)

Subtracts the network epoch from the reference date.

symbolchain.NodeDescriptorRepository module

class symbolchain.NodeDescriptorRepository.NodeDescriptor(descriptor_yaml)

Bases: object

Represents a node.

class symbolchain.NodeDescriptorRepository.NodeDescriptorRepository(yaml_input)

Bases: object

Loads read-only node descriptors from YAML.

find_all_by_role(role)

Finds all node descriptors with a matching role.

find_all_not_by_role(role)

Finds all node descriptors without a matching role.

symbolchain.Ordered module

class symbolchain.Ordered.Ordered

Bases: ABC

symbolchain.PrivateKeyStorage module

class symbolchain.PrivateKeyStorage.PrivateKeyStorage(directory, password=None)

Bases: object

Loads and saves private keys as PEM files with optional encryption in a directory.

load(name)

Loads a private key with the specified name.

save(name, private_key)

Saves a private key with the specified name.

symbolchain.QrSignatureStorage module

class symbolchain.QrSignatureStorage.QrSignatureStorage(directory)

Bases: object

Loads and saves signatures as QR codes in a directory.

load(name)

Loads a transaction hash along with attesting signatures.

save(name, transaction_hash, signatures)

Saves a transaction hash along with attesting signatures.

symbolchain.QrStorage module

class symbolchain.QrStorage.QrStorage(directory)

Bases: object

Loads and saves binary data as QR codes in a directory.

load(name)

Loads a buffer.

save(name, buffer)

Saves a buffer.

symbolchain.RuleBasedTransactionFactory module

class symbolchain.RuleBasedTransactionFactory.RuleBasedTransactionFactory(module, type_converter=None, type_rule_overrides=None)

Bases: object

Rule based transaction factory.

add_array_parser(name)

Creates array type parser, based on some existing element type parser.

add_enum_parser(name)

Creates enum type parser.

add_flags_parser(name)

Creates flag type parser.

add_pod_parser(name, pod_class)

Creates wrapper for SDK POD types.

add_struct_parser(name)

Creates struct parser (to allow nested parsing).

autodetect()

Autodetects rules using reflection.

create_from_factory(factory, descriptor)

Creates an entity from a descriptor using a factory.

symbolchain.SharedKey module

class symbolchain.SharedKey.SharedKey

Bases: object

symbolchain.TransactionDescriptorProcessor module

class symbolchain.TransactionDescriptorProcessor.TransactionDescriptorProcessor(transaction_descriptor, type_parsing_rules, type_converter=None)

Bases: object

Processes and looks up transaction descriptor properties.

copy_to(transaction, ignore_keys=None)

Copies all descriptor information to a transaction.

lookup_value(key)

Looks up the value for key.

set_type_hints(type_hints)

Sets type hints.

symbolchain.Transforms module

symbolchain.Transforms.ripemd_keccak_256(payload)

Hashes payload with keccak 256 and then hashes the result with ripemd160.

symbolchain.ripemd160 module

symbolchain.ripemd160.ripemd160(data)

Calculates RIPEMD-160 hash of data.

Module contents