Address:Documentation Index
Fetch the complete documentation index at: https://seilabs.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
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.
- Cross-Chain Assets: Manage both native SEI tokens and IBC assets seamlessly from EVM contracts.
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 `hh1h
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 fees 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.js file with the following content:
.env file in the root directory with your private key and RPC URL:
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
| Error | Cause | Solution |
|---|---|---|
insufficient funds | Not enough balance for transfer | Check balance before transfer |
invalid address | Malformed address format | Use proper EVM (0x…) or Sei (sei1…) format |
unknown denomination | Token denom doesn’t exist | Verify token denomination format |
amount overflow | Amount exceeds uint256 limits | Use appropriate amount ranges |
metadata not found | Token metadata not available | Handle missing metadata gracefully |
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.