Metadata-Version: 2.5
Name: trontxsize
Version: 1.3.0
Summary: Calculate tron transaction size (bandwidth)
Project-URL: Homepage, https://github.com/bitcart/trontxsize
Project-URL: Source, https://github.com/bitcart/trontxsize
Project-URL: Changelog, https://github.com/bitcart/trontxsize/blob/master/CHANGELOG.md
Author-email: MrNaif2018 <chuff184@gmail.com>
License-Expression: MIT
License-File: LICENSE
Keywords: bandwidth,bitcart,tron,trx
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Programming Language :: Python :: Free Threading :: 2 - Beta
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.11
Requires-Dist: base58
Requires-Dist: protobuf>=3.20
Description-Content-Type: text/markdown

# trontxsize - Calculate tron transaction size in bytes

[![CI](https://github.com/bitcart/trontxsize/actions/workflows/ci.yml/badge.svg)](https://github.com/bitcart/trontxsize/actions/workflows/ci.yml)
[![Codecov](https://img.shields.io/codecov/c/github/bitcart/trontxsize?style=flat-square)](https://codecov.io/gh/bitcart/trontxsize)
[![PyPI version](https://img.shields.io/pypi/v/trontxsize.svg?style=flat-square)](https://pypi.python.org/pypi/trontxsize/)

In Tron (TRX) network, fee calculation algorithm is complex. And the most complex part of it is that it depends on transaction size.

But there's no method existing to calculate it

This library does just this:

```python
import trontxsize

tx = ...  # transaction as returned by a TRON node, e.g. tronpy's Tron().get_transaction(tx_hash)
data = {"raw_data": tx["raw_data"], "signature": tx["signature"]}
print(trontxsize.get_tx_size(data))  # matches bandwidth you see in block explorer
```

How does it work? The library pre-compiled a trimmed-down version of Tron protobuf and uses it directly to calculate transaction size

## Copyright and License

Copyright (C) 2022 MrNaif2018

Licensed under the [MIT License](LICENSE)
