Encoding Scheme Called Base58 In Bitcoin
From the very beginning, many innovative solutions have been proposed for Bitcoin. The original paper brought an alternative way of storing financial data, a new money transfer process, a reliable, trustless transaction system, etc.
Many different technologies were used to support such an advanced approach. These technologies included cryptography, hashing, network protocols, programing methods, and more. Taken together, they allowed to build an entirely new system known as Bitcoin in 2009. Since then, numerous crypto projects have been developing and growing.
One of the most important yet not so famous components of Bitcoin is Base58, an encoding scheme proposed by Satoshi Nakamoto. This scheme is used to record private keys and addresses in a clear form, which helps prevent misprints and mistakes. Let’s examine it in more details.
Encryption vs Encoding
Before talking about Base58, its properties and implementation, we should explain the difference between encoding and encryption. Both processes are used in the crypto sphere, so let’s make sure that we are familiar with their definitions.
- Encoding is the process of changing the way information is represented;
- Encryption is the process of changing data in such a way that only authorized parties can access it.
Even though these processes are different, both aim at converting data from one form to another. At the same time, encryption adds some protection measures, thus it is fair to say that encryption is a particular case of encoding.
Base 58 Background
Since Base58 is an encoding scheme, it changes data representation. Although, there were other encoding schemes before. The closest one by data length is Base64. However, Satoshi refused to use it. So why was Base58 applied instead of the standard Base64 encoding? The detailed answer can be found in the Base58 explanation. Let’s summarize it:
- Similar and confusing characters should be removed;
- Doubleclick for address selection should be applicable;
- Non-alphanumeric characters introduce complexity.
The first reason is simple. Base64 uses “O”, “0” (zero), “l” (lower-case “L”), and “I” (upper-case “i”). These characters look so similar that entering an address manually would cause a lot of confusion (Remember: because of a wrong address, you can lose your money forever). The other two reasons are about additional symbols. In Base64, they are “+” and “/”. Using them would bring problems in fast data copying and address understanding.
Base58 is used to record Bitcoin private keys and addresses in a convenient and clear form, which reduces the chance of making a mistake. Its input can be either a private key with the checksum and service data, or a hash result of a public key with the checksum. Characters used in such records are “0-9, A-Z, a-z”, excluding those mentioned before. Converting input data to the Base58 format requires the modulo division by 58.
Another interesting fact is that Base58 is also used in the Flickr service to record a short photo ID.
Preventing mistakes when entering addresses in such a system as Bitcoin is a crucial point as it guarantees your assets will stay safe. Encoding schemes implementation does not require huge efforts. Since Base58 relates not to data safety but to its representation, there are no problems in proper algorithm writing.
Meanwhile, encoding and encryption are also used in other crypto projects. We will talk about their peculiarities in our next articles.