Seems like I'm building an EVM decompiler
Building a decompiler is for sure a strage thing. Especially when there's another popular one already. But this decompiler is important for the security of blockchain.
I'm probably the only one who woke up and decided that it's a great day to build a decompiler. And not just a decompiler, but one that's dedicated to EVM opcodes.
Why?...
"Two things can lead a mad ot build a decompiler. The one is a need, the other is boredom. But mostly it's both of them together"
- Ben Timor, 2026.
The Need
Mostly when you audit smart contract's code they're either verified on etherscan or you get an access to the git repository. So a decompiler is pretty redundant when it comes to normal audits.
But sometimes, I also investigate blockchain scams where you might see a lot of unverified contracts without any visible way of obtaining the source code.
For example, there's another post I've written in the past about the malicious bank contract. This contract is one of the most classic scam contracts, and it's hidden gem is found inside its logger contract's code. Which is unverified.
So if we take a look at the malicious code of the log contract (which is a small part of a much much longer code!) it'll look like this:
CALLDATALOAD
PUSH32 0x0100000000000000000000000000000000000000000000000000000000000000
SWAP1
DIV
PUSH32 0x0100000000000000000000000000000000000000000000000000000000000000
MUL
PUSH31 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
NOT
AND
PUSH31 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
NOT
AND
PUSH32 0x4300000000000000000000000000000000000000000000000000000000000000
EQ
JUMPDEST
ISZERO
PUSH2 0x00f3
JUMPI
Although it's kinda readable for a short code, it becomes really annoying when you have a code as long as the bible. It's much easier to read something like that:
if ((0x4c2f04a4 == (msg.sig & 0xffffffff)) && (0x00 == [VALUE])) {
// [LOG2] Mem: Unknown | Topics: 0xb7206ff2308912e5342f216a6283cada7ad88c32a209fcc91aa24d4b54b5c6c0, [ADDRESS([Calldata[0x04]])]
if ([CALLER] == [ADDRESS([STORAGE[0x00]])]) {
function_25e();
if ((0x00 == [function_25e result]) && ([Calldata[0x24]] <= 0x00)) {
function_f3();
}
else if (0x00 == [function_25e result]) {
if ((0x00 < [function_25e result]) && (0x4300000000000000000000000000000000000000000000000000000000000000 != (0xff00000000000000000000000000000000000000000000000000000000000000 & (0x0100000000000000000000000000000000000000000000000000000000000000 * ([Calldata[([Calldata[0x44]] + 0x24)]] / 0x0100000000000000000000000000000000000000000000000000000000000000))))) {
function_f3();
}
else if (0x00 < [function_25e result]) {
// [REVERT] Revert: 0x
}
else if (0x4300000000000000000000000000000000000000000000000000000000000000 != (0xff00000000000000000000000000000000000000000000000000000000000000 & (0x0100000000000000000000000000000000000000000000000000000000000000 * ([Calldata[([Calldata[0x44]] + 0x24)]] / 0x0100000000000000000000000000000000000000000000000000000000000000)))) {
function_f3();
}
else {
// [REVERT] Revert: 0x
}
}
else {
function_f3();
}
}
else {
function_f3();
}
}
Much more readable. Isn't it? (Okay maybe it still needs few improvements. But that's a start!).
The Boredom
I feel like AI takes a lot of fun parts out of programming. So I needed a project to start without using an AI. And I thought to myself: "What a fun challenge it's going to be to write a fucking decompiler by hand?"
And I got the answer.
Later though, after the project pretty much worked - I started using AI to write tests and help me with debugging because it became a bit too much for me.
But it was fun and solved the boredom issue for like 2 days.
Why don't I use Panoramix?
Although Panoramix is a great project and I really like it (it's even the one that helped me investigate the malicious bank contract!) it's a bit slow and works only for very specific use cases. It's not a general use decompiler for EVM opcodes. And they even say on their Github:
The code quality is still not great and the software is complex, it's mostly reserved for advanced users.
I wanted something more lightweight and more suitable for my own use cases. Which required me from time to time to decompile a really weird and random opcodes.
Can I try it?
Sure why not. Although I don't recommend it. Panoramix is much better right now as I still develop this project.
It's called Evaju, and you can find the github repository here.
Usage, instructions, etc - In the README file.