Skip to main content
Address: 0x0000000000000000000000000000000000001002
Deprecation Notice — Prop 115 & Prop 116Per 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.In addition, Proposal 116 disables inbound IBC transfers — IBC assets bridged from Cosmos chains can no longer arrive on Sei after this passes and is activated. See the SIP-03 Migration Guide for affected assets and migration routes.For new smart contract development, use the EVM directly. See Deploy a Smart Contract.
The Sei CosmWasm precompile allows EVM applications to interact directly with pre-existing CosmWasm contracts through standard smart contract calls. This enables execution, batch operations, and querying of CosmWasm contracts directly from your dApps without needing separate Cosmos SDK integration.
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 address 0x0000000000000000000000000000000000001002 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

The instantiate() function has been disabled by Prop 115 and will revert. It is omitted from this reference. The ABI in @sei-js/precompiles may still expose it for backwards compatibility, but calling it on-chain will fail.

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 bytes
  • query() - accepts query message as JSON bytes
Native Token Handling:
  • Use msg.value for SEI amounts
  • Use coins parameter for other denominations (encoded as JSON bytes)

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

Execute Batch Operations

Query a CosmWasm Contract

Query Limitations: CosmWasm queries are read-only operations and don’t consume gas, but parsing JSON responses in Solidity is complex. Consider handling response parsing off-chain.

Advanced Usage Examples

Cross-Runtime DeFi Integration

Complete Integration Example

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 Token Handling: Use msg.value for SEI, coins for other denominations
  • 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.