On What basis Zcash keys are encoded in?

// guarantees the first 2 characters, when base58 encoded, are “t1” keyConstants.base58Prefixes[PUBKEY_ADDRESS] = {0x1C,0xB8};

How is t1 => {0x1C, 0xB8} ?
How are these converted?

How can I do these converts for other prefixes?
suppose: Pp, Ll, pk, PL

1 Like

This is specific to Base58. I would strongly recommend that for new protocols (e.g. new Zcash forks or shielded protocols) that bech32 or bech32m be used, rather than Base58. Those allow the prefix or “Human-Readable Part” to be specified directly.

That said, the above prefix was found as follows: append the correct number of bytes for an address to the candidate prefix, first using 0x00 bytes and then using 0xFF bytes, and encode the result as Base58. If both of those encodings start with the desired string, then the prefix is correct. (Knowledge of the order of the Base58 character set can be used to speed up the search, but it still involves some trial and error.) Note that this only works if the length of an address is fixed, as it is for Zcash transparent and Sprout addresses.


You won’t be able to have Ll because lowercase L is not part of the base 58 alphabet.