Address: 0x0000000000000000000000000000000000001004
The Sei Address precompile allows EVM applications to interact directly with Sei’s address association system through standard smart contract calls. This enables querying and creating mappings between EVM addresses and their corresponding Cosmos addresses, enabling seamless cross-chain address management 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 Address Precompile Work?
The Address precompile at address 0x0000000000000000000000000000000000001004 exposes functions like associate(), associatePubKey(), getSeiAddr(), and getEvmAddr().
- Direct Integration: EVM contracts and dApps can call address association 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.
Use Cases
- Cross-Chain Identity: Link EVM and Cosmos addresses for unified user experiences across both execution environments.
- Address Resolution: Build applications that can seamlessly work with both EVM and Cosmos address formats.
- Wallet Integration: Enable users to associate their addresses once and use both EVM and native Sei functionality.
- DeFi Applications: Create protocols that can interact with users regardless of their preferred address format.
What You’ll Learn in This Guide
By the end of this guide, you’ll be able to:
- Integrate Address Operations - Call association and lookup functions directly from your EVM contracts and dApps
- Handle Signature Verification - Master the signature format requirements for secure address association
- Manage Address Mappings - Query and validate address relationships between EVM and Cosmos formats
- Build Cross-Chain Tools - Implement unified address management for applications spanning both execution environments
- Navigate Association Requirements - Understand when and how address association occurs automatically vs. manually
Functions
The Address 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
- Hardhat development environment set up
Install Dependencies
Install the required packages for interacting with Sei precompiles:
Setup Hardhat Environment
Create a hardhat.config.ts file with the following content:
Store your private key in Hardhat’s encrypted keystore (no plaintext .env file needed):
Import Precompile Components
Precompile Address: The address precompile is deployed at 0x0000000000000000000000000000000000001004
Contract Initialization
Set up your provider, signer, and contract instance:
When Does Association Happen?
Address association between EVM and Cosmos addresses occurs automatically in most cases:
How Association Works
Automatic Association:
- Occurs when a wallet first signs and broadcasts any transaction on Sei
- No additional steps required for most users
- Association is permanent once created
Manual Association:
- Use
associate() for signature-based association
- Use
associatePubKey() for public key-based association
- Useful for advanced applications or when automatic association hasn’t occurred
EVM Addresses:
- Standard Ethereum format:
0x1234... (20 bytes, 40 hex characters)
- Case-insensitive but typically lowercase
Sei Addresses:
- Cosmos format with
sei1... prefix for regular addresses
- Validator addresses use
seivaloper1... prefix
- Bech32 encoding format
Step-by-Step Guide: Using the Address Precompile
Associate Address with Signature
Associate Address with Public Key
Query Sei Address from EVM Address
Query EVM Address from Sei Address
Complete Integration Example
Contract ExampleClient Integration ExampleDeploy the contract:Then run:Then run the interaction script:
Security Considerations & Risks
Association Permanence
- Permanent Mapping: Once addresses are associated, the mapping cannot be changed or removed
- Single Association: Each address can only be associated with one counterpart
- Verification: Always verify associations before depending on them in critical operations
Signature Security
- Custom Messages: Use unique, timestamped messages to prevent replay attacks
- Message Format: Follow exact Ethereum Signed Message format for compatibility
Troubleshooting
Common Issues and Solutions
Error Code Reference
Important Notes
Remember: Address associations are permanent and cannot be changed once created!
- EVM Addresses: Use standard Ethereum format with
0x prefix
- Sei Addresses: Use Cosmos format with
sei1 prefix for regular addresses
- Case Sensitivity: EVM addresses are case-insensitive, Sei addresses are case-sensitive
Association Timing
- Automatic: Most users get associated automatically on their first transaction
- Manual: Use precompile functions for programmatic association or when automatic association hasn’t occurred
- Verification: Always verify associations exist before depending on them
Signature Requirements
- Message Format: Must include Ethereum Signed Message prefix for
associate() function
- Component Format: v, r, s must be properly formatted hex strings
- Replay Protection: Use unique messages to prevent signature replay attacks
Gas Considerations
- Association operations: ~200,000 gas limit recommended
- Query operations: Standard view function gas usage
- Batch operations: Scale gas limits based on array size
View the Address precompile source code and the contract ABI
here.