Skip to main content

โšก๏ธ 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.


License: Apache-2.0 PyPI version GitHub Release Date Downloads


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 .sol clutter 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)
  • Github repo flattening
  • Strip all comments (inline, block, NatSpec - toggleable)
  • Flatten by contract name (regex filtering)
  • Color logs and interactive CLI summaries
  • solc output 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)

Source distribution for solderx 0.1.4
File Size Uploaded Provenance
solderx-0.1.4.tar.gz 29.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for solderx 0.1.4
File Interpreter ABI Platform
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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page