Skip to main content

This library provides functions for encoding and decoding keyless addresses, used by the TRAIT blockchain: application agent addresses, transactional addresses, and named addresses.

Project description

Keyless Addresses Python Library

This Python library provides functionality for encoding and decoding keyless addresses.

A keyless address is a type of address that doesn't rely on cryptographic key pairs for identification. Instead, it is derived from a combination of identifiers and checksums, making it suitable for various use cases such as tracking and verification.

Installation

You can install the library using pip:

pip install traitkeyless

Usage

Encode and Decode AppAgent Addresses

import traitkeyless

app_agent_id = 123

# Encode an AppAgent address
encoded_address = traitkeyless.encode_app_agent_address(app_agent_id)
assert encoded_address == "ttowKp8AmQuGfbBGikG2pbdYNnErhHRaLrdktJeZEfJVeVnTp"

# Decode the AppAgent address
decoded_app_agent_id = traitkeyless.decode_app_agent_address(encoded_address)
assert decoded_app_agent_id == 123

Encode and Decode Transactional Addresses

import traitkeyless

app_agent_id = 123
transactional_address_id = 456

# Encode a Transactional address
encoded_address = traitkeyless.encode_transactional_address(app_agent_id, transactional_address_id)
assert encoded_address == "ttowKp8AmjjQh4GoN7xMiQWwVyyrU1Pu7GRf5HxFmV5t43TXG"

# Decode the Transactional address
decoded_data = traitkeyless.decode_transactional_address(encoded_address)
assert decoded_data == (123, 456)

Encode and Decode Named Addresses

import traitkeyless

app_agent_id = 123
address_name = "hot-wallet"

# Encode a Named address
encoded_address = traitkeyless.encode_named_address(app_agent_id, address_name)
assert encoded_address == "ttowKp8Ams1q53N3APEt8PQi8hJ57WjQ92KQTtJrY574nomqv"

# Decode the Named address
decoded_data = traitkeyless.decode_named_address(encoded_address)
assert decoded_data == (123, "hot-wallet")

Decode any address

import traitkeyless

app_agent_id = 123

# Encode a Named address
encoded_address = traitkeyless.encode_app_agent_address(app_agent_id)
assert encoded_address == "ttowKp8AmQuGfbBGikG2pbdYNnErhHRaLrdktJeZEfJVeVnTp"

# Decode the Named address
decoded_data = traitkeyless.decode_address(encoded_address)
expected_data = traitkeyless.BlockchainAddressInfo(
    address=encoded_address,
    account_id="0x7b00000001293833058fc7db52fc03f6ce344bca98bd7825ff747743f1ff63e2",
    address_type=traitkeyless.AddressType.AppAgent,
    app_agent_id=123,
    ta_id=None,
    address_name=None,
)
assert decoded_data == expected_data

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

traitkeyless-0.1.2.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

traitkeyless-0.1.2-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file traitkeyless-0.1.2.tar.gz.

File metadata

  • Download URL: traitkeyless-0.1.2.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for traitkeyless-0.1.2.tar.gz
Algorithm Hash digest
SHA256 c1b2e92991255d35b05d37e211fe23c7350ef3dbe59fee80786914e777566033
MD5 595e20798e0b169a9c76687798fed030
BLAKE2b-256 5b5b7674934bafc54fcc9b59b9e24dbaaa18839dd3bf068ab627162536a10ec8

See more details on using hashes here.

File details

Details for the file traitkeyless-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: traitkeyless-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for traitkeyless-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2938e46df3616d86224306c3ce10e2609d299565c878929e7dcc9b351598bfc1
MD5 9e1fc708829bd0db89e81a059359eaa2
BLAKE2b-256 7024a3d88f284022d6e1c7017ae35bffd681913169a9c9d62d470f28c4baa5b7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page