This article is a continuation of "What is Blockchain?". I'd highly recommend you to read that first.
The Bridge - No, not the TV show
We are at the last chapter of understanding Blockchain, following the journey of three best friends named Eki, Dwi, and Tri. We have learned how the blocks can chain each other and how it demonstrates a secure method of storing data without a centralised party, like banks or corporates.
The next burning question is, How do Eki, Dwi, Tri and you add a transaction to a Blockchain?
Lock and Key
Every user in a Blockchain will have a public and a private key. These public and private keys are generated automatically by the Blockchain software. They look like the hashes we discussed in the first chapter: Fingerprint hash.
-----END PUBLIC KEY-----
-----END RSA PRIVATE KEY-----
It would be best if you keep your private key private and secure. On the contrary, you can share the public key with everyone.
A good illustration of this is your mailbox and your key. Your mailbox is your public key and the key to open your mailbox is your private key. You don't want anybody to access your mailbox and read all of your messages.
We can use the private key to create a digital signature to sign any message. The digital signature can be verified using the corresponding public key.
The combination of these layers of security is called cryptography in Blockchains.
What does this flow look like in real-world scenarios?
Eki wants to document the trio's latest savings on a Blockchain:
Eki writes and signs the data using Eki's private key to create a digital signature. The data combined with the signature is a transaction.
Eki broadcasts the transaction to everyone on the peer-to-peer network using the Blockchain software.
Everyone in the peer-to-peer network verifies the new transaction signature using Eki's public key to confirm that Eki is the person who signed the transaction.
The peer-to-peer network will then include Eki's new verified transaction on a block in a Blockchain.
After reaching the consensus, the peer-to-peer network will include Eki's new transaction in all nodes in the Blockchain.
That's it! Now, this particular record is immutable and securely saved in the Blockchain.
Whoa! This is it.
Clap.. Clap.. Clap 👏
You stick to it! Now I hope you fully understand what and how Blockchain works.
Need a refresher? Read the first chapter: What is a 'Blockchain'?