Expand description
Utilities for working with chain identifier strings.
A chain identifier can appear in two formats:
- the legacy short form: the first 4 bytes of the digest, hex-encoded, e.g.
35834a8a. This is the format returned by JSON-RPC, the format rendered byChainIdentifier’sDisplay, and the only format this tooling ever writes — intoMove.tomlandclient.yaml. - the full Base58 form: the full genesis checkpoint digest, Base58-encoded (the format returned
by the gRPC and GraphQL APIs), e.g.
4btiuiMPvEENsttpZC7CZ53DruC3MAgfznDbASZ7DR6S.
We never write the Base58 form, but a user may paste it (e.g. copied from a gRPC/GraphQL
response or an explorer) into a Move.toml [environments] entry, while the CLI environment
and client.yaml cache hold the hex short form. Comparisons must therefore treat the two
encodings of the same digest as equal.
Functions§
- chain_
id_ base58 - The full Base58-encoded genesis checkpoint digest for
chain_id— the canonical chain identifier format. (ChainIdentifier’sDisplayrenders the legacy 4-byte hex short form.) - chain_
ids_ match - Compare two chain identifier strings, each of which may independently be in the canonical Base58 form or the legacy hex short form. A short form matches a full form if it encodes the first 4 bytes of the digest. Strings in neither format (e.g. ad-hoc identifiers used by tests or other flavors) only match by exact string equality.