Import
Signature
Derive CAIP-2 network identifier from an Algorand genesis hash. Following the Algorand CAIP-2 profile, the reference is the first 32 characters of the URL-safe base64 encoding of the raw 32-byte genesis hash.

Parameters

str | bytes
required
32-byte genesis hash (raw bytes or base64-encoded string).

Returns

str
CAIP-2 network identifier (e.g. “algorand:wGHE2Pwdvd7S12BL5FaOP20EGYesN73k”).

Raises

  • TypeError: If genesis_hash is neither str nor bytes.
  • NetworkError: If genesis_hash is not valid base64.

Examples

Source: x402_algorand/utils.py