TronWeb is the official JavaScript SDK for interacting with the TRON blockchain, providing a comprehensive encapsulation of the TRON HTTP API. As of version 6.2.2, it continues to be actively maintained with frequent minor and patch releases, incorporating new TRON features and API quality-of-life improvements. Unlike a direct fork of Ethereum's Web3.js, TronWeb is specifically tailored to unlock TRON's unique feature set and offers distinct tools for DApp integration across browsers, Node.js environments (v16+), and IoT devices. It ships with TypeScript types, enhancing developer experience for strongly typed projects. Key features include deterministic contract address computation (CREATE2), robust transaction deserialization, and methods for retrieving real-time witness lists and transaction building parameters.
npm install tronwebVerified import paths — ran on the pinned version, not inferred.
Initializes TronWeb, connects to the Shasta testnet using environment variables for sensitive keys, fetches the default account's balance, and demonstrates the `getCreate2Address` utility function.
Update your `contract.new()` calls to handle the returned instance instead of relying on mutation. Ensure your ABI definitions use `as const` for TypeScript type inference.
Ensure your development and deployment environments use Node.js v16 or a newer LTS version.
Upgrade to TronWeb v6.2.2 or higher to mitigate prototype pollution risks. Regularly update dependencies to address security patches.
Ensure your connected TRON full node (e.g., TronGrid) is running JAVA-TRON v4.8.1 or higher if you plan to use `trx.getNowWitnessList`.
If your application had an indirect dependency on `jsonwebtoken` via TronWeb, ensure you manage that dependency directly if it's still required for other parts of your application. Always audit your dependency tree.
For ESM, use `import TronWeb from 'tronweb';`. For CommonJS, use `const TronWeb = require('tronweb');`. Ensure your project's module system is correctly configured.Double-check your private key for typos, ensure it's a valid hexadecimal string, and confirm it's associated with the correct network (e.g., Shasta testnet key for Shasta).
Verify your `fullHost` URL is correct and accessible. Ensure `TRON-PRO-API-KEY` is provided and valid if connecting to TronGrid. Check your internet connection and any firewall settings.
Ensure the TRON full node you are connected to (e.g., your local quickstart instance or a public gateway) is running JAVA-TRON v4.8.1 or a newer compatible version.
No dependency data recorded yet.