Check if address has a deployed contract

Unlike the EVM in StarknetOS all addresses correspond to contracts (not accounts), but I’m not sure what’s the preferred way to check whether a given address corresponds to a deployed smart contract or not?

13 Likes

Hello!
At some point there were discussions abut having something similar to extcodehash on Ethereum. That would fit the bill, right?
I’ll ask around next week if we moved along with that

8 Likes

So I guess there’s no way to do it yet.

I think so, yes.

10 Likes

Full nodes will be able to provide this information, basically the question reduces to the following:

Is the leaf corresponding to a given address in the Merkle-Patricia tree whose root is R (available on L1) nonzero?

This information can be relayed trustlessly if you provide the path proving the leaf’s value.

7 Likes

Will you be able to read this information from inside a smart contract?

7 Likes