Is their any way to calculate checksum of an unverified smart contract?

Jul 8, 2023, 3:07 PM
How can I compare similarity of an unverified smart contract with all other smart contracts?
Jul 8, 2023, 3:22 PM
Compare the bytecodes or simply hash it
Jul 8, 2023, 3:56 PM
Could you expand more on this? 😅
Jul 8, 2023, 6:47 PM
That should be enough, idk what else to say
Jul 8, 2023, 7:08 PM
I can calculate hash and checksum yes, but how do I go about comparing them? I mean using what measure?
Jul 8, 2023, 7:16 PM
You can check it on etherscan.io.
Just go to contract code and then "search similar"
Or another way is to search by hands with smart contract code search. But Im not sure that works for unverified
Jul 8, 2023, 7:28 PM
Unverified is a concept only valid for the block explorer
You can scan the entire Blockchain for bytecodes and index it in a database
Jul 8, 2023, 7:39 PM
Yeah fair enough
Jul 8, 2023, 7:39 PM
Yes but how to compare them. Comparing verified sc is easy because I know I can compare the lines of code and see "how many lines are same" but how do I do that for bytecode?
Jul 8, 2023, 7:55 PM
You can only check whether they're the same or not, line by line comparison isn't possible for unverified contracts (and that should be obvious)
Could try the decompiler but that's not something u should rely on
Jul 8, 2023, 7:59 PM
How can I check whether they're the same or not? The entire bytecode will be the same right?
Jul 8, 2023, 8:27 PM
Absolutely. At least for same compilers
Jul 8, 2023, 8:29 PM
So let me know if i understood correctly. If a scammer lets say forks a malicious contract, changes 2 or 3 variable names and deploys it - doesn't verify. There's no way of knowing that ca is 99% similar to previous scam ca?
Jul 8, 2023, 8:32 PM
In this case bytecode will be 100% the same
Variable names don't affect bytecode but function names do
You can tell exactly what do you want to do btw :)
Jul 8, 2023, 8:41 PM
But function names dont affect logic right?
Jul 8, 2023, 8:42 PM
Yea
Jul 8, 2023, 8:42 PM
Yes they do or yes they dont. Sry i'm dumb
Jul 8, 2023, 8:43 PM
names dont affect logic
Jul 8, 2023, 8:43 PM
Ahh so function names don't change logic but nevertheless the bytecode is changed right?
Jul 8, 2023, 8:44 PM
Yea, that's the problem
Jul 8, 2023, 8:45 PM
I falsely understood that bytecode is only dependent on logic, running conditions
Can we figure it out further by decompiling and simulating the bytecode in testing environment, to see if entire logic is same with minor function name changes ?
Jul 8, 2023, 8:46 PM
I think it's feasible. Bytecode decompilers work very well but i don't have enough skill to implement something like that
But yea, with analyzing decompiler output your idea is feasable
Jul 8, 2023, 8:49 PM
Thanks ser, can u recommend good decompiler to start with?
Is heimdall good?
Jul 8, 2023, 8:50 PM
Could be xd
I usually use dedaub https://library.dedaub.com/decompile
But there's no executable. Only online tool
Jul 8, 2023, 8:53 PM
Tyty!
Jul 8, 2023, 8:56 PM
Maybe u shouldn't put your funds on an unverified contract,
Even verifying it won't necessarily make it not scammy
Jul 9, 2023, 5:49 AM

© 2024 Draquery.com All rights reserved.