Skip to main content
Address: 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.
The Sei CosmWasm precompile lets EVM applications interact directly with pre-existing CosmWasm contracts through standard smart contract calls. You can call CosmWasm contracts directly from your dApps for execution, batch operations, and queries. You do not need a separate Cosmos SDK integration.
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 address 0x0000000000000000000000000000000000001002 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

Prop 115 disabled the instantiate() function, so calls to it revert. This reference omits it. The ABI in @sei-js/precompiles may still expose it for backward compatibility, but on-chain calls to it fail.

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 bytes
  • query(): accepts the query message as JSON bytes
Native SEI handling:
  • Use msg.value for SEI amounts
  • Pass an empty JSON array for coins when 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

Execute batch operations

Query a CosmWasm contract

Query limitations: Consider parsing responses off-chain. CosmWasm queries are read-only operations and do not consume gas. However, parsing JSON responses in Solidity is complex.

Advanced usage examples

Cross-runtime DeFi integration

Complete integration example

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.value for SEI and leave the coins list 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.