0

Given a script address, is it possible to decode the Haskell/Plutus code of said script? How can you verify a script does what someone says it will do?

2
  • Somewhat but not completely I think. From one of the replies, I understand now the Plutus Core bytecode is on-chain, so this means it is possible to get the code of the smart contract if you can convert the bytecode back to Plutus / Haskell or some other language? So it's possible but just kind of hard / tedious?
    – Myles
    Commented Jan 25, 2022 at 16:30
  • Better as a comment on the original question/answer than to open a duplicate. But this question has a better title.
    – gRebel
    Commented Jan 26, 2022 at 22:40

1 Answer 1

2

On if it's possible to decode the Plutus code of a given contract, there's a possible duplicate of this question here: Can blockchain viewers read the source code of a smart contract if they know its address?.

In case that you want to verify that a compiled code sitting in the blockchain is what their creators claim to be (given that it comes from an open-source project), and you know the Plutus version they used and any other parameters needed, you could recompile the code and compare the resulting script hash with the hash on the blockchain, thus verifying the code is the same.

I'm afraid straight reading of source code from the blockchain right now is not possible. We can expect more tools and possibilities on reading contract's source code in the future since we are still in the "early days" of Cardano's smart contracts.

2
  • thanks for sharing that post, it definitely has helped my understanding. From my understanding of it, I guess it is possible to see the code of a smart contract but you have to convert it from Plutus Core bytecode to some other readable language?
    – Myles
    Commented Jan 25, 2022 at 16:30
  • Updated the answer with a small idea on comparing open code with the one on the chain. Commented Jan 25, 2022 at 16:50

Not the answer you're looking for? Browse other questions tagged or ask your own question.