0x0000000000000000000000000000000000001002
Deprecation notice (Prop 115)Under governance Proposal 115, CosmWasm code uploads (
MsgStoreCode) and contract instantiations (MsgInstantiateContract) are disabled chain-wide. The instantiate() function on this precompile reverts for all callers. Only calls to execute(), execute_batch(), and query() against pre-existing CosmWasm contracts still work. All CosmWasm functionality is deprecated in favor of EVM-only under SIP-3.The examples on this page attach only native SEI. Do not use the coins field to build IBC or tokenfactory integrations. IBC is disabled in both directions. Tokenfactory is not a supported development path.For new smart contract development, use the EVM directly. See Deploy a Smart Contract. What is a precompile? A precompile is a special smart contract that the Sei protocol itself deploys at a fixed address. It exposes custom native chain logic to EVM-based applications. To the EVM, it behaves like a regular contract, but it executes privileged, low-level logic efficiently.
How does the CosmWasm precompile work?
The CosmWasm precompile at address0x0000000000000000000000000000000000001002 exposes functions such as execute(), execute_batch(), and query().
- EVM contracts and dApps can call CosmWasm functions directly, like any other smart contract method.
- Operations run natively at the Cosmos SDK level for efficiency and security.
- You do not need separate wallet integrations or complex cross-chain interactions.
What you’ll learn in this guide
After you finish this guide, you can:- Call CosmWasm contract functions and handle message formatting.
- Run batch operations that execute multiple contract calls efficiently in a single transaction.
- Query contract state to read CosmWasm contract data without gas costs.
- Handle cross-runtime data by encoding and decoding messages between EVM and CosmWasm formats.
Functions
The CosmWasm precompile exposes these functions:Transaction functions
Query functions
Using the precompile
Setup
Prerequisites
Before you start, make sure that you have:- Node.js (v18 or higher)
- The npm or yarn package manager
- An EVM-compatible wallet
- SEI tokens for gas and contract operations
Install dependencies
Install the required packages to interact with Sei precompiles:Import precompile components
Precompile address: The CosmWasm precompile is deployed at
0x0000000000000000000000000000000000001002. Contract initialization
Set up your provider, signer, and contract instance:Critical: Understanding message formats
CosmWasm message structure
The CosmWasm precompile requires JSON-encoded messages that match each contract’s own schema:How message encoding works
All CosmWasm functions require JSON-encoded byte arrays:execute(): accepts the execution message as JSON bytesquery(): accepts the query message as JSON bytes
- Use
msg.valuefor SEI amounts - Pass an empty JSON array for
coinswhen the call does not require Bank Module funds
Best practice: Message encoding helpers
When you work with CosmWasm messages, use correct JSON encoding:Message format helpers
Use these helper functions to handle CosmWasm message formatting:Step-by-step guide: Using the CosmWasm precompile
Execute a CosmWasm contract
- JavaScript
- Solidity
Execute batch operations
- JavaScript
- Solidity
Query a CosmWasm contract
- JavaScript
- Solidity
Advanced usage examples
Cross-runtime DeFi integration
Complete integration example
- JavaScript
- Solidity
Troubleshooting
Common issues and solutions
Message encoding issues
Error code reference
Important notes
All CosmWasm messages must be correctly JSON-encoded as bytes. Contract schemas vary by implementation.
Message format requirements
- JSON encoding: All messages must be valid JSON, encoded as UTF-8 bytes. Invalid JSON causes transaction failures.
- Schema compliance: Messages must match the contract’s expected format.
- Type safety: Use the data types that the contract expects.
Contract address format
- Use valid Sei contract addresses with the
sei1...prefix. - These are Cosmos-format addresses, not EVM addresses.
- Contract existence: Verify that contracts exist before you call them.
Cross-runtime considerations
- State isolation: CosmWasm and EVM contracts have separate state.
- Gas estimation: CosmWasm operations may require different gas calculations.
- Error handling: Failed CosmWasm operations revert the entire EVM transaction.
- Native SEI handling: Use
msg.valuefor SEI and leave thecoinslist empty. - Batch limitations: Large batches may reach gas limits.
Best practices
- Always validate JSON messages before you send them.
- Parse responses carefully, especially for complex data structures.
- Use batch operations for multiple related calls to save gas.
- When possible, query contracts to verify their state before you execute calls on them.