In the first part of this series, I introduced you to a fascinating web site that shows how Bitcoin Cash (and other forks from the Bitcoin blockchain, and similar cryptocurrencies) work. That introduced concepts such as hashs, blocks, nonces, and tokens. And my thanks to Anders Brownworth for providing this very useful visualization tool.
In this second part, I want to highlight a follow up page that Anders created, to illustrate the use if public and private keys, and signing transactions. You can ignore what I am about to write completely and just go direct to Anders' site with his very complete and informative Youtube videos, or read on.
Brief crypto backgrounder
In the first part of this series, I discussed cryptography ("secret writings"), and the tools of mathematicians and cryptographers used in blockchain, largely based on the works of Stuart Haber and Scott Stornetta, whose works represent three of the eight references in the Satoshi Nakamoto Bitcoin whitepaper.
You often hear that blockchains use advanced encryption (or perhaps encryption techniques). Encryption is a two-way process: a message is uniformly changed into ciphertext - something that can only be understood and transformed back to the original by someone with the secret. The basics of blockchain - whether Bitcoin Cash or Ethereum, or any of the other major cryptos - do not involve encryption; everything is in clear text on the blockchain.
That is not to say that encryption is not used as part of the digital signature process, as we shall see.
Keys
The first part of Ander's second demonstration (2) begins with illustration of private and public keys. There are any number of great tools online that illustrate the process of starting with a random seed (my favorite being the Graphical Address Generator at The Royal Fork), or starting one step later with a private key to create the public key.
It's always interesting to see whether the tools return the same results, of course, and sometimes they fail.
It should probably be noted that you can use this page to create a random private key/public key pair, as people also use other resources such as Bitaddress.org. However, you are always warned that trusting the results of a site like this may result in any part between you and the web site knowing that the pair may be in use and stealing your coins.
Signing
The next page on Ander's site illustrates how private keys are used to sign a message and public keys are used to check the signature.
Sign
In the screencap below, you can see the paragraph above "signed" with the private key from the first screencap.
The original message is 351 characters long; the signature is 142 characters.
Verify
On the same tab, you will also find the "verify" function. Here you see the original message (remember - no encryption of the blockchain), the public key and the Signature.
Pressing the verification button, the message box turns green if everything is correct; change the message (even adding a space at the end) , the public key or the signature will make the message turn red when you verify.
Transaction
Transaction makes it a little more "real" instead of random content for the message, you see something that looks a lot more like a BCH transaction. There is a transaction amount (for the illustration, it is in $ rather than BTC), and the address from which the amount is transferred, along with the address the amount is transferred to.
Sign and Verify
As with the unstructured text, you sign the transaction with the public key to create a message signature; if the amount, addresses, signature are changed, verification will come back with a red result; if all is clear, the message comes back with a green result.
Blockchain
Finally, the last page, Blockchain, illustrates how all of this security works in a chain of blocks. You sign a transaction, you sign a block, and any change will break the chain to protect the transactions and make sure they are from the people who should be able to authorize the transaction.
You see a lot of misinformation about blockchain and Bitcoin Cash. If you have a private key, you are ready to receive Bitcoin Cash; nowhere in this process did you see the message encrypted - it's clear text. But Ander's visualizations really help take the lid off the workings and show how simple the process really is, if you have some simple tools.
(1) https://andersbrownworth.com/blockchain/
(2) https://andersbrownworth.com/blockchain/public-private-keys/