โก๏ธ SolderX
Fuse, Flatten & Forge Solidity Contracts
Lightweight Solidity source flattener tool & dependency resolver.
SolderX is a developer-first Solidity flattener that handles local files, project folders, and verified contracts from blockchain explorers. Explorer sources are resolved directly from the API response and flattened on the fly, without requiring the source tree to be saved locally first.
It handles nested and relative imports, remappings, SPDX normalization, topological dependency ordering, import deduplication, and cyclic dependency detection.
Built for Solidity developers, researchers, auditors, and security tooling โ including source verification, audits, and static analysis.
Installation
pip install solderx
SolderX is now available on PyPI โ install it in seconds and start soldering Solidity contracts effortlessly.
โ Requirements: Python 3.8+
Why use SolderX ? :
SolderX takes care of everything:
- โ Flatten a single file, entire project folder, or verified solidity contracts from explorers (like Etherscan)
- โ Supports remappings, relative imports, and handles complex cyclic dependencies
- โ
Fully in-memory parsing โ no
.solclutter or manual cleanup from explorer downloads
One powerful CLI + Python tool โ clean, audit-ready output in seconds.
Most flatteners break on remappings, folder imports, or explorer parsings โ SolderX doesn't.
Features Overview
| Feature | Description | Status |
|---|---|---|
| Flatten Everything | Flatten from single files, full folders, or on-chain verified contracts | โ |
| Smart Import Resolver | Handles nested imports, multiline/same-line cases, and deduplicates cleanly | โ |
| Scan from Explorers | Supports Etherscan, Polygonscan, BscScan, Arbiscan, Base, Optimism, Avalanche | โ |
| In-Memory Flattening | No temp or unflattened junk files saved โ All flattening done in-memory | โ |
| Remapping Support | Supports & resolves robust remappings (basic, deep, longest-match) | โ (file) |
| Relative Imports in Remappings | Resolves ./ and ../ paths even within remapped libraries |
โ (file) |
| Import Parsing Engine | Extracts imports safely โ ignores inside comments and strings | โ |
| Cyclic Import Detection | Flags and breaks infinite loops in import trees | โ |
| Folder-Aware Flattening | Detects and blocks out-of-scope imports across folder boundaries | โ |
| Chain + Address Validation | Catches malformed contract addresses and unsupported chains | โ |
| SPDX Header Merging | Deduplicates and merges license headers cleanly | โ |
| Import Deduplication | Ensures each dependency is flattened only once | โ |
| Python API Support | Expose all core functions (file, folder, scan) via clean Python API |
โ |
| Professional CLI Interface | Clear status messages and concise error output | โ |
| Fast & Lightweight | Built with Python, no heavy dependencies | โ |
| Static Analysis Ready | Output works with all static analyzers | โ |
| Pluggable Design | Designed to extend โ GitHub flattening, config aliasing, IDE plugins | Planned |
How SolderX Compares :
โ ๏ธ Note: This comparison is a working draft. Feature support for third-party tools may be evolving, and accuracy is based on current public documentation and observed behavior. Final evaluation pending deeper testing.
| Feature | SolderX | Hardhat / Foundry / Remix | poa/solidity-flattener | solidity-flattener | truffle-flattener | sol-merger | slither-flatten |
|---|---|---|---|---|---|---|---|
| Standalone file flattening | โ | โ | โ | โ | โ | โ | โ |
| Folder/project flattening | โ | โ | โ | โ ๏ธ Limited | โ ๏ธ Partial | โ | โ |
| Etherscan flattening (verified source) | โ | โ | โ | โ | โ | โ | โ |
| On-the-fly (no temp files saved) | โ | โ | โ | โ | โ | โ | โ |
Smart remapping resolution (@...) |
โ Deep | โ ๏ธ Hardcoded | โ | โ | โ | โ Basic | โ |
| Relative imports in remapped libs | โ | โ | โ | โ | โ | โ | โ |
| Multiline & nested import handling | โ | โ ๏ธ Partial | โ | โ | โ | โ | โ |
| Cyclic import detection & handling | โ | โ | โ | โ | โ | โ | โ |
| SPDX / license metadata cleanup | โ | โ | โ | โ | โ | โ | โ |
| Deduplicated output | โ | โ | โ | โ | โ | โ ๏ธ Partial | โ |
| Comment-aware import extraction | โ | โ | โ | โ | โ | โ | โ |
| Python API support | โ | โ | โ | โ | โ | โ | โ |
| CLI with clear status output | โ | โ ๏ธ Basic | โ | โ | โ Basic | โ | โ ๏ธ Minimal |
| Slither-compatible output | โ | โ | โ ๏ธ Maybe | โ ๏ธ Maybe | โ ๏ธ Maybe | โ ๏ธ Maybe | โ |
| Chain/address validation (Etherscan) | โ | โ | โ | โ | โ | โ | โ |
| Future-ready: GitHub flattening, aliases | โ Planned | โ | โ | โ | โ | โ | โ ๏ธ Limited |
| Maintained actively | โ | โ | โ | โ | โ | โ ๏ธ Rare | โ |
โก๏ธ SolderX brings file, folder, and verified explorer flattening together in a single lightweight interface
CLI Usage
# Simple file
solderx MyContract.sol
# Simple file with output path
solderx MyContract.sol --output MyContract_Flat.sol
# With remappings
solderx path/to/Contract.sol -r remappings.json
# Project folder with inline remapping
solderx src/ --remappings "@a=lib/a,@b=node_modules/b"
# With a remappings json
solderx project/contracts --remappings remappings.json
# With remappings and output filepath
solderx path/to/project/ -r remappings.json -o flattened/soldered_project.sol
# fetch from etherscan
solderx 0xAbC...123 -chain eth --api-key YOUR_API_KEY
# also fetch from etherscan
solderx eth:0xAbC...123 --api-key YOUR_API_KEY
Python API Usage
from solderx import solder_file, solder_folder, solder_scan
# ๐น 1. Flatten a single file
flattened_code = solder_file("path/to/Contract.sol")
# With remappings
flattened_code = solder_file("path/to/Contract.sol", remappings={"@oz": "lib/openzeppelin-contracts"})
# ๐น 2. Flatten an entire folder
flattened_code = solderx("contracts/")
# With remappings
flattened_code = solder_file("path/to/Contract.sol", remappings={"@oz": "lib/openzeppelin-contracts"})
# ๐น 3. Flatten from verified explorer source
# Flatten from Etherscan
flattened_code = solderx("0x123..789", chain = 'eth')
flattened_code = solderx("eth:0x123..789")
# ๐น save file (default = False)
_ = solder_file("path/to/Contract.sol", save_file=True)
# save file in specified path
_ = solder_file("path/to/Contract.sol", output_path='./Contract_Flat.sol')
Real Use Cases
- Re-verify contracts on Etherscan after audits or refactors
- Feed single files into static analyzers like Slither, Mythril, Semgrep
- Compare bytecode outputs between flattened and deployed versions
- Onboard contributors by flattening large repos for easier reading
- Pipeline-ready for CI/CD - security scans, or deployment packaging
Test Summary :
| Category | solder_file() |
solder_folder() |
solder_scan() |
|---|---|---|---|
| Flat imports | โ | โ | โ |
| Nested imports | โ | โ | โ |
| Save Flat File | โ | โ | โ |
| Multiline imports | โ | โ | โ |
| Multiple imports on same line | โ | โ | โ |
| Missing import (in-scope) | โ | โ | โ |
| Missing import (out-of-scope) | N/A | โ | โ |
| Import outside folder scope detection | N/A | โ | โ |
| Cyclic imports | โ | โ | โ |
| Remapping (basic + deep + longest) | โ โ โ | ๐ง N/A | ๐ง N/A |
| SPDX header merging | โ | โ | โ |
| Import deduplication | โ | โ | โ |
| Handle empty files | โ | โ | โ |
| Relative imports in remapped libs | โ | ๐ง N/A | ๐ง N/A |
| Relative import resolution | โ | โ | โ |
| Flattened & multi-file JSON parsing | N/A | N/A | โ |
| Contract name parsing | N/A | N/A | โ |
| Chain support handling | N/A | N/A | โ |
| Invalid address handling | N/A | N/A | โ |
All core behaviors are verified using Pytest.
Want more scenarios covered? Open an issue
Roadmap & Future Additions
- Aliasing via config file (
solderx.toml) -
Githubrepo flattening - Strip all comments (inline, block, NatSpec - toggleable)
- Flatten by contract name (regex filtering)
- Color logs and interactive CLI summaries
-
solcoutput validation (AST / compile test) - Plugin support:
slither,mythril,sourcify
Contributing
Pull requests are welcome!
If youโve found a bug, a confusing case, or have feature ideas โ open an issue or discussion on the repo.
Weโre building this tool for Solidity developers like you.
License
SolderX is released under the Apache-2.0 License
Copyright 2025 Sidarth S
If you use SolderX in your project, product, or tooling, please consider acknowledging SolderX and linking to the project.
Support & Updates
Weโre just getting started โ expect support for more chains, deeper integrations, and smart dev-first features soon.
๐ Track progress, report issues, or request enhancements on the GitHub repo.
Letโs forge ahead with SolderX โ and make Solidity flattening reliable, intuitive, and developer-friendly.
Metadata
Release files for solderx 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| solderx-0.1.4.tar.gz | 29.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| solderx-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 52.7 kB
Release files / solderx-0.1.4.tar.gz
| Download URL | solderx-0.1.4.tar.gz |
|---|---|
| Size | 29.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3a4a81b3e273f5b5e57a3a48b68c98ec4ef1ca6fa1a2da375a0cb1bb95c20cc2
|
|
BLAKE2b-256 checksum How to use checksums |
b837a69d51602b1b24f2f231fd9fc52a2d0d272d33d3add71c5744ce6e5cba8e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.10
|
Release files / solderx-0.1.4-py3-none-any.whl
| Download URL | solderx-0.1.4-py3-none-any.whl |
|---|---|
| Size | 22.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8ba41471f65a89355a0561a2c43b3ba0be2631e854b4671f068476b11a64f61e
|
|
BLAKE2b-256 checksum How to use checksums |
d4a0c9ea4670ead2ae04980cd2a0fec2b939b0d27c460726f76e1c5d22aae015
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.10
|
Security for solderx 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.