# ELI5: What is Base58Check encoding?

I've seen posts on how to do it and I've read the wiki on what it is, however these explanations are too complex. Can someone explain what it is and why it's called Base58Check encoding? Are addresses generated without going over those steps still valid in Bitcoin?

This is the explanation provided by the original bitcoind client in base58.h

``````// Why base-58 instead of standard base-64 encoding?
// - Don't want 0OIl characters that look the same in some fonts and
//      could be used to create visually identical looking account numbers.
// - A string with non-alphanumeric characters is not as easily accepted as an account number.
// - E-mail usually won't line-break if there's no punctuation to break at.
// - Doubleclicking selects the whole number as one word if it's all alphanumeric.
``````

To further this question, what do npm packages like bs58check do exactly? The description is as so

A straight forward implementation of base58check extending upon bs58.

• Base58check = checksum + base58 May 24, 2018 at 18:03

Can someone explain what it is and why it's called Base58Check encoding?

There are two parts to the name "Base58Check". The first part is "Base58". This is fairly self explanatory, the encoding uses Base 58. This means that there are 58 digits which are represented by 58 characters. One digit is a number between 0 and 57, just like how in the decimal system (or base 10) we have which are a number between 0 and 9. Since each digit is supposed to be one character, we need to have a different "alphabet" for each digit. For base 58, we use the alphabet `123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz` with the number 0 being represented by the character `1` and the number 57 represented by the character `z`. For comparison, the decimal alphabet is `0123456789` with the number 0 represented by the character `0` and the number 9 represented by the character `9`.

The second part of the name is "Check". This refers to a checksum. The SHA256 double of the data that we want to encode is calculated, and the first four bytes of that hash is used as a checksum. This is an error detection method to help ensure that the data we received is correct and not corrupted. Those four bytes are appended to the data that we are encoding before we perform a base conversion to generate the base 58 string.

As with any piece of data in a computer, the entire pre-base58 byte string can be interpreted as a very large integer. From there, it is easy to perform a base conversion to base 58 and thus produce the final base 58 string.

Are addresses generated without going over those steps still valid in Bitcoin?

You cannot generate an address without going over those steps, so it is impossible to not go over these steps to produce an address.

To further this question, what do npm packages like bs58check do exactly? The description is as so

They implement the entire conversion from bytes to Base58Check encoded string.

• `123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz` has `61` chars, isn't it?
– Eric
Jul 9, 2021 at 20:19
• @user218867 No, it's not the alphabet, there are missing letters.
– Ava Chow
Jul 10, 2021 at 4:27
• good thing to add here is that the base58check reduces typing errors as the characters in the alphabet used to encode remove certain characters such as symbols as well as similar looking errors such as lI (lowercase "L", uppercase "I") Aug 13, 2021 at 13:53

A Bitcoin address is a series of bits (on its simpler form is just a public key).

In order to make it human "readable" it is converted to a series of letters.

Base64 is a well known previous algorithm for doing this, but it was decided that characters as O, I, 1, l, +, / could lead to confusion (they are visually similar to others or aren't letters), so 6 out 64 chars were removed: from that the Base58 name.

Before doing the conversion, checksum bits are appended. This ensures that after conversion to Base58, any error transcribing a letter would lead to an invalid address when converted again to bits and the checksum is verified. From that the Check of Base58Check.

As Base58Check is just a representation of the original bits value, this latter bits serve also as an address (for example for backup purposes). It is more a matter of if the app you are using accepts bare bits as addresses.

npm bs58 just converts bits to Base58 without calculating nor verifying the checksum. npm bs58check appends the checksum when converting bits, and verifies it when reverting from Base58 to bits.

Can someone explain what it is and why it's called Base58Check encoding?

Because of the name the function in the original Bitcoin codebase had.

The "Base58" refers to the fact that it is a base 58 format (it uses 58 different characters to encode the data), and the "Check" refers to the fact that a checksum is added to the encoded data.

Are addresses generated without going over those steps still valid in Bitcoin?

It's complicated.

Base58Check is simply a way to encode a number of bytes of data into a string. In theory, if you find another way to construct a string that can be decoded by the Base58Check decoder to something with the right length and version byte, the result will indeed be a valid address.

I expect the answer to your question is no. You need to use something at least vaguely similar to a Base58Check encoder to end up with a valid address.

To further this question, what do npm packages like bs58check do exactly?

It implements a way to convert bytes to Base58Check strings, and a way to convert such strings back to bytes.