Returns a codec for encoding and decoding base-58 strings.
This codec serializes strings using a base-58 encoding scheme, commonly used in cryptocurrency addresses and other compact representations.
Encoding and decoding a base-58 string.
const codec = getBase58Codec();const bytes = codec.encode('heLLo'); // 0x1b6a3070const value = codec.decode(bytes); // "heLLo" Copy
const codec = getBase58Codec();const bytes = codec.encode('heLLo'); // 0x1b6a3070const value = codec.decode(bytes); // "heLLo"
This codec does not enforce a size boundary. It will encode and decode all bytes necessary to represent the string.
If you need a fixed-size base-58 codec, consider using fixCodecSize.
const codec = fixCodecSize(getBase58Codec(), 8); Copy
const codec = fixCodecSize(getBase58Codec(), 8);
If you need a size-prefixed base-58 codec, consider using addCodecSizePrefix.
const codec = addCodecSizePrefix(getBase58Codec(), getU32Codec()); Copy
const codec = addCodecSizePrefix(getBase58Codec(), getU32Codec());
Separate getBase58Encoder and getBase58Decoder functions are available.
const bytes = getBase58Encoder().encode('heLLo');const value = getBase58Decoder().decode(bytes); Copy
const bytes = getBase58Encoder().encode('heLLo');const value = getBase58Decoder().decode(bytes);
A VariableSizeCodec<string> for encoding and decoding base-58 strings.
VariableSizeCodec<string>
Returns a codec for encoding and decoding base-58 strings.
This codec serializes strings using a base-58 encoding scheme, commonly used in cryptocurrency addresses and other compact representations.
Example
Encoding and decoding a base-58 string.
Remarks
This codec does not enforce a size boundary. It will encode and decode all bytes necessary to represent the string.
If you need a fixed-size base-58 codec, consider using fixCodecSize.
If you need a size-prefixed base-58 codec, consider using addCodecSizePrefix.
Separate getBase58Encoder and getBase58Decoder functions are available.
See