Bitcoin decompiler

1

Is there any tool for Bitcoin blockchain decompiling?

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

D L

Posted 2017-08-23T11:01:55.233

Reputation: 478

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 2019-02-26T00:02:29.923

Answers

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

Posted 2017-08-23T11:01:55.233

Reputation: 219

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?D L 2017-08-23T17:07:12.923

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 2017-08-23T20:18:05.010

@Denis how can you undo something that was never done?? It is not impossible or impratictical, it just never happened.Ivano Donadi 2017-08-24T10:06:03.353

@IvanoDonadi I need full transparency for my tasksD L 2017-08-26T00:12:15.950

@Denis you are just not getting it. Read my edit please and try to understandIvano Donadi 2017-08-26T07:14:00.877

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.D L 2017-08-28T01:17:47.173

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 2017-08-28T05:42:17.207

@IvanoDonadi thank you very much! •sarcasm•D L 2017-09-03T23:43:59.667

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 codeIvano Donadi 2017-09-04T11:35:32.800

@IvanoDonadi I think there is language barier. I mean not fully what you answer me. But i accept your answer, thank you for help!D L 2017-09-05T08:38:24.197