0x0000000000000000000000000000000000001001
The Sei bank precompile allows EVM applications to interact directly with Sei’s native banking system through standard smart contract calls. This enables querying balances, transferring tokens, and accessing token metadata for both native SEI tokens and Cosmos SDK-based assets, providing seamless integration between EVM and Cosmos ecosystems.
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 Bank Precompile Work?
The bank precompile at address0x0000000000000000000000000000000000001001 exposes functions like send(), sendNative(), balance(), all_balances(), and token metadata queries.
- Direct Integration: EVM contracts and dApps can call banking functions like any other smart contract method.
- Native Execution: Operations are executed at the Cosmos SDK level for maximum efficiency and security.
- Any native denom: Manage native SEI and other bank module denominations from EVM contracts.
send vs sendNative: send moves an arbitrary denom between two EVM addresses (0x...) by reading the balance directly from the bank module — no msg.value is attached. It is gated to the registered ERC20 native pointer for that denom, so it is typically invoked from the auto-deployed pointer contract rather than from arbitrary user code. sendNative is for sending native SEI (the attached msg.value) from the EVM caller to a Cosmos bech32 (sei1...) destination, which is useful for crossing the EVM→Cosmos boundary when the recipient has no associated EVM address (for example, paying a Cosmos-only contract or account).
Use Cases
- DeFi Applications: Build decentralized finance protocols that can handle native SEI and Cosmos assets.
- Portfolio Management: Build tools to track and manage multi-asset portfolios across Cosmos and EVM.
- Token Information Services: Query comprehensive token metadata for UI display and analytics.
What You’ll Learn in This Guide
By the end of this guide, you’ll be able to:- Execute Token Transfers - Send both native SEI and custom tokens between addresses
- Query Account Balances - Check single and multi-asset balances for any address
- Access Token Metadata - Retrieve names, symbols, decimals, and supply information
Functions
The bank 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 testing transfers
- Hardhat for development and testing
Install Dependencies
Install the required packages for interacting with Sei precompiles:Setup Hardhat Environment
Create ahardhat.config.ts file with the following content:
.env file needed):
Import Precompile Components
- JavaScript
- Solidity
Precompile Address: The bank precompile is deployed at
0x0000000000000000000000000000000000001001 Contract Initialization
- JavaScript
- Solidity
Set up your provider, signer, and contract instance:
Native SEI vs Custom Tokens
Native SEI Transfers:- Use
sendNative()with payable value - Denomination is always
usei(micro-SEI) - Parse to 18 digits when calling
sendNative()
- Use
send()with specific denomination - Requires prior token approval or ownership
- Support various decimal configurations
Step-by-Step Guide: Using the Bank Precompile
Send Native SEI Tokens
- JavaScript
- Solidity
Send Custom Tokens
- JavaScript
- Solidity
Query Account Balance
- JavaScript
- Solidity
Query All Balances
- JavaScript
- Solidity
Query Token Metadata
- JavaScript
- Solidity
Complete Integration Example
- JavaScript
- Solidity
Security Considerations & Risks
Transaction Security
- Amount Validation: Always validate transfer amounts and ensure sufficient balances
- Address Verification: Verify recipient addresses are valid before sending tokens
- Reentrancy Protection: Be aware of potential reentrancy when combining with other contracts
Permission Management
Troubleshooting
Common Issues and Solutions
Transaction Failures
Balance Query Issues
Error Code Reference
Important Notes
Remember: Always verify token denominations and handle errors gracefully in production applications!
- SEI Native: While reading from chain it is formatted to 6 decimal places (1 SEI = 1,000,000 usei) and while writing to chain it is parsed to 18 decimal places.
- Custom Tokens: Check decimals using
decimals()function - Display Formatting: Always format amounts with proper decimal places for user display
Gas Optimization
- Batch Operations: Use batch functions for multiple operations to save gas
- Query Efficiency: Cache frequently accessed token metadata
- Error Handling: Implement proper error handling to avoid failed transaction costs
Integration Best Practices
- Balance Checks: Always verify sufficient balance before transfers
- Error Recovery: Implement retry logic for failed transactions
- User Experience: Provide clear feedback on transaction status
- Decimal Handling: Use proper decimal formatting for different token types
View the Bank precompile source code and the contract ABI here.