DEV Community


Understanding Bitcoin - A peer to peer electronic cash system

The Nerdy Dev
I am a Full Stack Developer, sometimes freelance also. I love to teach.
・7 min read

Understanding Bitcoin - A peer to peer electronic cash system


Alt Text

Bitcoin is a purely peer to peer version of the electronic cash would allow online payments to be sent directly from one party to another without going through a financial institution. We propose a solution to the double spending problem using a peer to peer network." as cited by Satoshi Nakamoto in his paper "Bitcoin : A Peer-to-Peer Electronic Cash System". According to him, the sole purpose of its need is to remove the dependency of the third party central authority (usually a bank or some other financial institution to process electronic payments etc.)


Alt Text

Bitcoin views the financial system as something it can improve. It started off by trying to replace the banks as a trusted third party, whether it is working or not it is something we are still exploring. It has come up with some amazing solutions to a few of the problems that we are trying to solve.

The question that must arise in our minds is that…

Alt Text

Is it ideal for the banks to have complete control on all this financial data ?
They have access to everything that we can do with our money and can chose whether or not they want to share with us.
Maybe it would have been better if everyone had access to these records. Isn't it?
Instead of having a ledger maintained by the bank we could create a shared ledger that everyone has access to. If this becomes possible, it would allow everyone to have complete control to everyone on their information.
Is there a way we can use this shared ledger to establish the same level of security and trust that this centralized third party bank provides ?

If you want to send some money to other person, bank often are the only third parties that handle it. Whether you use smart cards, e-cash etc. you are giving your information to them too. The merchants (Paypal, RazorPay, Paytm etc) also need to communicate with the banks and are also handling your money. This list of companies go pretty long quickly as you try to do more complicated transactions. This can result in delay in the transaction times and fees collected by the companies that are handling your money. Hence it was required to have an electronic payment system based on cryptographic proof instead of trust, allowing any two willing parties to transact directly without the need for a trusted third party


Alt Text

It defines an electronic coin as a chain of digital signatures. Each owner transfers the coin to the next by digital signing a hash of the previous transaction and the public key of the next owner and adding these to the end of the coin. A payee can verify the signatures to verify the chain of ownership.
The problem was that payee could not verify that one of the owners did not double-spend the coin.

To accomplish this without the relying on third party, there was a need for the transactions to be publicly announced and we need a system for participants to agree on a single history of the order in which they were received. The payee needs proof that at the time of each transaction, the majority of the nodes were in total agreement that it was the first to be received.


The timestamp server software is used to digitally timestamp transactions that are to be recorded. Despite of the fact that the majority of the network agree to run on a single timeline, for us to truly appreciate the decentralized nature of the Bitcoin Network that operate without relying on any central authority, there needs to be a way for the entire network to agree about which order transactions are generated in.
That means each transaction needs to be recorded with a precise timestamp on it.
Take a minute and think about this…
Without the network running on a single timeline and each transaction being timestamped, how does a new recipient in the network know and trust that the previous owner did not sign any earlier transactions under the constraint that in bitcoin network there is no central authority to confirm if a transaction or previous transactions have been double spent.


The timestamp server is piece of software that timestamps transactions when they occur. It takes a small section of the transaction data and digitally timestamps it to create a hash and widely publishing the hash. This can help us capture things when someone may have tried to spend the same money twice( Double Spending Problem so to say). Based on this information we can decide which transactions were valid based on which transactions happened first.

PROOF OF WORK - A consensus based algorithm

The basic idea behind POW is that piece of data can be costly or time consuming to produce but simple for others to verify that work. In POW,there is an upfront cost of resources known as work put into generating a block's hash value. This work can easily be validated by rest of the network to check if it was done correctly.
Nonce is the number that the computers try to figure out to solve the problem pertaining to proof of work for mining. You don't need a faster computer for this, it just allows faster if you have one to compute the nonce value. I want that my hash value should begin with 4 zeroes and for that we cannot predict the nonce manually and we use powerful computers for this.

Find a hash value 0000000000000000000000000000000000000000000000000000
← less specific (lesser number of 0s, lesser is the time required)
more specific → (more number of 0s, more is the time required)

The more leading zeroes we need, the longer it will take to find the answer Wanting a hash with more zeroes is a more specific request that makes it less likely that you will find a solution and results in way more guessing. This number of zeroes that are requested is referred to as the block difficulty. This block difficulty can be updating the algorithm to ask for more or less 0s. In bitcoin they adjust the difficulty automatically to help ensure that new block is created successfully every 10 minutes.

In POW, each node is involved in solving a problem meant to prove it has done some required work.Having put in time to do this work is a signal to the system that it is likely able to trust the result of the work that was done. Nodes that attempt to solve the problem are known as miners .
Mining to find these solutions can take a lot of computation power. These miners are constantly in a race to solve all the problems as quickly as they can to build the next block.


New transactions are broadcasted to all the nodes.
Each node collects new transactions into the block
Each node works on finding a difficult POW for its block.
When a node finds a POW, it broadcasts the block to all the nodes in the network.
Nodes accept the block only if all the transactions in the block are valid and not already spent.
Nodes express their acceptance of the block by working on creating the next block in the chain, using the hash of the accepted block as the previous hash.


Confirming bitcoin transactions requires a lot of computation energy.
That means a lot of electricity bills to pay. :P

Alt Text

Every time a sender puts out a transaction they can add a transaction fee, think of this as a tip to the miner. Not all transactions come up with identical transaction fees. Miners can look through all of possible transactions in the mempool and see which one has transaction fees and look at their values. Miners like most people like being paid. So they will choose to validate transactions with higher fees. Reason that the transactions wait in the mempool is the hope that they will get validated. Then they can leave and permanently be added to the chain. Transactions or one of its unconfirmed ancestors might conflict with one of the transactions that were already confirmed in the block. Remember that the chain keeps a permanent history of the transactions. Once a transaction is included in a block, it is concluded to have one confirmation. As soon as another block is mined on the same chain the transaction has two confirmations.Transactions continue to get confirmations as soon as more blocks are added to the chain. Since more confirmations are considered sufficient proof that a transaction cannot be reversed. So there is 99.99% conformance rating that there are no errors in the transactions that are being added to the chain. This means if the transaction in question conflicts with what is already in the chain chances are that there is something wrong in it. And that transaction will have to be denied and leave the mempool. It is important to know that the transactions that are left are always welcomed back for example : when they are received over the network. Eviction does not imply that a transaction is cancelled. From mempool, the miners will bundle up transactions into blocks that will be added to the chain. There are cases when the transaction leaves the mempool but still does not make to the chain. Perhap the transaction is invalid or maybe it gets timedout.The mempool is a temporary workspace for checking our work before adding it permanently to the chain. Now the purpose of this holding pool is to provide transaction security. Once the transaction is included in a block and that block has been confirmed six times meaning 5 additional blocks have been added to the chain. That block is considered as irremovable and it will require immense amount of computation energy to validate and recalculate those six blocks.


Bitcoin works with an unprecedented level of transparency that most people are not used to dealing with. All Bitcoin transactions are public, traceable, and permanently stored in the Bitcoin network.Bitcoin addresses are the only information used to define where bitcoins are allocated and where they are sent.


Bitcoin is going to gain popularity and might even replace official currencies. … People receiving Bitcoins won't have to pay anything for the transactions, and Bitcoins have a lot of support. All of these will definitely help Bitcoin get more users, and if everyone uses Bitcoin it could replace official currencies.
That's all from my side for understanding bitcoin. Feel free to give a clap if you liked the article. Keep learning :)

Follow me on:
👉 Twitter:

Discussion (0)

Forem Open with the Forem app