1

Is there any tool for Bitcoin blockchain decompiling?

I see news about Ethereum Decompiler, but is something like for Bitcoin?

Denis Leonov
  • 945
  • 12
  • 28
  • If you got here like me looking for something to translate a script back into human readable tokens (more of a "disassembler" for the pedantic crowd), check out https://bitcoin.stackexchange.com/questions/42576/online-bitcoin-script-simulator-or-debugger , especially https://github.com/kallewoof/btcdeb . – jhfrontz Feb 26 '19 at 00:02

1 Answers1

1

There is a big different between the language used by the bitcoin blockchain and the one used in ethereum.

Ethereum smart contract programmers usually write their code in a high level language (such as solidity) and then compile it into hard to read bytecode.

Bitcoin script programmers write the code in a language that is not compiled, like if they were writing the bytecode itself (it isn't actually a bytecode though).

So it is logical that you can't decompile a language that was never compiled in the first place.

The thing you can do is look at the hexadecimal representations of bytes in a bitcoin script and check which operation they represent.

This page has the list of all the commands and their hex value.

Edit

When you write a script in Bitcoin it is already fully transparent. It never gets compiled, NEVER. It is already fully transparent because you never compile it. You don't need to decompile it because it was never compiled, just like you can't destroy an house that was never built in the first place.

Did I already mention that you don't need to decompile because the code never gets compiled?

Because it is really important to understand that it never gets compiled. You can just read it as it is.

If you see a 0x6a in the code it reads like OP_RETURN as for the link i gave you above. You can read through the whole list of hex charachters in a script and decode it like that. There is nothing more you can do

I hope it will be clear now.

Ivano Donadi
  • 219
  • 1
  • 9
  • So it is logical that you can't decompile a language that was never compiled in the first place. Why you think so? It is impossible or impractical? – Denis Leonov Aug 23 '17 at 17:07
  • 1
    @Denis, compiling means converting source code into another, more basic (but less human-readable) code. For example, converting C++ into x86 instructions. Ethereum has it's own instruction set, but most people use a higher-level language and a compiler to convert it into the Ethereum instructions. Bitcoin script is so simple and limited that nobody uses a higher level language. As such, no compiler exists to convert this non-existent language into Bitcoin script, and no decomplier exists to convert it back. – Jestin Aug 23 '17 at 20:18
  • @Denis how can you undo something that was never done?? It is not impossible or impratictical, it just never happened. – Ivano Donadi Aug 24 '17 at 10:06
  • @IvanoDonadi I need full transparency for my tasks – Denis Leonov Aug 26 '17 at 00:12
  • @Denis you are just not getting it. Read my edit please and try to understand – Ivano Donadi Aug 26 '17 at 07:14
  • I do not mean only the script, but I mean the structure of full database, all structure dependencies and trees of value flow and so on. The script here is a small part of question. – Denis Leonov Aug 28 '17 at 01:17
  • The link you posted about the ethereum decompiler is strictly about the script. Please read some basic documentation about bitcoin and the blockchain. – Ivano Donadi Aug 28 '17 at 05:42
  • @IvanoDonadi thank you very much! •sarcasm• – Denis Leonov Sep 03 '17 at 23:43
  • I suggest that before using your wonderful sarcasm you read the wikipedia definition for decompiler: A decompiler is a computer program that takes an executable file as input, and attempts to create a high level source file which can be recompiled successfully. It is therefore the opposite of a compiler, which takes a source file and makes an executable. and then read the article you posted as reference. A decompiler is used on the code – Ivano Donadi Sep 04 '17 at 11:35
  • @IvanoDonadi I think there is language barier. I mean not fully what you answer me. But i accept your answer, thank you for help! – Denis Leonov Sep 05 '17 at 08:38