
Hardhat Tron
- 4 installs
- 4 repo stars
- Updated February 25, 2026
- hairyf/blockchain-master
Configure Hardhat for TRON - compile with tronSolc, deploy with hardhat-deploy, and test using @layerzerolabs/hardhat-tron on Nile/mainnet.
About
Covers using Hardhat (v2 only) on TRON via @layerzerolabs/hardhat-tron for config, tronSolc compilation, deployment, and testing. A developer uses it to build and deploy Solidity contracts on TRON.
- Requires Hardhat 2.x; pinned LayerZero plugin versions
- tronSolc compilation and hardhat-deploy on Nile/mainnet
Hardhat Tron by the numbers
- 4 all-time installs (skills.sh)
- Ranked #347 of 479 Web3 & Blockchain skills by installs in the Skillselion catalog
- Data as of Jul 13, 2026 (Skillselion catalog sync)
npx skills add https://github.com/hairyf/blockchain-master --skill hardhat-tronAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 4 |
|---|---|
| repo stars | ★ 4 |
| Last updated | February 25, 2026 |
| Repository | hairyf/blockchain-master ↗ |
What it does
Configure Hardhat for TRON - compile with tronSolc, deploy with hardhat-deploy, and test using @layerzerolabs/hardhat-tron on Nile/mainnet.
Files
The skill is based on the LayerZero Hardhat TRON example (layerzero-hardhat-tron), generated at 2026-02-25.
Use this skill when configuring Hardhat for TRON (Nile/mainnet), compiling Solidity with tronSolc, deploying with hardhat-deploy, or writing tests. Plugin: @layerzerolabs/hardhat-tron; deploy: @layerzerolabs/hardhat-deploy.
Dependencies & versions
- Hardhat must be v2:
@layerzerolabs/hardhat-tronrequires Hardhat 2.x; Hardhat 3 is not supported. - Recommended versions (aligned with the example project):
hardhat:^2.26.3@layerzerolabs/hardhat-tron:^3.0.124@layerzerolabs/hardhat-deploy:^0.11.45-lz.4@nomicfoundation/hardhat-toolbox:^6.1.0dotenv:^17.2.1
Core References
| Topic | Description | Reference |
|---|---|---|
| Config | Plugin, solidity/tronSolc alignment, networks (Nile), env (TRON_PRIVATE_KEY, TRON_PRO_API_KEY) | core-config |
| Compilation | tronSolc enable/filter/compilers, version match, remapping | core-compilation |
Features
| Topic | Description | Reference |
|---|---|---|
| Deployment | hardhat-deploy script pattern, deploy to Nile, tags | features-deployment |
| Testing | Mocha/Chai tests on local Hardhat network, ethers | features-testing |
Generation Info
- Source:
sources/hardhat-tron - Git SHA:
459de83945f4a56756d1d38192c59f96b8cb1166 - Generated: 2026-02-25
Compilation
The TRON plugin uses tronSolc to produce TRON-compatible bytecode. Compiler versions in tronSolc.compilers must match entries in solidity.compilers.
Config shape
tronSolc: {
enable: true,
filter: [], // compile all; or list contract names to limit
compilers: [{ version: '0.8.23' }],
// Optional: remap solc version, e.g. [['0.8.22', '0.8.23']]
},Commands
npx hardhat compile— compile contracts for TRON using the above config.
Key points
- Use a TRON-supported Solidity version (e.g.
0.8.23). - Use
filter: []to compile all contracts, or an array of contract names to restrict. - Optional remapping lets you map a requested version to another (e.g. use 0.8.23 when 0.8.22 is requested).
<!-- Source references:
- https://github.com/aziz1975/layerzero-hardhat-tron (README, hardhat.config.cjs)
- https://www.npmjs.com/package/@layerzerolabs/hardhat-tron
-->
Config
Use @layerzerolabs/hardhat-tron with Hardhat v2 (must be 2.x; Hardhat 3 is not compatible). Every tronSolc.compilers version must also appear in solidity.compilers (plugin requirement). Use a TRON-supported Solidity version (e.g. 0.8.23).
Dependency versions
| Package | Version | Notes |
|---|---|---|
| hardhat | ^2.26.3 | Must be v2; v3 not supported |
| @layerzerolabs/hardhat-tron | ^3.0.124 | TRON compile & network plugin |
| @layerzerolabs/hardhat-deploy | ^0.11.45-lz.4 | Deploy scripts |
| @nomicfoundation/hardhat-toolbox | ^6.1.0 | Toolbox |
| dotenv | ^17.2.1 | Env vars |
Example config
require('dotenv').config();
require('@layerzerolabs/hardhat-deploy');
require('@layerzerolabs/hardhat-tron');
require('@nomicfoundation/hardhat-toolbox');
module.exports = {
solidity: {
compilers: [{ version: '0.8.23' }],
},
tronSolc: {
enable: true,
filter: [],
compilers: [{ version: '0.8.23' }],
},
namedAccounts: { deployer: 0 },
networks: {
nile: {
url: "https://nile.trongrid.io/jsonrpc",
accounts: [process.env.TRON_PRIVATE_KEY],
httpHeaders: { "TRON-PRO-API-KEY": process.env.TRON_PRO_API_KEY },
tron: true,
},
},
};Key points
- solidity + tronSolc: List the same compiler version in both; mismatch causes plugin errors.
- networks: TRON RPC uses
/jsonrpcpath; settron: trueandhttpHeaders["TRON-PRO-API-KEY"]for TronGrid. - accounts: Use
TRON_PRIVATE_KEYfrom env (no 0x prefix for TRON). - namedAccounts: Used by
hardhat-deploy(e.g.deployer: 0).
<!-- Source references:
- https://github.com/aziz1975/layerzero-hardhat-tron (README, hardhat.config.cjs)
- https://www.npmjs.com/package/@layerzerolabs/hardhat-tron
-->
Deployment
Use @layerzerolabs/hardhat-deploy for reproducible deployments. Scripts live in deploy/ and run in order; use tags to run subsets.
Deploy script pattern
/** @type {import('hardhat-deploy/types').DeployFunction} */
const func = async ({ getNamedAccounts, deployments }) => {
const { deploy } = deployments;
const { deployer } = await getNamedAccounts();
await deploy('Greeter', {
from: deployer,
args: ['Hello TRON!'],
log: true,
});
};
module.exports = func;
module.exports.tags = ['Greeter'];CLI
- Deploy to Nile:
npx hardhat deploy --network nile deployercomes fromnamedAccounts.deployer(e.g. first account fromaccounts).
Key points
deploy('ContractName', { from, args?, log? })deploys and saves artifact underdeployments/<network>/.- Use
tagsso you can runnpx hardhat deploy --network nile --tags Greeterto run only that script. - Ensure the network in config has
tron: trueand correcturl/httpHeadersfor TronGrid.
<!-- Source references:
- https://github.com/aziz1975/layerzero-hardhat-tron (README, deploy/00_deploy_greeter.js)
- https://www.npmjs.com/package/@layerzerolabs/hardhat-deploy
-->
Testing
Tests use the default Hardhat network (no TRON network required). Use ethers.getContractFactory and deploy in-process, then assert with Chai.
Example test
const { expect } = require("chai");
describe("Greeter", () => {
it("stores and returns the greeting", async () => {
const Greeter = await ethers.getContractFactory("Greeter");
const greeter = await Greeter.deploy("Hello TRON!");
await greeter.waitForDeployment();
expect(await greeter.greet()).to.equal("Hello TRON!");
const tx = await greeter.setGreeting("Yo");
await tx.wait();
expect(await greeter.greet()).to.equal("Yo");
});
});CLI
npx hardhat test— run tests (compiles if needed, uses local Hardhat network).
Key points
- Contracts are compiled with the TRON plugin; tests run on the in-process Hardhat network.
- Use
waitForDeployment()afterdeploy()when using the default provider. - No TRON private key or API key needed for local tests.
<!-- Source references:
- https://github.com/aziz1975/layerzero-hardhat-tron (README, test/greeter.test.js)
-->