AccountCodes
Storage Map v210 → currentMaps EVM addresses to their deployed contract bytecode.
Explore chainQueried by: developersanalytics
The Big Picture
Every deployed contract's bytecode is stored here. If an address has code, it's a contract; if not, it's an externally owned account (EOA). This is how the EVM knows what to execute.
Use Cases
- Verify contract deployment
- Distinguish contracts from EOAs
- Build contract explorers
- Debug contract interactions
Purpose & Usage
Purpose
Stores the executable code for each deployed smart contract.
Common Query Patterns
- Query by H160 address
- Check if address has code (is contract)
Query Keys
| # | Name | Type | Description |
|---|---|---|---|
| 1 | key1 | H160 | key1 (H160) |
Stored Value
Vec<u8> Vec
value (Vec<u8>)
Relationships
Related Events
Code Examples
import { ApiPromise, WsProvider } from "@polkadot/api";
import { stringCamelCase } from "@polkadot/util";
const provider = new WsProvider("wss://entrypoint-finney.opentensor.ai:443");
const api = await ApiPromise.create({ provider });
// Query AccountCodes storage
const key1 = 0 as any /* H160 */;
const result = await api.query
[stringCamelCase("EVM")]
[stringCamelCase("AccountCodes")](
key1
);
console.log("AccountCodes:", result.toHuman());Runtime Info
- Pallet
- EVM
- Storage Kind
- Map
- First Version
- v210
- Current Version
- v393