user2897: On Ethereum, for example, there is a way to see the Solidity code that is deployed in a specific address (as long as the code gets verified).
Is there a way to achieve this same behaviour in Cardano?

user6763: Edit

I just realized I misunderstood your question, you are searching for a way to get the Plutus code starting from an address, not to get and address from your Plutus code!
I'm leaving the old answer below just in case it can help
Last answer

In Cardano, you need to include the serialized Plutus script in your transaction to interact with it so it is assumed you have/know the code of the smart contract you want to interact with

as soon the Vasil hard fork goes through you should be able to refer to the script from a previous transaction (this doesn't change the fact you know where your script is so you know where to get it)

so by protocol there should be nothing like that
however, if you go on sites like https://cardanoscan.io and search for a specific smart contract address you should be able to see on the bottom of the page two tabs: Transactions and Script
the script is visible only if the smart contract is verified there as in Ethereum
Old answer

using cardano-cli

once you have your serialized smart contract (which you can obtain as described in this other answer)
you can run
cardano-cli address build --$your_net --payment-script-file path/to/your-validator.plutus.json

where your-validator.plutus.json is the output of writeFileTextEnvelope in the answer cited above
this will print out the corresponding validator address
using PlutusTx

in the Ledger.Typed.Scripts module there is a validatorAddress function that is so defined:
validatorAddress :: TypedValidator a -> Address

once you have an Address you can use show on it in order to get a string, or if you want just print it to the standard output you can use print

NOTE: if you have an untyped Validator rather than a TypedValidator a, and you still want to use the PlutusTx way, you could use:
unsafeMkTypedValidator :: Validator -> TypedValidator Any



2897: <p>On Ethereum, for example, there is a way to see the Solidity code that is deployed in a specific address (as long as the code gets verified).</p>
<p>Is there a way to achieve this same behaviour in Cardano?</p>
 6763: <h1>Edit</h1>
<hr />
<p>I just realized I misunderstood your question, you are searching for a way to get the Plutus code starting from an address, not to get and address from your Plutus code!</p>
<p>I'm leaving the old answer below just in case it can help</p>
<h1>Last answer</h1>
<hr />
<p>In Cardano, you need to include the serialized Plutus script in your transaction to interact with it so it is assumed you have/know the code of the smart contract you want to interact with</p>
<blockquote>
<p>as soon the Vasil hard fork goes through you should be able to refer to the script from a previous transaction (this doesn't change the fact you know where your script is so you know where to get it)</p>
</blockquote>
<p>so by protocol there should be nothing like that</p>
<p>however, if you go on sites like <a href="https://cardanoscan.io" rel="nofollow noreferrer">https://cardanoscan.io</a> and search for a specific smart contract address you should be able to see on the bottom of the page two tabs: <code>Transactions</code> and <code>Script</code></p>
<p>the script is visible only if the smart contract is verified there as in Ethereum</p>
<h1>Old answer</h1>
<hr />
<h2>using <code>cardano-cli</code></h2>
<hr />
<p>once you have your serialized smart contract (which you can obtain as described in <a href="https://cardano.stackexchange.com/a/8481/6763">this other answer</a>)</p>
<p>you can run</p>
<pre><code>cardano-cli address build --$your_net --payment-script-file path/to/your-validator.plutus.json
</code></pre>
<p>where <code>your-validator.plutus.json</code> is the output of <code>writeFileTextEnvelope</code> in the answer cited above</p>
<p>this will print out the corresponding validator address</p>
<h2>using <code>PlutusTx</code></h2>
<hr />
<p>in the <a href="https://playground.plutus.iohkdev.io/doc/haddock/plutus-ledger/html/Ledger-Typed-Scripts.html" rel="nofollow noreferrer"><code>Ledger.Typed.Scripts</code> module</a> there is a <code>validatorAddress</code> function that is so defined:</p>
<pre><code>validatorAddress :: TypedValidator a -&gt; Address
</code></pre>
<p>once you have an <code>Address</code> you can use <code>show</code> on it in order to get a string, or if you want just print it to the standard output you can use <code>print</code></p>
<blockquote>
<p><strong><em>NOTE:</em></strong> if you have an untyped <code>Validator</code> rather than a <code>TypedValidator a</code>, and you still want to use the <code>PlutusTx</code> way, you could use:</p>
<pre><code>unsafeMkTypedValidator :: Validator -&gt; TypedValidator Any
</code></pre>
</blockquote>
