> ## Documentation Index
> Fetch the complete documentation index at: https://seilabs-docs-retire-ibc-tokenfactory-guides.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Bank Precompile

> Query and transfer native SEI through Sei's Bank precompile.

**Address:** `0x0000000000000000000000000000000000001001`

<Warning>
  This page covers native SEI (`usei`) only. Do not use the Bank precompile as an IBC or tokenfactory integration path. IBC is disabled in both directions, and tokenfactory is not supported for new development. See [IBC is disabled](/learn/sip-03-migration#ibc-is-disabled) and [Tokenfactory is not supported](/cosmos-sdk#tokenfactory-is-not-supported).
</Warning>

The Bank precompile exposes the Bank Module balance for native SEI and lets an EVM caller send SEI to a native `sei1...` address.

## Functions

```solidity theme={"dark"}
/// Returns an account's Bank Module balance for the requested denomination.
function balance(
    address account,
    string memory denom
) external view returns (uint256 amount);

/// Sends the attached native SEI to a native Sei address.
function sendNative(
    string memory toNativeAddress
) external payable returns (bool success);
```

The examples below use `balance()` with `usei`. They do not cover arbitrary Bank Module denominations.

## Setup

```bash theme={"dark"}
npm install ethers @sei-js/precompiles
```

```typescript theme={"dark"}
import { ethers } from 'ethers';
import {
  BANK_PRECOMPILE_ABI,
  BANK_PRECOMPILE_ADDRESS,
} from '@sei-js/precompiles';

const provider = new ethers.BrowserProvider(window.ethereum);
const signer = await provider.getSigner();

const readBank = new ethers.Contract(
  BANK_PRECOMPILE_ADDRESS,
  BANK_PRECOMPILE_ABI,
  provider,
);

const writeBank = new ethers.Contract(
  BANK_PRECOMPILE_ADDRESS,
  BANK_PRECOMPILE_ABI,
  signer,
);
```

## Query a native SEI balance

Bank Module queries return native SEI in `usei`, where 1 SEI equals 1,000,000 `usei`.

```typescript theme={"dark"}
const account = '0x1234567890123456789012345678901234567890';
const balanceUsei = await readBank.balance(account, 'usei');

console.log(`${ethers.formatUnits(balanceUsei, 6)} SEI`);
```

You can make the same query from Solidity:

```solidity theme={"dark"}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

interface IBankPrecompile {
    function balance(
        address account,
        string memory denom
    ) external view returns (uint256 amount);
}

contract SeiBalanceReader {
    IBankPrecompile private constant BANK =
        IBankPrecompile(0x0000000000000000000000000000000000001001);

    function nativeSeiBalance(address account) external view returns (uint256) {
        return BANK.balance(account, "usei");
    }
}
```

## Send native SEI to a native address

`sendNative()` accepts SEI through `msg.value`. Use an 18-decimal EVM value for the transaction.

```typescript theme={"dark"}
const recipient = 'sei1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq6s8dpw';

const transaction = await writeBank.sendNative(recipient, {
  value: ethers.parseEther('0.1'),
});

await transaction.wait();
```

From Solidity, forward the attached value to the precompile:

```solidity theme={"dark"}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

interface IBankPrecompile {
    function sendNative(
        string memory toNativeAddress
    ) external payable returns (bool success);
}

contract NativeSeiSender {
    IBankPrecompile private constant BANK =
        IBankPrecompile(0x0000000000000000000000000000000000001001);

    function sendToNativeAddress(
        string calldata recipient
    ) external payable {
        require(msg.value > 0, "No SEI attached");
        require(
            BANK.sendNative{value: msg.value}(recipient),
            "Transfer failed"
        );
    }
}
```

Validate the recipient before sending. A successful transaction cannot be reversed.
