/jsonrpc, /wallet, /walletsolidity support
Chainstack supports all three TRON API endpoints:/jsonrpc— Ethereum-compatible JSON-RPC (read-only operations)/wallet— TRON HTTP API (full node operations including transactions)/walletsolidity— TRON HTTP API (confirmed data from solidity node)
WebSocket event subscription not available
TRON nodes currently do not support WebSocket connections for event subscriptions. If you need to subscribe to events, please vote and follow the feature request at TRON event plugin support.TronWeb.js
TronWeb is the official JavaScript library for TRON. It supports all TRON operations including contract deployment and transactions.Get balance
/jsonrpc, /wallet, or /walletsolidity postfixes.
Deploy a contract
- YOUR_CHAINSTACK_ENDPOINT — your TRON node base endpoint without the
/jsonrpc,/wallet, or/walletsoliditypostfixes - YOUR_PRIVATE_KEY — the private key of the account that you use to deploy the contract
web3.py
web3.py can only perform read operations on TRON through the
/jsonrpc endpoint. For contract deployment and transactions, use TronWeb.js.- Install web3.py.
- Connect over HTTP.
HTTP
Use theHTTPProvider to connect to your node endpoint and get the latest block number.
/jsonrpc postfix, protected either with the key or password.
See also node access details.
Hardhat
Hardhat can only perform read operations on TRON through the
/jsonrpc endpoint. For contract deployment, use the hybrid workflow or TronWeb.js directly.- Install Hardhat and create a project.
-
Create a new environment in
hardhat.config.js:where YOUR_CHAINSTACK_ENDPOINT is your node HTTPS endpoint with the/jsonrpcpostfix, protected either with the key or password. See node access details. -
Compile your contracts with
npx hardhat compile, then deploy using TronWeb.js.
Foundry
Foundry can only perform read operations on TRON through the
/jsonrpc endpoint. For contract deployment, use the hybrid workflow below.- Install Foundry.
-
Use
--rpc-urlto run read operations through your Chainstack node.
Cast
Usecast to query the network.
To get the latest block number:
/jsonrpc postfix, protected either with the key or password.
Hybrid workflow
Use Foundry for fast compilation and testing, then deploy to TRON with TronWeb.js.Set up the project
-
Initialize a Foundry project:
-
Write your contract in
src/: -
Compile with Foundry:
The compiled artifacts are in
out/MyContract.sol/MyContract.json.
Deploy with TronWeb.js
-
Install TronWeb:
-
Create a deployment script
deploy.js: -
Run the deployment:
- YOUR_CHAINSTACK_ENDPOINT — your TRON node base endpoint without the
/jsonrpc,/wallet, or/walletsoliditypostfixes - YOUR_PRIVATE_KEY — the private key of the account that you use to deploy the contract