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 == "ttowKp8AmRn9nxt8Gcout4stYQem7TZNkhpnVmtpS5KG39m2Y"

# 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 == "ttowKp8AmjjQh4HoMJwdKPyEQS5HSXQHwBUrLbn2LJFopLG85"

# 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 = "example123"

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

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

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 == "ttowKp8AmRn9nxt8Gcout4stYQem7TZNkhpnVmtpS5KG39m2Y"

# Decode the Named address
decoded_data = traitkeyless.decode_address(encoded_address)
expected_data = traitkeyless.BlockchainAddressInfo(
    address=encoded_address,
    account_id="0x7b000000013c8b3aeb6b293833058fc7db52fc03f6ce344bca98bd7825ff7477",
    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.1.tar.gz (9.9 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.1-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: traitkeyless-0.1.1.tar.gz
  • Upload date:
  • Size: 9.9 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.1.tar.gz
Algorithm Hash digest
SHA256 b5919a76844b2148e997e0cc6703fe39d7b96bc4c8d828ec7ae8b24c720145f3
MD5 7be0e922439142aa29dd950df558e7b6
BLAKE2b-256 b1fc3f0725c42543954c4b0eea42e772604d1257c160689d270f001bb297ac3d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: traitkeyless-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.2 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a3c79eaae645d55c31e6881297dc4d512cc6cd6188b67a707f79ca20aa1553fd
MD5 c974addc74dc1399a911e5018e27b341
BLAKE2b-256 750983fc281004c1672914fb14f89c15f01eb9a1450f14313ec101d736b2f0bb

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