Let’s start off with the basics, before we jump into the process, we need to understand the concept of private key and public key that are used to provide secure access to a user’s digital assets and to authenticate transactions on the network.
A private key is a secret code that is used to sign digital transaction and prove ownership of digital assets, so It is important for users to keep their private keys safe and secure, as anyone who gains access to a user’s private key can potentially steal their digital assets.
A public key is a code that can be shared publicly with anyone and used to verify digital signatures and to receive digital assets, the public key is mathematically linked to the user’s private key, which means that anyone can use the public key to verify that a transaction was signed by the owner of the associated private key.
It can be explained by two functions shown as below:
Sign(private_key, message) –> Signature
Verify(publick_key, signature, message) –> True/False
So how does blockchain work?
Firstly, a user or node will initiate a transaction signing it with its private key. Basically, the private key will generate a unique digital signature, you might have a question now:
Can anyone duplicate the transaction with your digital signature created for the transaction?
The answer is no, because the digital signature will change drastically once the transaction information is modified, and no one will be able to verify it. Therefore, it will be dismissed.
After that, the transaction will get broadcasted to the verifying nodes. Basically, the blockchain platform can use different methods to verify whether the transaction is valid or not. There methods or algorithms are called consensus algorithm.
Anyhow, once the nodes verify that the transaction is authentic, it will get a place in the ledger. Also, it will contain a timestamp and a hash in the block header to secure it further from any alteration.
The block will then link up to the previous block, and then a new block will form a link with this block and so on. And this way, it creates a chain of blocks, thus the name blockchain.