Bitcoin – Send & Receive Payment

The bitcoin network must ensure that any other person cannot spend bitcoin owned by one person. For example, Eve can not spend Alice’s bitcoin by creating transactions in her name. In the broader sense, the intruder in the network will not be able to create some false transaction. To ensure that bitcoin uses public-key cryptography to make and verify the transaction using ECDS digital signature algorithm. Every participant in the bitcoin network has one or more searchable addresses with the associate pair of the public and private keys. There is no restriction of creating searchable addresses for transactions, and these addresses are stored in the bitcoin wallet securely. 

Security requirements

  • Detection and rejection of false transactions.
  • Detection and prevention of Double-spending.
  • Preserving the anonymity of the users.

Alice wishes to transfer some bitcoin to Bob

  • Bob sends his address to Alice.
  • Alice adds Bob’s address and the number of bitcoins to transfer in a transaction message.
  • Alice signs the transaction with her private key and announces her public key for signature verification.
  • Alice broadcasts the transaction on the Bitcoin network for all to see.
sending money - bitcoin
  • Anyone can validate the transaction with Alice’s public key.

What is double-spending, and how to detect and prevent double-spending in a decentralized network?

Double-spending: When the same bitcoin is used for more than one transaction. For example, Alice has 50 bitcoins and the same number of bitcoins she has transferred to Bob and Charlie. However, in a centralized system, the bank prevents double-spending by verifying the account before accepting the transaction request.

Bitcoin - Doble Spending
Bitcoin – Double Spending

These kinds of transactions cannot be valid simultaneously in the bitcoin network. So the question comes, in the decentralized network, how can we prevent double-spending?

The double-spending mechanism is implemented in the bitcoin network, and it works as follows:

  • The details about the transaction are sent and forwarded to all or as many other computers as possible.
  • Use bitcoin blockchain, a constantly growing chain of blocks that contain a record of all transactions.
  • All peers maintain the blockchain in the bitcoin network. All the nodes in the network maintain a copy of the blockchain and can verify transactions easily.
  • To get a transaction accepted for a chain, transaction blocks must be validated, and they should also include something called Proof of Work.
  • Proof of Work is a consensus algorithm where miners need to solve a computationally difficult hash problem during the mining procedure.
    • Example: Y_{2} = H(T||Y_{1}||N) where Y_{2} is a new hash value, T is a list of transactions organized in a Merkle Tree and Merkle root, Y_{1}  is a previous hash value, N is a nonce. This nonce has to be fine-tuned to generate the new hash value with some predefined pattern. The predefined pattern is a puzzle, and the newly generated hash value Y_{2} must satisfy the pattern. Then, only a particular block will be added to the blockchain.
  • Blockchain ensures that, if any blocks are modified, all the following blocks will have to be recomputed. Because of this hash pointer property, every block contains the hash of the previous block, so the entire blockchain is tamper-proof. If any block is modified, then subsequent blocks must be updated by recomputing the hash value.
  • When multiple valid continuations to this chain appear, only the longest such branch is accepted, and it is then extended further (longest chain).
  • Once a transaction is committed in the blockchain, everyone can validate all the transactions using Alice’s public address.
  • The validation prevents double-spending in bitcoin.  If there are two transactions with the same bitcoin, everyone will see that, and the miners will not include both the transactions in the same block.

Hence by maintaining this kind of blockchain architecture which is already get validated and prevents double-spending. 

Summary

How to send and receive bitcoins, double-spending, and the mechanism to detect and prevent double-spending? 

References:
  • NPTEL lecture series on Blockchains Architecture, Design and Use Cases by Prof. Sandip Chakraborty, IIT Kharagpur.

 181 total views,  1 views today

Scroll to Top
Scroll to Top