โก๏ธ 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 |
โ |
| Themed CLI Interface | Minimal, expressive CLI with emoji-based output and colored logs | โ |
| 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 themed logs | โ | โ ๏ธ 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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file solderx-0.1.3.tar.gz.
File metadata
- Download URL: solderx-0.1.3.tar.gz
- Upload date:
- Size: 29.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7160b24ce630ce5bc73600ffa4b62ac398b812c3a77f2d6a00c2e27df39cb4f
|
|
| MD5 |
4bc028ea71f8364c1044bc2db2733af3
|
|
| BLAKE2b-256 |
d6f05f1db8d349c90881e4b220247c8b12d056b1fb138899d16c2c17dba0accb
|
File details
Details for the file solderx-0.1.3-py3-none-any.whl.
File metadata
- Download URL: solderx-0.1.3-py3-none-any.whl
- Upload date:
- Size: 22.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a4ca6379042f60e1440603569a9f930171d09a43571f17a7ddef04c480ebb1d
|
|
| MD5 |
311916a7d16d80edf8df551367f28d50
|
|
| BLAKE2b-256 |
38d64c340758d714d80e3ef1ce8066114fc0312f61aabcf4db95c280974340c9
|