Registry / http-networking / tronpy

tronpy

JSON →
library0.6.2pypypi✓ verified 86d ago

Tronpy is a Python client library for interacting with the TRON blockchain. It supports TRON's full node API, TRON Grid API, staking, smart contracts, and transaction building. Current version is 0.6.2, compatible with Python >=3.9. Release cadence is roughly every 3-6 months with feature updates and Python version support bumps.

pip install tronpy
INSTALL
IMPORT
SIG · TRONPY
T
tronpy
http-networkingpythonv0.6.2
Install
6.6s avg
Import
1690ms
Disk
64MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.6.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 1.845s · 62.6MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 6.6s · import 1.534s · 66MB
64MB installed
● package 64MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Tron
from tronpy import Tron
from tronpy.tron import Tron
Tron is exposed at package level; submodule import may break.
PrivateKey
from tronpy.keys import PrivateKey
from tronpy.key import PrivateKey
Module is 'keys' (plural).
Contract
from tronpy.contract import Contract

Initialize a Tron client with HTTPProvider (optionally using TRON Grid API key) and fetch latest block number.

from tronpy import Tron from tronpy.providers import HTTPProvider client = Tron(provider=HTTPProvider(api_key=os.environ.get('TRONGRID_API_KEY', ''))) # Get latest block number block = client.get_latest_block_number() print(f"Latest block: {block}")
Debug
Known issues
breakingIn v0.4.0, stake V1 APIs were removed in favor of stake V2. Old stake methods (freezeBalance, unfreezeBalance) no longer work. Use stake_v2 methods instead.
fix
Migrate to stake V2 API: use `client.stake_v2` methods like `freeze_balance_v2` and `unfreeze_balance_v2`.
affects: >=0.4.0
deprecatedSupport for Python 3.8 was dropped in v0.6.0. The package now requires Python >=3.9.
fix
Upgrade Python to 3.9 or higher.
affects: >=0.6.0
gotchaWhen using offline transaction creation (v0.6.0+), you must provide `ref_block_id` and `offline=True` to `build()`. Forgetting `ref_block_id` will cause transaction rejection on the network.
fix
Ensure you include `ref_block_id` from a recent block when building offline transactions.
affects: >=0.6.0
gotchaThe `get_energy` method was added in v0.6.0. In earlier versions, energy estimation required a different approach (e.g., using `trigger_constant_contract`).
fix
Upgrade to 0.6.0+ for `get_energy` method.
affects: <0.6.0
Errors
Common errors & fixes
AttributeError: module 'tronpy' has no attribute 'Tron'
Incorrect import path; Tron is not directly under tronpy due to import errors in older versions or when using a different structure.
fix
Use `from tronpy import Tron` (correct). Ensure you have installed the latest version.
ImportError: cannot import name 'HTTPProvider' from 'tronpy.providers'
The provider module was renamed or restructured in earlier versions (before 0.3.0).
fix
Upgrade tronpy to version 0.3.0 or later. Then `from tronpy.providers import HTTPProvider`.
Upgrade
Version history
0.6.2latest on PyPI · released Jan 8, 2026
Audit
Dependencies
coincurverequiredCryptography for secp256k1 curves (replaced pure-python ecdsa in v0.3.0)
httpxrequiredHTTP client for API calls
cryptographyrequiredUsed for key generation and signing
Agent activity
30 hits · last 30 days
node
26
Meta
2
Amazon
1
OpenAI (training)
1
Resources
tronpy — pip install tronpy · libregistry