0

When generating a monero address and one of the 8-byte blocks is less than 11 characters, it states I can pad it with the character 1. Do I always add 1 to the beginning of the block output or at the end?

if a particular block converts to <11 characters, the conversion pads it with "1"s (1 is 0 in Base58)

Monero base58 is not like Bitcoin base58, bytes are converted in 8-byte blocks. The last block can have less than 8 bytes, but at least 1 byte. Eight bytes converts to 11 or less Base58 characters; if a particular block converts to <11 characters, the conversion pads it with "1"s (1 is 0 in Base58). Likewise, the final block can convert to 11 or less Base58 digits.

Due to the conditional padding, the 69-byte string, like Monero addresses, will always convert to 95 Base58 characters (8 * 11 + 7); where 7 is length of the last block of 5 bytes.

The alphabet is composed of 58 characters visually not similar to avoid confusion, e.g. both 1 and l are not part of the alphabet together, only 1 is present. The full alphabet is composed of: 123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz

Address: 43pQ9h9F7KBFgDpFB1aa9ZAvqbxXa7zixfuFAUoybXzbnsy89jVH4YUG8Wwn1BzSFir8WGMkxHpq91XVNhcaaF27UsGFQw

[18, 57, 233, 247, 246, 39, 189, 38] -- Generates: 43pQ9h9F7KB

[87, 190, 79, 202, 198, 114, 137, 252] -- Generates: FgDpFB1aa9Z

[59, 91, 105, 62, 142, 212, 126, 5] -- Generates: AvqbxXa7zix

[4, 2, 134, 215, 55, 25, 186, 141] -- Generates: fuFAUoybXz (only 10 characters)

[208, 0, 122, 244, 178, 147, 68, 205] -- Generates: bnsy89jVH4Y

[162, 251, 100, 144, 167, 8, 96, 108] -- Generates: UG8Wwn1BzSF

[250, 47, 237, 93, 107, 240, 113, 30] -- Generates: ir8WGMkxHpq

[47, 226, 16, 79, 77, 51, 197, 105] -- Generates: 91XVNhcaaF2

1 Answer 1

0

Do I always add 1 to the beginning of the block output or at the end?

The end start of the block.

After much discussion with rbrunner on Reddit, it turns out the padding is at the start.

2
  • Thanks! What was the reasoning for the 1 padding character to be in the front vs at the end. The end seems more logical. Also is there an instance where a block can generate only 9 or 8 characters or even less? So I'm guessing it would be padding with 1111...? Commented Mar 7, 2021 at 6:19
  • Yeah it was a little rabbit-hole! I believe it can need more than one pad so always pad with 1's to 11 characters per block (except the last which is 7).
    – jtgrassie
    Commented Mar 7, 2021 at 10:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.