How does Bitcoin work?

How does Bitcoin work?

What is a bitcoin ledger, transaction signing, digital forgery and secure working of the Bitcoin cryptocurrency.

ยท

4 min read

Cryptocurrency has gained huge popularity with people jumping in for various reasons. Many join the crypto space for trading, some join because of the hype, some for understanding the tech behind it, etc.

No matter which way you come into this space, most do not understand the basic functionality of what a cryptocurrency does. All they know is it is a distributed ledger and has something to do with cryptography.

But what's actually happening under the hood, what do the computers actually do? Let's understand the workings of the first cryptocurrency aka Bitcoin.

What are ledgers?

A ledger is a record of transactions that happened or are supposed to happen in near future involving multiple parties like sender and recipient.

A blockchain is like a digital ledger where blocks of transactions are in the form of a chain. It is a public ledger in the case of Bitcoin and is available to everyone to view and write.

Now a problem with a public ledger where anyone can read and write transactions is that anyone can write any transaction. Even if the transaction was not meant to happen.

For example, there are 2 people, say Ramesh and Suresh. Both have the access to the public ledger to read/write. Suresh writes that "Ramesh owes him โ‚น100", without the approval of Ramesh. This is a false transaction.

To prevent this exact scenario digital ledgers such as Bitcoin use ...

Digital Signatures

The idea is that like normal signatures, there should be a digital representation of your unique signature, which is infeasible to forge by others.

So when Suresh writes "Ramesh owes him โ‚น100", Ramesh can sign that statement with his digital signature to approve that transaction. If the statement is not signed i.e the approval is not given then the transaction does not happen.

The digital signature is just a string of 0s and 1s that are combined to sign. But this data is copied by someone, they can impersonate you and can sign illegal transactions on your behalf, without your consent.

How do we prevent Digital Signature forgeries? Every user of the blockchain will have a public key and a private key. They are a string of bits and both keys will be unique for every user.

A private key is also called a secret key. This should be hidden and never disclosed to others as this is a very crucial part of generating Digital signatures.

How is Digital Signature Generated?

In the physical world, your signature on most of the documents is the same. But, in blockchain signing, every single transaction message will have a different unique signature.

Using different digital signatures for different transactions or better to say, you only use 1 digital signature 1 time ensures that someone cannot use your previous signature for a new transaction, even if they get hold of it.

Digital signatures are generated using a function where the inputs given are the transaction message, your private key, and some other parameters that may be used to increase the randomness of the output.

function(txn. message, private key) = Unique Digital Signature

How to verify Digital Signatures?

For every transaction, the message or some other parameters will be different resulting in a unique digital signature every time. The private key ensures that only you can create such a signature. That's why it is absolutely necessary to keep your private keys safe.

If someone else gets your private key, they can generate digital signatures on your behalf and sign transactions that you might not want. It is possible to steal your assets if someone gets hold of your Private Key.

Another function is used to verify if the signature is valid signature or not. The parameters it takes are the transaction message, Digital signature, and your Public key.

Verify(txn. message, Signature, Public key) = True or False

As your public key is available to everyone to view when you share, anyone can validate that you were the one who signed a transaction and that your signature is valid.

The amazing part of this is that these functions are irreversible. That means that you cannot generate a private key if you perform the inverse.

More details on how these functions work will be in another article.

There is more to Bitcoin than just a decentralized ledger, the aim of this blog is to provide a stable understanding of how the transactions with bitcoin work.

To understand more about blockchains such as Bitcoin, you should consider knowing how the Proof of Work protocol works. It is an important component of how the consensus is reached on the Bitcoin network ๐Ÿ‘‰ What is Proof Of Work in Bitcoin


That's all :)

ย