How does a Bitcoin (BTC) transaction work ?‏‏

I) Bitcoin: A Peer-to-Peer Electronic Cash System.  This is the title of the white paper of Bitcoin (BTC).  Millions of people have now come into contact with bitcoin.


 But if you use Bitcoin, what exactly happens?  And how does a BTC transaction work?

 Buy 1000 euros in Bitcoin without commission?  Get started at Bitvavo.

1) Bitcoin transaction


 When you make a payment, you send a certain amount of BTC to a wallet address.  This is a derivative of a public key.  The only way you can send your BTC is to show that you are the rightful owner with the private key.  It is a digital key to the log of all transactions.

 Your key pair and wallet address (s) are related through encryption and hash functions.  Both algorithms work differently, but they serve the same purpose: to encrypt data.

 A Bitcoin transaction is the result of a wonderful combination of cryptography, data structures and non-turing-complete scripting.  When you make a transaction, you give it a certain fee.  Then the tx ends up in the memory pool, often abbreviated with mempool.

 The miner who has the right to generate a block selects transactions from this mempool and puts them in a block.  The blocks are then strung together, which we call the blockchain.

 Buy 1000 euros in Bitcoin without commission?  Get started at Bitvavo

2) Bitcoin block


 If you take a closer look at such a transaction, it consists of three parts: the header, the input and the output.

3) Header


 There are a number of things in the header of a transaction.  First, this is the hash.  A hash is a kind of abbreviated view that shows everything about a transaction.  See below an example of the very first transaction that has been done:

 In addition, there is a far in the block, which has been ingrained in the protocol since December 2015.  It indicates the version number.  Third, the vin_sz also belongs in the header.  It indicates the number of inputs (where the vin_sz indicates the number of outputs).  Finally, we are also talking about lock_time.  This is the block height or the "unix timestamp" at which the payment is added to the blockchain.

4) Input


 Firstly, the input contains a reference to the previous output hash.  This refers to the previous unspent transaction output (UTXO).  In essence, this is the money that you are about to spend with this transaction.

 The letter n is the index in the outputs of the previous transaction.  It is the actual amount you want to send.  Thirdly, there is some kind of proof in the input, a spending script (scriptSig) that indicates that there are rights to send this transaction with the information from the output hash and n.

  5) Output


 Then we see a value in the output which indicates how many satoshis have been sent.  The following applies: 1 BTC = 100,000,000 Satoshi.  Secondly, it contains a script called scriptPubKey which refers to the hashed public key of the recipient.

  6) Bitcoin transaction


 In total, a transaction with bitcoin looks like this:

7) Nodes


 The Bitcoin network then consists of a network of thousands of nodes that monitor all transactions.  When a miner stops a transaction in a block, they keep an eye on whether or not anyone is cheating:

 They check whether the output matches the input;

 The digital signature of the input must be good.  The scripts must be executed properly.

 No UTXO may be spent more than once in a transaction;

 Transaction values ​​must not be negative;

 The sum of the values ​​of the input must be greater than that of the output.  This is because there is always a certain fee to be given to the miner who puts the payment in a block.

 In this way, the payment you make ends up with the recipient.  This person can demonstrate with his private key of the corresponding public key (and addresses) that he is the rightful new owner of these BTCs.

8) Payment


 One problem with bitcoin is that the amount associated with a transactions with their input and output is not divisible.  So if Alice has a bitcoin address with one bitcoin, and she only wants to send Bob half a bitcoin, she should send Bob that whole bitcoin.

 But in this case, the bitcoin network will then automatically create 0.5 BTC as "change" for the bitcoin Alice sent and send it to the third address.  This address is only accessible to Alice.  That third address will therefore also be a transaction output, which means that the address will have multiple outputs.

 In this way we get various transactions that are spread across the network in a watertight manner.  Nodes check whether everything is fair.  The blocks in which the transactions come are linked, making a payment unchangeable and cannot be reversed

 Do you have any questions?  Feel free to drop by in our Telegram chat and have a nice chat!

  9) Source: Blockgeeks


 Disclaimer: Bitcoin Magazine Benelux does not offer investment advice.  Our messages are for informational purposes only.

Post a Comment

Previous Post Next Post