Skip to main content

encode_bech32

Function encode_bech32 

Source
pub fn encode_bech32(hrp: &str, data: &[u8]) -> Result<String, CoreError>
Expand description

Encodes raw bytes as a bech32 address with the given HRP.

§Arguments

  • hrp - Human-readable prefix (e.g., “erd” for MultiversX mainnet)
  • data - Raw bytes to encode (typically 32-byte public key)

§Returns

The bech32-encoded address string

§Errors

Returns an error if encoding fails