<p>You can find the actual compiled Plutus Core bytecode on-chain. However, it is not human readable source code, but rather pre-processed / compiled haskell code.</p>
<p>As you mention, it is passed along as part of the transaction and it is &quot;executed by nodes during transaction validation ‘live’ on the chain&quot; <em>(see <a href="https://docs.cardano.org/plutus/learn-about-plutus" rel="nofollow noreferrer">https://docs.cardano.org/plutus/learn-about-plutus</a>)</em>.</p>
<p>You can find examples of how the code appears on-chain on cardanoscan, eg here's a random recent example:</p>
<p><a href="https://cardanoscan.io/transaction/68cfaf710b7267cd01b0b3d3e6889548a5776e653bdb44ae6a9512daa44bcbce?tab=contracts" rel="nofollow noreferrer">https://cardanoscan.io/transaction/68cfaf710b7267cd01b0b3d3e6889548a5776e653bdb44ae6a9512daa44bcbce?tab=contracts</a></p>
<p>Here's also some info on how those scripts can be created / exported for use in a tx:</p>
<p><a href="https://plutus.readthedocs.io/en/latest/plutus/howtos/exporting-a-script.html" rel="nofollow noreferrer">https://plutus.readthedocs.io/en/latest/plutus/howtos/exporting-a-script.html</a></p>

CC BY-SA 4.0
2022-01-24T18:32:15.177Z
2022-01-24T22:49:16.310Z
2022-01-24T22:49:16.310Z
sean
<p>Not exactly, the only part of the smart contract that actually lives on-chain is the script hash. Think of it as a compressed/hashed representation of how the real script (run off-chain) <em>should</em> work. These hashes are then used to create script addresses whose UTXOs can only be used as inputs for a new transaction <strong>if</strong> that transaction's script hash matches the hash at the script address.</p>
<p>In other words, script addresses act as guards for their UTXOs, and the only way to get past the guard (and thus use the UTXO as an input for your transaction) is to provide a proof that your transaction complies exactly with the logic set forth by the guard's author. The actual logic must therefore be performed in a local environment. There can be many ways to acquire the code itself, which the <a href="https://iohk.io/en/blog/posts/2021/10/25/new-certification-levels-for-smart-contracts-on-cardano/" rel="noreferrer">upcoming dApp certification program</a> will help with.</p>

CC BY-SA 4.0
2022-01-25T08:05:07.980Z
In addition to what @nomad0 said, since one has to prove when consuming an UTxO at such an address what the "quard" is by appending the scripts logic to the transaction, from then on the logic is public. That is, since anyone can view that transaction, the appended script logic is also publicly viewable and verifiable. Note though that this logic is in some non human readable Plutus core form.
Fermat
CC BY-SA 4.0
2022-01-23T14:35:01.743Z
2022-01-24T18:48:48.933Z
2022-01-24T18:48:48.933Z
zhekson
<p>Yes. The contract bytecode is publicly available and executed on the blockchain. If you are able to decompile Plutus Core, you can re-create the source code.</p>

CC BY-SA 4.0
2023-01-12T18:29:24.653Z
2023-01-12T18:29:24.653Z
Displee
<p>I'm curious, is it possible to find the source code of the validation script of a smart contract (as well as other parts) that is already on the blockchain?</p>
<p>Or this code automatically picking up into the spending transaction that is referring to the smart contract address?</p>
<p>As I know, we need to provide the actual validation script in the spending transaction.</p>
<p>On the one hand it is a question of transparency, on the other hand of intellectual property.</p>

<plutus-pioneer-program>
Can blockchain viewers read the source code of a smart contract if they know its address?
# Can blockchain viewers read the source code of a smart contract if they know its address?

(Asked by: username_0 on 2022-01-23)

I'm curious, is it possible to find the source code of the validation script of a smart contract (as well as other parts) that is already on the blockchain?

Or this code automatically picking up into the spending transaction that is referring to the smart contract address?

As I know, we need to provide the actual validation script in the spending transaction.

On the one hand it is a question of transparency, on the other hand of intellectual property.

**Tags:** plutus-pioneer-program

---

## 3 answers

### Answer by username_2 on 2022-01-23. Score: 8 | Accepted answer

Not exactly, the only part of the smart contract that actually lives on-chain is the script hash. Think of it as a compressed/hashed representation of how the real script (run off-chain) *should* work. These hashes are then used to create script addresses whose UTXOs can only be used as inputs for a new transaction **if** that transaction's script hash matches the hash at the script address.

In other words, script addresses act as guards for their UTXOs, and the only way to get past the guard (and thus use the UTXO as an input for your transaction) is to provide a proof that your transaction complies exactly with the logic set forth by the guard's author. The actual logic must therefore be performed in a local environment. There can be many ways to acquire the code itself, which the [upcoming dApp certification program](https://iohk.io/en/blog/posts/2021/10/25/new-certification-levels-for-smart-contracts-on-cardano/) will help with.

> **Comments:**
> **username_3**: In addition to what @nomad0 said, since one has to prove when consuming an UTxO at such an address what the "quard" is by appending the scripts logic to the transaction, from then on the logic is public. That is, since anyone can view that transaction, the appended script logic is also publicly viewable and verifiable. Note though that this logic is in some non human readable Plutus core form.  

---

### Answer by username_1 on 2022-01-24. Score: 5

You can find the actual compiled Plutus Core bytecode on-chain. However, it is not human readable source code, but rather pre-processed / compiled haskell code.

As you mention, it is passed along as part of the transaction and it is "executed by nodes during transaction validation ‘live’ on the chain" *(see <https://docs.cardano.org/plutus/learn-about-plutus>)*.

You can find examples of how the code appears on-chain on cardanoscan, eg here's a random recent example:

<https://cardanoscan.io/transaction/68cfaf710b7267cd01b0b3d3e6889548a5776e653bdb44ae6a9512daa44bcbce?tab=contracts>

Here's also some info on how those scripts can be created / exported for use in a tx:

<https://plutus.readthedocs.io/en/latest/plutus/howtos/exporting-a-script.html>


---

### Answer by username_4 on 2023-01-12. Score: 0

Yes. The contract bytecode is publicly available and executed on the blockchain. If you are able to decompile Plutus Core, you can re-create the source code.


---

