Skip to main content
Address: 0x0000000000000000000000000000000000000400 Related Module: Address conversion utilities The Bech32 precompile provides address format conversion functionality between Ethereum hex addresses and Cosmos bech32 addresses.

Overview

The Bech32 precompile exposes simple conversion helpers so Solidity contracts can:
  1. Convert an Ethereum address to a Bech32 string with a desired prefix (e.g. cosmos).
  2. Convert any Bech32 address string back into an EVM address.
It is a thin wrapper around the Cosmos address‐conversion library and lives at 0x0000000000000000000000000000000000000400.

Primary Methods

hexToBech32

Signature: hexToBech32(address addr, string memory prefix) → string memory Description: Converts an Ethereum hex address to Cosmos bech32 format using the specified prefix.
Parameters:
  • addr (address): The Ethereum hex address to convert
  • prefix (string): The bech32 prefix to use (e.g., “cosmos”)
Returns: String containing the bech32 formatted address

bech32ToHex

Signature: bech32ToHex(string memory bech32Address) → address Description: Converts a Cosmos bech32 address to Ethereum hex format.
Parameters:
  • bech32Address (string): The bech32 formatted address to convert
Returns: Ethereum address in hex format

Full Interface & ABI

Bech32 Solidity Interface
Bech32 ABI