Practical overview
When it fits
Use it as a preprocessing step when a Truffle or Buidler workflow needs contract source and dependencies combined for verification or debugging.
Who it is for
- Developers working with Solidity contracts in Truffle or Buidler projects.
- Developers preparing contract source for Etherscan verification or Remix debugging.
Documented uses
- Merge Solidity files with their dependencies into one ordered file.
- Prepare Truffle or Buidler contract source for verification on Etherscan.
- Prepare flattened source for debugging in Remix.
Requirements & limits
The repository is public and identifies the software as MIT-licensed. The documented interface is a command-line utility installed with npm.
- Aliased Solidity imports are not supported.
- Hardhat projects can use the
npx hardhat flattencommand identified in the README. - The utility prepares source files; verification on Etherscan and debugging in Remix are separate downstream tasks.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Install and run Truffle Flattener on Solidity files
Create a flattened source file from Solidity files in a Truffle or Buidler project.
Before you start
- npm
- A Truffle or Buidler project with Solidity files
Steps
Install the utility globally with the command below.
npm install truffle-flattener -gFrom the project, run
truffle-flattenerwith the Solidity file or files to process.
Expected outcome
The utility merges the selected Solidity files and their dependencies in the required order for use in a verification or debugging workflow.
Guide limitations
- Aliased imports are not supported.
- For Hardhat projects, the README recommends
npx hardhat flatteninstead.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 14 October 2026
- Original website title
- NomicFoundation/truffle-flattener · Official homepage title · retained in its source language

