A few weeks ago, we were approached with a request to work on a project unlike any we've had before.
Cyrus Adkisson is the creator of Etheria, a very early Ethereum app that programmatically generates "tiles" in a finite geometric world. Etheria has a strong claim to being the first NFT project, ever! It was first presented at DEVCON1 and has been around since October 2015--six years and counting. It is as much Ethereum "history" as can get.
Cyrus heard of us as bytecode and decompilation experts. His request was simple: try to reproduce the 6-yr old deployed bytecode of Etheria from the available sources. This is a goal of no small importance: the Etheria tiles are priced in the six digits and the history of the project can only be strengthened by tying the human-readable source to the long-running binary code.
Easy, right? Just compile with a couple of different versions and settings until the bytecode matches. Heck, etherscan verifies contracts automatically, why would this be hard?
Maybe for the simple fact that Cyrus had been desperately trying to get matching bytecode from the sources, to no avail! Christian Reitwiessner, the creator of Solidity and solc, had been consulting. Yet no straightforward solution had been in sight, after much, much effort.
To see why, consider:
- The version of solc used was likely (but not definitely) 0.1.6. Only one build of that version is readily available in modern tools (Remix) but the actual build used may have been different.
- The exact version of the source is not pinned down with 100% confidence. The code available was committed a couple of days after the bytecode was deployed.
- Flags and optimization settings are not known.
- The deployed code was produced by "browser-solidity", the precursor of Remix. Browser-solidity is non-deterministic with respect to (we thought!) blank spaces and comments.
- Even command-line solc itself was not deterministic, years later.