January 24, 2026

Capitalizations Index – B ∞/21M

Flattening your Solidity files – Qayyum Rajan – Medium

Flattening your solidity files – qayyum rajan – medium

Flattening your Solidity files – Qayyum Rajan – Medium

Flattening your solidity files – qayyum rajan – medium

This article is geared towards those that are beginning to interact with smart contracts in ethereum.

I’ve been through this a few times — and for those just starting in the space — this can somewhat be an annoying process — especially when trying to get verified on Etherscan.io

Typically your files will be in a combination of subfolders — and this article is meant to give a more detailed overview for those that want to get their contracts source code verified. We will do this from scratch for those not familiar with using npm and the terminal.

We will be using the POA Solidity Flattener found here (clone this to your local directory): https://github.com/poanetwork/solidity-flattener

First thing first is install NPM here.

To use some reference files — we can use some token contracts from openzepplin who provides an awesome collection of free smart contracts.

Open in Github Desktop, download the zip or clone the repo — whatever works for ya (I personally like Github Desktop).

Get the repo

We can use contracts/token/ERC20/ERC20Mintable.sol — This is a standard mintable token.

Mintable token

See how it starts with those two imports? Those are referencing other contracts in the repo. When it comes time to verify your source code, easy deployment of small contracts etc — what you want is a flattened file which holds all the imports in a single contract.

Open up your terminal and cd into your poa network folder (soldity-flattener) and then enter npm install.

You can now simply enter ‘npm start’ and add the file name of your smart contract (.sol file)

Get started

See that out folder…

Boom — flat file baby

Published at Tue, 19 Feb 2019 07:16:05 +0000

Previous Article

Crypto Trading Volume Hits 9 Month High at $34 Billion

Next Article

These Days Cryptocurrency is Considered Better than Credit Cards, Here Are 9 Reasons Why

You might be interested in …