Skip to main content

No project description provided

Project description

TON Address Converter

PyPI Downloads Python Versions OS Support

A Python library for bulk converting TON blockchain addresses between raw and user-friendly formats. Written in Rust with parallel processing capabilities, this library is particularly useful when working with large batches of addresses from block explorers or blockchain data.

Why This Library?

When working with TON blockchain data (especially when processing blocks), addresses typically come in raw format but need to be displayed in user-friendly format for end users. This library was created to:

  • Handle bulk address conversions efficiently
  • Provide parallel processing for large datasets
  • Maintain accuracy while optimizing performance
  • Offer a simple, Pythonic API

Performance

Our benchmarks show the following performance characteristics when compared to existing solutions:

Number of Addresses ton_address_converter pytoniq tonpy vs pytoniq vs tonpy
100 0.0018s 0.0006s 0.0001s 0.32x 0.07x
1,000 0.0092s 0.0055s 0.0011s 0.60x 0.12x
10,000 0.0202s 0.0601s 0.0110s 2.98x 0.55x
100,000 0.1569s 0.5455s 0.1164s 3.48x 0.74x

Benchmark Environment

  • intel i9 9900k
  • Python 3.12.3
  • pytoniq-core==0.1.40
  • tonsdk==1.0.15

Performance Analysis

  • For small batches (<1,000 addresses), tonpy and pytoniq perform better due to lower overhead
  • For larger batches (>10,000 addresses), ton_address_converter shows significant speedup:
    • Up to 3.48x faster than pytoniq
    • Competitive performance with tonpy
  • Best suited for bulk operations where parallel processing benefits can be realized

Installation

pip install ton_address_converter

Usage

from ton_address_converter import batch_convert_to_friendly, batch_convert_to_raw

# Convert raw addresses to user-friendly format
raw_addresses = [
    "0:73f17af370bd9d1f754be87a8a2d46f178aa72a9fc26f8ed9305977313f5dd29",
    # ... more addresses
]
friendly_addresses = batch_convert_to_friendly(
    raw_addresses,
    bounceable=True,    # Optional, default: False
    test_only=False,    # Optional, default: False
    url_safe=True,      # Optional, default: True
    chunk_size=1000     # Optional, default: 1000
)

# Convert friendly addresses back to raw format
raw_addresses = batch_convert_to_raw(
    friendly_addresses,
    chunk_size=1000     # Optional, default: 1000
)

Common Use Cases

  1. Processing block explorer data:
# Convert multiple raw addresses from block data
block_addresses = [tx['address'] for tx in block_transactions]
friendly_addresses = batch_convert_to_friendly(block_addresses)
  1. Converting user-input addresses:
# Convert user-friendly addresses to raw format for blockchain operations
user_addresses = ["EQBz8XrzcL2dH3VL6HqKLUbxeKpyqfwm-O2TBZdzE_XdKTXc"]
raw_addresses = batch_convert_to_raw(user_addresses)

Options

batch_convert_to_friendly

  • addresses: List of raw addresses to convert
  • bounceable: Whether to generate bounceable addresses (default: False)
  • test_only: Whether to generate testnet addresses (default: False)
  • url_safe: Whether to use URL-safe base64 encoding (default: True)
  • chunk_size: Size of chunks for parallel processing (default: 1000)

batch_convert_to_raw

  • addresses: List of friendly addresses to convert
  • chunk_size: Size of chunks for parallel processing (default: 1000)

Development

Requirements

  • Python 3.9+
  • Rust (latest stable)
  • maturin

Building from source

# Clone the repository
git clone https://github.com/your_username/ton_address_converter
cd ton_address_converter

# Create a virtual environment
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install development dependencies
pip install maturin pytest

# Build and install in development mode
maturin develop

# Run tests
pytest

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

ton_address_converter-0.1.0.tar.gz (17.5 kB view details)

Uploaded Source

Built Distributions

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

ton_address_converter-0.1.0-cp312-cp312-win_amd64.whl (165.8 kB view details)

Uploaded CPython 3.12Windows x86-64

ton_address_converter-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl (318.2 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

ton_address_converter-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (284.1 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

ton_address_converter-0.1.0-cp312-cp312-macosx_11_0_arm64.whl (276.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

ton_address_converter-0.1.0-cp311-cp311-win_amd64.whl (165.7 kB view details)

Uploaded CPython 3.11Windows x86-64

ton_address_converter-0.1.0-cp311-cp311-manylinux_2_34_x86_64.whl (318.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

ton_address_converter-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (284.1 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

ton_address_converter-0.1.0-cp311-cp311-macosx_11_0_arm64.whl (276.9 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

ton_address_converter-0.1.0-cp310-cp310-win_amd64.whl (165.7 kB view details)

Uploaded CPython 3.10Windows x86-64

ton_address_converter-0.1.0-cp310-cp310-manylinux_2_34_x86_64.whl (318.1 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

ton_address_converter-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (284.1 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

ton_address_converter-0.1.0-cp310-cp310-macosx_11_0_arm64.whl (276.9 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

ton_address_converter-0.1.0-cp39-cp39-win_amd64.whl (165.9 kB view details)

Uploaded CPython 3.9Windows x86-64

ton_address_converter-0.1.0-cp39-cp39-manylinux_2_34_x86_64.whl (318.0 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.34+ x86-64

ton_address_converter-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (284.1 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

ton_address_converter-0.1.0-cp39-cp39-macosx_11_0_arm64.whl (276.8 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

Details for the file ton_address_converter-0.1.0.tar.gz.

File metadata

  • Download URL: ton_address_converter-0.1.0.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.20

File hashes

Hashes for ton_address_converter-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a4b63a1550cad1723ccfd303813d59cec08338e71fd8c848e499df8fca9f81fe
MD5 f2d0c9206043408f2be4caa92f74c347
BLAKE2b-256 66ed3fcc5712892ce44c643bd2265816ae374390541404c0853e9e679ede1f43

See more details on using hashes here.

File details

Details for the file ton_address_converter-0.1.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for ton_address_converter-0.1.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 dfb47a749f485d4b23c9df0f1b5eb58a7637b19987dcc16fd6a4f5a38debba5a
MD5 5e97a0ed6b34c74bfbcfbbfd009f20c2
BLAKE2b-256 24d1a7ac39767e61c2a861cddd009273d9f1dcdb78425bb47bf26f1096f38dc7

See more details on using hashes here.

File details

Details for the file ton_address_converter-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for ton_address_converter-0.1.0-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 554c6e2c42b455407ae99ab42901a7237f9934dfac1fed04e0110f24a636f980
MD5 3e80956e74bec076ff849d1bc2a2dbae
BLAKE2b-256 c47e94878824e2003a130cbc5c833aaeef3989614baf1cecaa2f5cbd9a6938a0

See more details on using hashes here.

File details

Details for the file ton_address_converter-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ton_address_converter-0.1.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9bb3efffede8ecfce3a4f2e50a0db257645428c658324aa54aa9bda1437f12df
MD5 532d61b6ed1caee43bdad5ca29bf01c9
BLAKE2b-256 9cd65632de3b544d130857dfe4320290d44ed0ec0b755cbe4534527b4a021b04

See more details on using hashes here.

File details

Details for the file ton_address_converter-0.1.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ton_address_converter-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6e2ef9097480461cb111e18b3b707252c744bf95e2a6c616f99567efd3c5132a
MD5 f0de510b2e39b8ba175e006c2b9e59d3
BLAKE2b-256 9d29a115997507e5b42a5b1845e9d708015a08a8c996da2f16ffcc0b3cc88d18

See more details on using hashes here.

File details

Details for the file ton_address_converter-0.1.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for ton_address_converter-0.1.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 27fe2883bdf1bcb9cf7c5b343ab096d1893aff003ad5676c80ef998d6ffd1120
MD5 35fa5fc82950bf061e85b7df580a01a1
BLAKE2b-256 a0d29e731a8a57db508e528515e1596f8d5392b547f566f48e533e3ea2d547ff

See more details on using hashes here.

File details

Details for the file ton_address_converter-0.1.0-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for ton_address_converter-0.1.0-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 79c2c91aa3d51cff238c6bce186baccad9f4dae0ee07bd434dd6d1a6a1241d2a
MD5 f8d0d49268df53f744a8495f7477b893
BLAKE2b-256 b346695866c3705e8284f9ad2d67840c71dd5dc895a1db8b8bc36d55378174e8

See more details on using hashes here.

File details

Details for the file ton_address_converter-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ton_address_converter-0.1.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fe68352fb1b07fb850fbc6f36a2bfc7553ee8ad88c49c2369ee21e3ba628246b
MD5 0b83a9fbdbce619a8731611e779816c5
BLAKE2b-256 fb76f28ac0203e29b5b41c1bd0a288c557d433c21dd95f82208f26eb047b9d75

See more details on using hashes here.

File details

Details for the file ton_address_converter-0.1.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ton_address_converter-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b1af55f8535fca6495a2d0b096ed2016552c454863e650aae7ac41217974e378
MD5 278ce2d19fe136bbe4ddf4a557b2d37d
BLAKE2b-256 0352c39950a8e619775b121dfc5db78b3d43d354e81e3204bd5c9c704bf0b130

See more details on using hashes here.

File details

Details for the file ton_address_converter-0.1.0-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for ton_address_converter-0.1.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 79b6adbb7d6bfc7ab7b12fef5c0be787d291fdcb6804a063e887f2fbdb03360b
MD5 ada628f3e946edfee278cdfa417e73ac
BLAKE2b-256 28a8d42e5e1e596fa04a294797ac045d9321d6936774f6ece39ead54dc01ab04

See more details on using hashes here.

File details

Details for the file ton_address_converter-0.1.0-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for ton_address_converter-0.1.0-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 775e1efca27c91e8135ddfb60da02cc1bd64674c1e4d9b6bf59a28bdcd19a861
MD5 5a06cec462d0485b3776b158e77d3b5b
BLAKE2b-256 aa955adf1439fda834e3d2e0cb6f120e70d6d815a03cf6fe0191041b2a3876d8

See more details on using hashes here.

File details

Details for the file ton_address_converter-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ton_address_converter-0.1.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 26486908e6a41e609eb9b679601fadd9870f0aec69c7355f2b4ac15d1133e73e
MD5 f054ff0c3d58688a175f70b88b524f05
BLAKE2b-256 c039d001af34d9b2054c5ace2e46f5b9a3489a61080d0e256d855e2664e98124

See more details on using hashes here.

File details

Details for the file ton_address_converter-0.1.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ton_address_converter-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 faae275aa25d200429304bc7119010aaf359e62a04054fa7f3aa60bb751547f3
MD5 c8519a9fbbd2eafe6d2e50310c7af756
BLAKE2b-256 b365535c9db4c02599087278aa498406e85c1df773ba3eca76dacf61f7918a38

See more details on using hashes here.

File details

Details for the file ton_address_converter-0.1.0-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for ton_address_converter-0.1.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 e1e6084bb4d2f64117b9b75e5e74c8240f9d0881a9eff0275916657b01ae4a0b
MD5 ed458a296f5c0beb1f0a34fd3a051448
BLAKE2b-256 a0b317608ee81a8774d8a0913bdd132e1b538f6ff614813ec57d4b7ad68c73e8

See more details on using hashes here.

File details

Details for the file ton_address_converter-0.1.0-cp39-cp39-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for ton_address_converter-0.1.0-cp39-cp39-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 6250a0cf6869a60b17c8dba693987c4a1bdd40d85c318427ed5f1f6d77522552
MD5 e63af57aefc007bb32fe12a5c287a7dc
BLAKE2b-256 d1180540411fe0b9e1010c7cc6ad03f07c22bb7d64edae0cbdf4ea85631d17af

See more details on using hashes here.

File details

Details for the file ton_address_converter-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ton_address_converter-0.1.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a2b6cd212664b75cd6dc2fd10cd6768c30896f3e35658e9a36d64359f0cf5898
MD5 e4d90c4a5e7e050f6bba03e61241f8ba
BLAKE2b-256 bf5fddd111c36596727ddd68e885486783794ce6e0c62b81faeaa2c42da531a0

See more details on using hashes here.

File details

Details for the file ton_address_converter-0.1.0-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ton_address_converter-0.1.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0d8ca65e19e83d4d162827f1573095f60107e0588aa08c325bd2bd758fce73f7
MD5 234e296f20beebf8fd5dc54241bcf29c
BLAKE2b-256 08fe52aba52595939fd21c2df27c0238f0e3315a0e3e12fe6ff720bb3500739f

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