OpenViSTAI · Agents · Blockchain · Crypto
Menu
Developer Tools

Truffle Flattener

Truffle Flattener is a JavaScript command-line utility that combines Solidity files and their dependencies into one ordered source file for Truffle and Buidler projects.

Independent OpenViST project profile, based on linked sources.

Truffle Flattener — OpenViST project profile in Developer Tools.
OpenViST project illustration. See the linked sources for product details.
Understand the project

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.
Before you choose

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 flatten command 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.

Source-based practical guide

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

  1. Install the utility globally with the command below.

    Documented command
    npm install truffle-flattener -g
  2. From the project, run truffle-flattener with 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 flatten instead.
Evidence and transparency

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