Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
TRON Python Client Library. Documentation
Note: in case you want to use cryptocurrency functions in an universal way or e.g. reliably calculate transaction fees for BTC, ETH, Tron and many others, check out the Bitcart project
from tronpy import Tron
from tronpy.keys import PrivateKey
client = Tron(network='nile')
# Private key of TJzXt1sZautjqXnpjQT4xSCBHNSYgBkDr3
priv_key = PrivateKey(bytes.fromhex("8888888888888888888888888888888888888888888888888888888888888888"))
txn = (
client.trx.transfer("TJzXt1sZautjqXnpjQT4xSCBHNSYgBkDr3", "TVjsyZ7fYF3qLF6BQgPmTEZy1xrNNyVAAA", 1_000)
.memo("test memo")
.build()
.inspect()
.sign(priv_key)
.broadcast()
)
print(txn)
# > {'result': True, 'txid': '5182b96bc0d74f416d6ba8e22380e5920d8627f8fb5ef5a6a11d4df030459132'}
print(txn.wait())
# > {'id': '5182b96bc0d74f416d6ba8e22380e5920d8627f8fb5ef5a6a11d4df030459132', 'blockNumber': 6415370, 'blockTimeStamp': 1591951155000, 'contractResult': [''], 'receipt': {'net_usage': 283}}
import asyncio
from tronpy import AsyncTron
from tronpy.keys import PrivateKey
# private key of TMisHYBVvFHwKXHPYTqo8DhrRPTbWeAM6z
priv_key = PrivateKey(bytes.fromhex("8888888888888888888888888888888888888888888888888888888888888888"))
async def transfer():
async with AsyncTron(network='nile') as client:
print(client)
txb = (
client.trx.transfer("TJzXt1sZautjqXnpjQT4xSCBHNSYgBkDr3", "TVjsyZ7fYF3qLF6BQgPmTEZy1xrNNyVAAA", 1_000)
.memo("test memo")
.fee_limit(100_000_000)
)
txn = await txb.build()
print(txn)
txn_ret = await txn.sign(priv_key).broadcast()
print(txn_ret)
# > {'result': True, 'txid': 'edc2a625752b9c71fdd0d68117802860c6adb1a45c19fd631a41757fa334d72b'}
print(await txn_ret.wait())
# > {'id': 'edc2a625752b9c71fdd0d68117802860c6adb1a45c19fd631a41757fa334d72b', 'blockNumber': 10163821, 'blockTimeStamp': 1603368072000, 'contractResult': [''], 'receipt': {'net_usage': 283}}
if __name__ == '__main__':
asyncio.run(transfer())
Or close async client manually:
from httpx import AsyncClient, Timeout
from tronpy.providers.async_http import AsyncHTTPProvider
from tronpy.defaults import CONF_NILE
async def transfer():
_http_client = AsyncClient(limits=Limits(max_connections=100, max_keepalive_connections=20),
timeout=Timeout(timeout=10, connect=5, read=5))
provider = AsyncHTTPProvider(CONF_NILE, client=_http_client)
client = AsyncTron(provider=provider)
print(client)
priv_key = PrivateKey(bytes.fromhex("8888888888888888888888888888888888888888888888888888888888888888"))
txb = (
client.trx.transfer("TJzXt1sZautjqXnpjQT4xSCBHNSYgBkDr3", "TVjsyZ7fYF3qLF6BQgPmTEZy1xrNNyVAAA", 1_000)
.memo("test memo")
.fee_limit(100_000_000)
)
txn = await txb.build()
print(txn)
txn_ret = await txn.sign(priv_key).broadcast()
print(txn_ret)
print(await txn_ret.wait())
await client.close()
if __name__ == '__main__':
asyncio.run(transfer())
FAQs
TRON Python client library
We found that tronpy demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.