This is the third and the last part of the ‘blockchain explained’ series. Please go through part 1 and 2 before this to understand it better. I also recommend you to read my article about cryptography to make your reading even smoother.
In this article we will be talking about the role of cryptography in blockchains. Mainly about the use of digital signatures.
Till now we have seen two different ways how blockchains ensure protection against any attacker. Those are the following :
- An attacker must mine the block he tampered with, and all the blocks after it, so the changes goes unnoticed.
- He must also do the same for more then 50 % of copies of the blockchain found in the p2p network in order to make the change effective.
But there’s still a problem with that. And that is, how can we be so sure that a block incoming to join the blockchain, is indeed sent by the person as stated in the block. Isn’t it possible that someone else, spends my money by just mentioning by name as the sender ? Since we don’t have a central authority, which would inform the actual person that a transaction, what can we do to stop it ?
Using digital signatures in a blockchain
As we know a digital signature is used to verify if a message sent is actually sent by the person himself, not just by any one in the internet.
So, imagine you want to give send 100 bitcoins to someone i.e add another block in the blockchain. The first thing you do is encrypt your entire transaction data with your private key. The encrypted message you get is the signature.
As you might know, your public key is another key that can be used to decrypt message encrypted by your private key. Hence, after you send the transaction details (these details often include things like the identity of the person who sent the money, including the identity of the recipient himself. Here these two would be interchanged with both their public keys. We’ll see why) along with the encrypted message, the blockchain will try to decrypt the encrypted message with your public key. And if the result is the same as the actual transaction details, it is verified that the message was sent by you, not just any random person trying to be disguised as you.
Then this as a block is attached in the chain.

Again I would like to tell you about blockchain demo tool, which you can use to play with the terms I explained above.
Conclusion
I hope this article helped you to understand the role of signatures i.e public and private keys in a blockchain. Also the role of the cryptography technology in this realm. Of course, whatever explained in this article and this series would become tip of the iceberg when you’ll go and see how things are actually implemented in real life.
But I hope this series on blockchain helped you understand it from the very basic level.
The overall idea and concepts laid down in this series is very similar to how things like Bitcoin, Eterium or any Cryptocurrency works. In fact these crytos are just some implementation of the blockchain technology. They might differ by the type of data that is stored, or how blocks are operated and stuff.