<p><a href="https://github.com/Python-Cardano/pycardano" rel="nofollow noreferrer">PyCardano</a> can help you to find the address type.</p>
<p>For example, <a href="https://cardanoscan.io/address/addr1wyzynye0nksztrfzpsulsq7whr3vgh7uvp0gm4p0x42ckkqqq6kxq" rel="nofollow noreferrer">addr1wyzynye0nksztrfzpsulsq7whr3vgh7uvp0gm4p0x42ckkqqq6kxq</a> is the script address of <a href="https://spacebudz.io/FAQ/" rel="nofollow noreferrer">Spacebudz</a>. You can decode it into an <code>Address</code> object using pycardano, and the <code>address_type</code> field will tell you the information about this address.</p>
<pre><code>&gt;&gt;&gt; from pycardano import Address
&gt;&gt;&gt; addr = Address.from_primitive(&quot;addr1wyzynye0nksztrfzpsulsq7whr3vgh7uvp0gm4p0x42ckkqqq6kxq&quot;)
&gt;&gt;&gt; addr.address_type
&lt;AddressType.SCRIPT_NONE: 7&gt;
</code></pre>
<p>The output <code>SCRIPT_NONE</code> tells us that this address's payment part is a script (first half is <code>SCRIPT</code>), and the address doesn't have staking part (second half is <code>NONE</code>). All possible address types could be found in this <a href="https://pycardano.readthedocs.io/en/latest/api/pycardano.address.html#pycardano.address.AddressType" rel="nofollow noreferrer">doc</a>.</p>

CC BY-SA 4.0
2023-02-17T05:57:10.950Z
2023-02-17T05:57:10.950Z
Jerry
<p>I have a script to fetch asset name, address from a policy id with blockfrost API, now I need to see if the asset is in a smart contract script. I have no coding skills but followed a tutorial to get this far. Thanks!</p>

<blockfrost><address><script><python>
Whats the python script to check if an cardano address has a script flag?
# Whats the python script to check if an cardano address has a script flag?

(Asked by: username_0 on 2023-02-16)

I have a script to fetch asset name, address from a policy id with blockfrost API, now I need to see if the asset is in a smart contract script. I have no coding skills but followed a tutorial to get this far. Thanks!

**Tags:** blockfrost, address, script, python

---

## 1 answers

### Answer by username_1 on 2023-02-17. Score: 2

PyCardano can help you to find the address type.
For example, addr1wyzynye0nksztrfzpsulsq7whr3vgh7uvp0gm4p0x42ckkqqq6kxq is the script address of Spacebudz. You can decode it into an Address object using pycardano, and the address_type field will tell you the information about this address.
>>> from pycardano import Address
>>> addr = Address.from_primitive("addr1wyzynye0nksztrfzpsulsq7whr3vgh7uvp0gm4p0x42ckkqqq6kxq")
>>> addr.address_type


The output SCRIPT_NONE tells us that this address's payment part is a script (first half is SCRIPT), and the address doesn't have staking part (second half is NONE). All possible address types could be found in this doc.


---

