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 โœ…
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)
  • 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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

solderx-0.1.2.tar.gz (28.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

solderx-0.1.2-py3-none-any.whl (22.1 kB view details)

Uploaded Python 3

File details

Details for the file solderx-0.1.2.tar.gz.

File metadata

  • Download URL: solderx-0.1.2.tar.gz
  • Upload date:
  • Size: 28.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.10

File hashes

Hashes for solderx-0.1.2.tar.gz
Algorithm Hash digest
SHA256 0fac1e97e8a10ebea056f1810ea586e1d93bfddebc2f646a4b5a28777f99c3b2
MD5 8c1727307fb213d25e768a022fb6d74f
BLAKE2b-256 7dbca8e3014631085ab189849c4c2534aa55fa300c72720b0b51dc08e759c2a4

See more details on using hashes here.

File details

Details for the file solderx-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: solderx-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 22.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.10

File hashes

Hashes for solderx-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1488302bf00c38566141a1bec2a2a3e8aac862b7863e8c06e9571218566ff547
MD5 f65c52e53424fabc39ac3b5e3168ecaf
BLAKE2b-256 561a77fb446623e003f6c7695abb275bee813571ecb222f81383ad7adc7e975c

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.4

2 files

0.1.3

2 files

This release

0.1.2 This release

2 files

0.1.1

2 files

0.1.0

2 files

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