Is there an easy way to query how many EVM smart contracts has been deployed in a Substrate chain?

1 Answer 1


One way is by querying chain state for all entries of EVM::AccountCodes or EVM::AccountCodesMetadata storages and counting them. For each deployed contract, its code is stored in AccountCodes.

Keep in mind that depending on the chain this storage might be big and could be really slow to query all entries. If this is the case, use paged storage query.

P.S This doesn't take into account precompiles (but they can be manually injected with a dummy code).

  • 1
    Thanks for your answer! Commented Jan 18 at 15:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.