How Bitcoin Transaction Works?

21 Sep, 2021
Bitcoin is basically a digital currency that is currently used as a form of payment. Bitcoin is a cryptocurrency and the transactions related to bitcoins take place in the blockchain network. Every bitcoin is stored in a virtual wallet and transaction involves the transfer of bitcoin from one wallet to another. Bitcoins can be sent from peer to peer irrespective of geographical location without any intermediator in between(for example bank per se). it works in a decentralized way, meaning nobody can interfere with your digital money, only you are responsible for your bitcoins.
Bitcoin transaction means sending bitcoin from one person to the other in the secured blockchain network. These are messages that are digitally signed using cryptography and are verified by the miners that are present in the blockchain network. The miner is the person who solves mathematical puzzles(also called proof of work) to validate the transaction. Anyone with mining hardware and high processing power can take part in this. Numerous miners take part simultaneously to solve the complex mathematical puzzle, the one who solves it first, wins 12.5 bitcoin as a  reward. miner verifies the transactions(after solving the puzzle) and then adds the block to the blockchain when confirmed. The transaction input is the bitcoin address from which the money was sent, and the transaction output is the bitcoin address to which the money was sent. Generally, a bitcoin transaction takes 10 to 20 minutes to confirm any transactions. if network congestion takes place, then time might take even 60 minutes.
Example: Suppose Hari wants to send 5 BTC(bitcoins) to Senorita.
Input-  It consists of the bitcoin address from which hari got his bitcoins previously.

Amount- This deals  the specific amount of money that hari wishes to send to senorita, 
        in this case, its 5BTC.
        
Output- This is the bitcoin address of senorita which hari needs to know in order to 
        transfer the bitcoins to her wallet. Bitcoin address of senorita is also known
        as public key.
The transaction rate or speed is dependent on the amount the user pays for it. If a user pays a small amount, the transaction rate will be slow, the transaction will take more time to happen, vice versa is applicable here. Due to limited space, only a limited number of transactions are possible at one point in time.Consider a case where heavy network traffic occurs, then the miners prioritize those transactions that have the highest fees so that even in the hectic congestion, the highest-paid transaction gets executed.Many bitcoin wallets allow users to set transaction fees manually. The fees are directly sent to the miners. When the bitcoin hits a bull run, the transaction fees shoot up to an all-time high. there is no such minimum transaction fee a user must pay, but the highest transaction fees mainly lie between $24 to $31. as the highest-paid transaction gets confirmed first, therefore the fees tend to fluctuate based on the demand of the user.
Time is taken for transaction confirmation mainly depends on two factors:
Transaction fees: As discussed above, if the user pays minimal transaction fees, then the time taken for confirmation of a particular transaction would take a longer time. the mining process needs significant technology and efforts, therefore the importance of transaction fees comes into play.
Network load: Every transaction gets stored temporarily in the memory pool till the miners confirm it. When the transaction activities reach a certain high threshold, the memory pool gets jammed thereby slowing the confirmation time of the transaction even more. Due to this, all the subsequent transactions become susceptible to delay.
Sending or exchanging bitcoins undergoes lots of procedures underneath. The bitcoin wallet and the network ensures that the digital currency reaches the receiver properly. There are two basic terminologies related to this-
Public key: Also known as a bitcoin address, these are publicly known to all like your username in social media handles. In order to receive bitcoins, the user must share his public key with the other user.
Private key: These are kept secret and must not be shared with anyone, similar to the user’s password of social media accounts. Private keys are the most important thing in the whole cryptocurrency concept. The private key allows the user to have access to bitcoins, if the user forgets the private keys, there’s no way to recover the bitcoins or the private key. Therefore, it is advised to make a proper backup of the private key in a safe place.
Transaction input is nothing but the address of the sender which gets registered in the network and remains in an encrypted and inaccessible state. Transaction output is the receiver’s address which is registered on the bitcoin network. In the previous example, Hari opens his bitcoin account and signs a transaction detail with his private key, and then broadcasted to a bitcoin network called blockchain, where miners compete with each other to find a hash value called nonce which solves the mathematical puzzle thereby verifying the transaction. The miners create new blocks by abiding by the fact that the transaction volume must be less than 21 million. 21 million is the total number of bitcoins that can be generated. The verified transaction gets a unique identification code and is linked with the previous verified transaction.
In the bitcoin network, every transaction is traceable via linked blocks. Anyone can understand who sent it to who at any point in time. thus, bitcoin works in a transparent manner
There are mainly three types of bitcoin addresses:
P2PKH addresses: These addresses start with number 1. For example 1WX23.P2SH addresses: These addresses start with number 2. For example 2WX23.Bech32  addresses: These addresses start with bc1. For example bc12WX23.
P2PKH addresses: These addresses start with number 1. For example 1WX23.
P2SH addresses: These addresses start with number 2. For example 2WX23.
Bech32  addresses: These addresses start with bc1. For example bc12WX23.
An internal transaction is a transaction that doesn’t come under any external third party.it works inside the internal function of business thereby doesn’t exchange any sort of resources. Internal transaction doesn’t have any impact on the cash flow as it deals only with interdepartmental transactions.
An External transaction is a transaction that comes under any external third party.it basically is an exchange medium between an internal organization and a third party. Since it involves exchange with third parties, it has a huge impact on the cash flow.
In order to send or receive bitcoins, one must possess a bitcoin wallet application.
After installing the bitcoin wallet app, select the type of currency you want to send. For example ethereum, bitcoin, etc.
Write in the receiver’s address.
Type the amount of bitcoin you wish to send.
Pay the required transaction fee.
Press the “send bitcoin” button and the cryptocurrency will be transferred.
In order to receive bitcoins, do the following steps:
Open the wallet and click receive.
Share the public key address. It can be a QR code or a combination of numbers and letters.
Anyone with a public address can send the cryptocurrency.
pradiptamukherjee
Picked
Blockchain
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to connect ReactJS with MetaMask ?
Solidity - While, Do-While, and For Loop
Solidity - Libraries
Solidity - Variables
Hyperledger Fabric in Blockchain
Solidity - Functions
How to Setup Your Own Private Ethereum Network?
Solidity - Error Handling
Blockchain - Hyperledger vs Ethereum
Difference between Public and Private blockchain