n*rd*nc*d

How do you create a transaction in a Blockchain? [Read me third]

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?

breathe...

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.

User: Eki

-----THIS IS YOUR DUMMY PUBLIC KEY-----
MIGeMA0GCSqGSIb3DQEBAQUAA4GMADCBiAKBgGpAAefcqtMn...AAE=
-----END PUBLIC KEY-----
-----THIS IS YOUR DUMMY RSA PRIVATE KEY-----
MIICWwIBAAKBgGpAAefcqq2n29lhnSCyA/ThQtMnP
lQ5x9BxNhOzzkr49G/rqZpwKFvkZ26v7GkVaepQNf21HxZ6I...0OA==
-----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.

To create a digital signature you need a private key and <br>to verify the digital signature you need the corresponding public key.
To create a digital signature you need a private key and
to verify the digital signature you need the corresponding public key.

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.

breathe...

What does this flow look like in real-world scenarios?

Eki wants to document the trio's latest savings on a Blockchain:

Eki  2000, Dwi  1900, Tri  900
  1. 1

    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 writes and signs the data using Eki's private key to create a digital signature. The data combined with the signature is a transaction
    Creating a transaction using private key
  2. 2

    Eki broadcasts the transaction to everyone on the peer-to-peer network using the Blockchain software.

    Eki broadcasts the transaction to everyone on the peer-to-peer network using the Blockchain software
    Broadcasting the transaction to the peer-to-peer network
  3. 3

    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.

    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
    Everyone in the peer-to-peer network verifies the new transaction
  4. 4

    The peer-to-peer network will then include Eki's new verified transaction on a block in a Blockchain.

    The peer-to-peer network will then include Eki's new verified transaction on a block in a Blockchain
    Include Eki's new transaction on a block in a Blockchain
  5. 5

    After reaching the consensus, the peer-to-peer network will include Eki's new transaction in all nodes in the Blockchain.

    After reaching the consensus, the peer-to-peer network will include Eki's new transaction in all nodes in the Blockchain
    Consensus reached - Eki's new transaction will be added in all nodes in the Blockchain

That's it! Now, this particular record is immutable and securely saved in the Blockchain.

breathe...

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'?