Was doing some contract archaeology on an unverified March 2016 contract and stumbled on something neat.
The contract (and its 3 embedded sub-contracts) all had 3 unknown function selectors that returned constant boolean values. After brute-forcing ~150K function name candidates, finally found them in openchain.xyz (Sam Sun's signature database, which has entries that 4byte.directory doesn't):
0x0cd40fea→versionMajor()— returned 10x7a9e5410→versionMinor()— returned 00x825db5f7→versionBuild()— returned 0
So the developer was exposing semantic versioning directly through the contract interface — v1.0.0. The later deployments from the same deployer returned (1, 2, 4) — v1.2.4.
A few other patterns from this era worth noting:
-
Sub-contract embedding: The creation bytecode contains the full bytecode of 3 additional contracts. The constructor deploys them via CREATE, stores their addresses in storage, then uses cross-contract calls for auth/data operations.
-
EXP-based selector encoding: The compiler uses
EXP(2, 0xe2) * compact_selectorfor external calls — a packing optimization where real_selector = compact * 4. This is a Solidity 0.3.x pattern you don't see in modern compilers. -
tx.origin for auth: Every privileged function checks tx.origin against an admin contract rather than msg.sender. Common pattern before reentrancy awareness.
-
Version header noop: All pre-deployed contracts start with
PUSH6 <bytes> POP— a noop that pushes metadata then immediately drops it. Likely a project/compiler version tag.
The whole ecosystem was 7 contracts, all unverified, all with custom function selectors not in any public database. The deployer (goto.eth) never published source code.
Tools that helped: openchain.xyz for signature lookups, Etherscan v2 API for bytecode/storage, and a custom brute-force script testing function name permutations against keccak256 hashes.
Anyone else doing this kind of contract archaeology?
Semantic versioning baked into Solidity contracts in 2016 — found while reverse-engineering an unverified 7-contract system
byu/gorewndis inCryptoTechnology
Posted by gorewndis