0x0000000000000000000000000000000000001002
Deprecation Notice — Prop 115Per governance Proposal 115, CosmWasm code uploads (
MsgStoreCode) and contract instantiations (MsgInstantiateContract) are disabled chain-wide. The instantiate() function on this precompile will revert for all callers. Only execute(), execute_batch(), and query() against pre-existing CosmWasm contracts remain functional, and all CosmWasm functionality is deprecated in favor of EVM-only per 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, and 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 deployed at a fixed address by the Sei protocol itself, that exposes custom native chain logic to EVM-based applications. It acts like a regular contract from the EVM’s perspective, but executes privileged, low-level logic efficiently.
How Does the CosmWasm Precompile Work?
The CosmWasm precompile at address0x0000000000000000000000000000000000001002 exposes functions like execute(), execute_batch(), and query().
- Direct Integration: EVM contracts and dApps can call CosmWasm functions like any other smart contract method.
- Native Execution: Operations are executed at the Cosmos SDK level for maximum efficiency and security.
- Seamless Bridge: No need for separate wallet integrations or complex cross-chain interactions.
What You’ll Learn in This Guide
By the end of this guide, you’ll be able to:- Execute Contract Functions - Call CosmWasm contract methods and handle message formatting
- Batch Operations - Execute multiple contract calls efficiently in a single transaction
- Query Contract State - Read CosmWasm contract data without gas costs
- Handle Cross-Runtime Data - Master message encoding/decoding between EVM and CosmWasm formats
Functions
The CosmWasm precompile exposes the following functions:Transaction Functions
Query Functions
Using the Precompile
Setup
Prerequisites
Before getting started, ensure you have:- Node.js (v18 or higher)
- npm or yarn package manager
- EVM-compatible wallet
- SEI tokens for gas and contract operations
Install Dependencies
Install the required packages for interacting 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
One of the most important concepts to understand when working with the Sei CosmWasm precompile:CosmWasm Message Structure
The CosmWasm precompile requires JSON-encoded messages that conform to each contract’s specific schema:How Message Encoding Works
All CosmWasm functions require JSON-encoded byte arrays:execute()- accepts execution message as JSON bytesquery()- accepts 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 working with CosmWasm messages, use proper 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
Remember the key rule: All CosmWasm messages must be properly JSON-encoded as bytes, and contract schemas vary by implementation!
Message Format Requirements
- JSON Encoding: All messages must be valid JSON encoded as UTF-8 bytes, invalid JSON will cause transaction failures
- Schema Compliance: Messages must match the contract’s expected format
- Type Safety: Use proper data types as expected by the contract
Contract Address Format
- Use valid Sei contract addresses with
sei1...prefix - These are Cosmos-format addresses, not EVM addresses
- Contract Existence: Verify contracts exist before calling
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 hit gas limits
Best Practices
- Always validate JSON messages before sending
- Handle response parsing carefully, especially for complex data structures
- Use batch operations for multiple related calls to save gas
- Query contracts before executing to verify state when possible
View the CosmWasm precompile source code and the contract ABI here.