https://github.com/tronprotocol/tron-sdk-py
https://github.com/tronprotocol/tron-sdk-py
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/tronprotocol/tron-sdk-py
- Owner: tronprotocol
- Created: 2020-08-26T05:29:33.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-10-12T06:11:55.000Z (over 5 years ago)
- Last Synced: 2025-04-16T08:10:40.953Z (about 1 year ago)
- Language: Python
- Size: 136 KB
- Stars: 18
- Watchers: 5
- Forks: 14
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# tron-sdk-py
The TRON gRPC API SDK in Python.
## Demo
```py
from tron.proto.core.contract_pb2 import TransferContract
from tron.client import TronClient
from tron.types import HEX, ADDR
client = TronClient.nile(
private_key=HEX('3333333333333333333333333333333333333333333333333333333333333333')
)
print(client.solidity_stub.GetNowBlock2(EmptyMessage()))
req = TransferContract()
req.owner_address = ADDR("TJRabPrwbZy45sbavfcjinPJC18kjpRTv8")
req.to_address = ADDR("TRsbuxREXKJKonexpejWhacE4sYHt1BSHV")
req.amount = 1_100_000
txn = client.wallet_stub.CreateTransaction2(req)
print("TXID:", HEX(txn.txid))
signed_txn = client.sign(txn)
print(signed_txn)
resp = client.wallet_stub.BroadcastTransaction(signed_txn)
print(resp)
```