Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

TEnergy SDK for Python

Rent TRON energy from code, so your USDT transfers stop burning TRX. Each order goes to the cheapest provider available right now and is delegated on chain to the address you name. Your wallet keys never leave your side.

  • Zero dependencies for the regular client — standard library only. Python 3.9+.
  • Async when you need it: AsyncClient for asyncio (aiogram, FastAPI), same methods.
  • Typed (py.typed), every request signed, retries only where repeating is harmless.
pip install tenergy             # Client
pip install "tenergy[async]"    # + AsyncClient (adds httpx)

Energy for one USDT transfer

import os
from tenergy import Client

client = Client(os.environ["TENERGY_KEY"], os.environ["TENERGY_SECRET"])

order = client.create_order({
    "resource": "energy",
    "amount": 65000,                    # one USDT transfer to an address that already holds USDT
    "tier": "1h",                       # the energy is yours for an hour
    "receiver": "T...",                 # who gets the energy: the wallet that will send the USDT
    "client_order_id": "payout-42",     # makes a retry safe: same id, same order
})

delivered = client.wait_for_order(order["id"])   # status "active", delegate_hashes on chain

The same with asyncio — create one client, reuse it, close it:

from tenergy import AsyncClient

async with AsyncClient(key, secret) as client:
    order = await client.create_order({...})
    delivered = await client.wait_for_order(order["id"])

How much energy to order

The USDT transfer goes to Energy
an address that already holds USDT 65,000
an address with zero USDT 131,000
not sure client.estimate_transfer(from_address, to_address)["recommended_amount"]

Try it on the testnet first

client = Client(key, secret, network="nile")

Nile is a separate sandbox with ak_test_ keys and free test TRX and USDT (faucet); delegations show up on nile.tronscan.org. Mainnet is the default and takes ak_live_ keys; mixing them up fails when the client is built, not on the first order.

Errors and retries

from tenergy import TenergyError

try:
    client.create_order({...})
except TenergyError as e:
    if e.slug == "insufficient_funds":
        ...                             # top up, then repeat with the same client_order_id
    else:
        raise

Branch on slug, never on message — all codes. Reads are retried with backoff; creates are sent once, so a timed-out create is repeated by you with the same client_order_id. No answer at all raises TenergyTransportError.

Webhooks

Get order.confirmed the moment the delegation is on chain instead of polling:

from tenergy import verify_signature

ok = verify_signature(secret, request.headers, raw_body, tolerance_seconds=300)
# raw_body: the bytes as received, before json.loads

Docs · API reference · Examples · TypeScript SDK · support@tenergy.me

Get a key in the dashboard, or from code with a wallet signature: client.bootstrap(address, sign_message) then create_api_key(..., bootstrap_token=...) — how Nile keys are made. The regular client uses urllib with the system certificate store; on a python.org install for macOS run "Install Certificates.command" once. Your own HTTP stack plugs in through Client(transport=...).

MIT licensed.

Metadata

Release files for tenergy 0.1.0b0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tenergy 0.1.0b0
File Size Uploaded Provenance Actions
tenergy-0.1.0b0.tar.gz 14.2 kB Without provenance Details for tenergy-0.1.0b0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tenergy 0.1.0b0
File Interpreter ABI Platform Actions
tenergy-0.1.0b0-py3-none-any.whl Python 3 none any Details for tenergy-0.1.0b0-py3-none-any.whl

Total release size: 31.5 kB

Release files / tenergy-0.1.0b0.tar.gz

Download URL tenergy-0.1.0b0.tar.gz
Size 14.2 kB
Tags Source
SHA-256 checksum
How to use checksums
264dc797ce7b8b0ff269aff5d72ac97decf32ea5f5f2a0144237e1064ba201b0
BLAKE2b-256 checksum
How to use checksums
8d3a0f540edc574b2ffc8a5df97112bd112d9a2d8b5bd44f29d23b41d0bb45b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.3

Release files / tenergy-0.1.0b0-py3-none-any.whl

Download URL tenergy-0.1.0b0-py3-none-any.whl
Size 17.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8efd6f6e5b4c080734440f4bc0c11e1530d4490a629171b1c4cf9218158db08d
BLAKE2b-256 checksum
How to use checksums
c92ab4c06c560cab2d1a8d73defc7bd131b82f332415bf642a703ba09a854750
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.3

Security for tenergy 0.1.0b0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page