bittensor.utils.wallet_utils#

Functions#

get_ss58_format(ss58_address)

Returns the ss58 format of the given ss58 address.

is_valid_ss58_address(address)

Checks if the given address is a valid ss58 address.

is_valid_ed25519_pubkey(public_key)

Checks if the given public_key is a valid ed25519 key.

is_valid_bittensor_address_or_public_key(address)

Checks if the given address is a valid destination address.

create_identity_dict([display, legal, web, riot, ...])

Creates a dictionary with structure for identity extrinsic. Must fit within 64 bits.

decode_hex_identity_dict(info_dictionary)

Module Contents#

bittensor.utils.wallet_utils.get_ss58_format(ss58_address)[source]#

Returns the ss58 format of the given ss58 address.

Parameters:

ss58_address (str)

Return type:

int

bittensor.utils.wallet_utils.is_valid_ss58_address(address)[source]#

Checks if the given address is a valid ss58 address.

Parameters:

address (str) – The address to check.

Returns:

True if the address is a valid ss58 address for Bittensor, False otherwise.

Return type:

bool

bittensor.utils.wallet_utils.is_valid_ed25519_pubkey(public_key)[source]#

Checks if the given public_key is a valid ed25519 key.

Parameters:

public_key (Union[str, bytes]) – The public_key to check.

Returns:

True if the public_key is a valid ed25519 key, False otherwise.

Return type:

bool

bittensor.utils.wallet_utils.is_valid_bittensor_address_or_public_key(address)[source]#

Checks if the given address is a valid destination address.

Parameters:

address (Union[str, bytes]) – The address to check.

Returns:

True if the address is a valid destination address, False otherwise.

Return type:

bool

bittensor.utils.wallet_utils.create_identity_dict(display='', legal='', web='', riot='', email='', pgp_fingerprint=None, image='', info='', twitter='')[source]#

Creates a dictionary with structure for identity extrinsic. Must fit within 64 bits.

Parameters:
  • display (str) – String to be converted and stored under ‘display’.

  • legal (str) – String to be converted and stored under ‘legal’.

  • web (str) – String to be converted and stored under ‘web’.

  • riot (str) – String to be converted and stored under ‘riot’.

  • email (str) – String to be converted and stored under ‘email’.

  • pgp_fingerprint (str) – String to be converted and stored under ‘pgp_fingerprint’.

  • image (str) – String to be converted and stored under ‘image’.

  • info (str) – String to be converted and stored under ‘info’.

  • twitter (str) – String to be converted and stored under ‘twitter’.

Returns:

A dictionary with the specified structure and byte string conversions.

Return type:

dict

Raises: ValueError: If pgp_fingerprint is not exactly 20 bytes long when encoded.

bittensor.utils.wallet_utils.decode_hex_identity_dict(info_dictionary)[source]#