From 51f9ddc6c45dae92768c2a19ff41f81c1d49018e Mon Sep 17 00:00:00 2001 From: Tal Weiss Date: Tue, 22 Jun 2021 21:41:31 +0200 Subject: [PATCH] Update 2021-06-21-blockchain.markdown I think a 4 byte checksum has 32 bits --- _posts/2021-06-21-blockchain.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_posts/2021-06-21-blockchain.markdown b/_posts/2021-06-21-blockchain.markdown index 898203fa..7e3aa83e 100644 --- a/_posts/2021-06-21-blockchain.markdown +++ b/_posts/2021-06-21-blockchain.markdown @@ -804,7 +804,7 @@ class PublicKey(Point): ``` -We are not yet ready to take this class for a spin because you'll note there is one more necessary dependency here, which is the b58 encoding function `b58encode`. This is just a Bitcoin-specific encoding of bytes that uses base 58, of characters of the alphabet that are very unambiguous. For example it does not use 'O' and '0', because they are very easy to mess up on paper. So we have to take our Bitcoin address (which is 25 bytes in its raw form) and convert it to base 58 and print out the characters. The raw 25 bytes of our address though contain 1 byte for a Version (the Bitcoin "main net" is `b'\x00'`, while the Bitcoin "test net" uses `b'\x6f'`), then the 20 bytes from the hash digest, and finally 4 bytes for a checksum so we can throw an error with `1 - 1/2**4 = 93.75%` probability in case a user messes up typing in their Bitcoin address into some textbox. So here is the b58 encoding: +We are not yet ready to take this class for a spin because you'll note there is one more necessary dependency here, which is the b58 encoding function `b58encode`. This is just a Bitcoin-specific encoding of bytes that uses base 58, of characters of the alphabet that are very unambiguous. For example it does not use 'O' and '0', because they are very easy to mess up on paper. So we have to take our Bitcoin address (which is 25 bytes in its raw form) and convert it to base 58 and print out the characters. The raw 25 bytes of our address though contain 1 byte for a Version (the Bitcoin "main net" is `b'\x00'`, while the Bitcoin "test net" uses `b'\x6f'`), then the 20 bytes from the hash digest, and finally 4 bytes for a checksum so we can throw an error with `1 - 1/2**32 = 99.999999976%` probability in case a user messes up typing in their Bitcoin address into some textbox. So here is the b58 encoding: ```python