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?
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
So I guess there’s no way to do it yet.
I think so, yes.
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.
Will you be able to read this information from inside a smart contract?
In Starknet, you can use the getClassHashAt
RPC method or starknet_getClassHashAt
via a provider. If the address has a deployed contract, it will return the class hash; if not, it typically returns 0x0
or throws an error. This is the standard way to check for deployed contracts.
The question was whether smart contracts can check that.
-Hello! Have you ever encountered a situation like this? I transferred Starknet coins from an exchange to a wallet. There were no transactions for a year. After the last transfers, all the coins were transferred to a smart contract. I don’t understand where it came from or what to do with it. The support team responded that the system can deploy a smart contract on its own during interactions (in short). According to Starknet, an account is a smart contract. What kind of interaction is this? And how did it happen? There were no transactions with other dApps.
Hi @Android
This is a great question — and yes, it can definitely be confusing if you’re newer to Starknet.
Let me try to break it down:
On Starknet, accounts are smart contracts.
This means that when you create a wallet, what you’re actually doing is deploying an account contract on-chain. It’s very different from EVM chains like Ethereum, where wallets are just keypairs.
So what likely happened:
When you first funded the address from an exchange, the account contract hadn’t yet been deployed (especially if you were using an “account abstraction” wallet like Argent X or Braavos). Later on, once you interacted with your wallet or approved a transaction, the wallet client auto-deployed the smart contract account using those initial funds (Starknet ETH) to cover gas.
Even if there were no dApp interactions, this account deployment is considered a transaction. You can check this on Starkscan or Voyager by looking at the first transaction from your wallet — it will probably say something like “Deploy Account”.
just incase you’re not sure where your funds went, I’d recommend checking:
- starkscan.co (search your address)
- Look for a
DEPLOY_ACCOUNT
transaction - The account it was deployed to should match your wallet address
Let me know if you need help interpreting what you see — happy to help!