Blockchain untangled II – Transactions and Security
  • Micha
  • 04. September 2017
  • 7 min read
Sydney zentz 306776
Part two of our series ‘Blockchain untangled’ is dedicated to transactions. Why is that? It will foster a deeper understanding on how a blockchain works, why it is save and what it is good for.

Again, we will be talking mostly about the Bitcoin blockchain: How (and why) does a transaction between two people work without any intermediary? Can this be secure? Well, let’s tell you about it!

Clickbait: BITCOIN DOES NOT ACTUALLY EXIST!!!11

Calm down, the money you invested in Bitcoin isn’t gone. As indicated in the first article, there isn’t a database entry stating “Bob owns 5 BTC” or “Alice owns 120 BTC” and neither is a Bitcoin a file (this is very important to keep in mind: BTC =/ file).

The Bitcoin blockchain just records data of transactions. This means that if a block contains the information “Bob transferred 10 BTC to Alice” it authorizes Alice to make a transaction of at least 10 BTC (based on the information that a transaction of 10 BTC was made with her address as the recipient and depending on which transactions she received and sent before) which, again, will be secured in a future block.

To know how much BTC someone “owns”, meaning how many BTC they are allowed to transfer to other addresses, you will need to track down each and every transaction ever made in the blockchain to calculate the balance of a certain account through its received and sent transactions. That clarifies why “a Bitcoin” exists only as the result of logged transactions.

Given the vast amount of transactions, finding out who received and sent which amounts of Bitcoin would be virtually impossible. But fear not, for there is a solution: your wallet. Your wallet keeps track of your balance based on past transactions. It’s basically a software installed on your computer or mobile device which interacts with the bitcoin protocol in the distributed network. It reads the logged transactions in the chain of blocks that make up the blockchain (remember: the last block is also a proof that all prior blocks of that fork are valid) and displays the resulting balance of a certain user.

In one wallet, a user can basically have as many addresses as he wishes. You’ll want to generate a new address for each new transaction to not allow any conclusions to be drawn on your real identity, which might be possible if there are enough recurring transactions for one address. So your wallet is the interface between you and the blockchain.

The key to Bitcoin

Transactions between participants in the network are made possible by a key pair consisting of a public and a private key. The public key can be seen by anyone and it’s the basis for your bitcoin address which is generated from the public key. Anyone can see the BTC balance of any address and transfer BTC to it, but only if you have the private key to the address, you can “unlock” it and make a transaction from it.

So you absolutely and most importantly before anything else should NEVER lose your private key, give it away or store it unsafely. Ever! How many people have lost their private keys after buying some BTC for a couple of bugs years ago that would now make them rich? I don’t know, but there are plenty. Keep your keys safe. I’ll say it again some more times.

Our friend Bob wants to transfer some BTC, for example because he bought something from a merchant who accepts BTC or he wants to send it to someone who sends him Euros or Dollars in exchange. Let’s call this person Alice. The subsequent transaction consists of three main elements:

The Input

This is the proof stored in the blockchain of Bob having, at any time in the past, received BTC. The input for a transaction conducted by Bob refers to as many outputs of transactions sent to any of Bob’s addresses sufficient to covering the amount he is looking to spend.

The Amount

This is the, well, amount of BTC Bob wants to send to Alice. The smallest possible fraction of a BTC is called Satoshi and it’s worth a stunning hundredth of a millionth of a BTC (0.00000001 BTC).

The Output

Alice’s Bitcoin address.

The Input can be based on multiple addresses which Bob has the private key to and which are stored in Bob’s wallet. So, transferring 1 BTC, Bob could take 0.5 BTC from address A, 0.3 BTC from address B and 0.2 BTC from address C. The Output can also contain any number of addresses, either all belonging to Alice or to other people. The Output also contains Bob’s address and here’s why: If someone has sent Bob 5 BTC in a transaction (which was the output of that said transaction) he can use it as an input for the upcoming transaction of 1 BTC. But instead of deducting 1 from that 5 BTC, Bob has to send the entire former output as his input for the transaction to Alice. He will receive 4 BTC as change – and this is why he needs to add his address with the output, so the excess amount can go back to his wallet.

Okay, Bob is doing it: he sends 1 BTC to Alice. To start this off, he signs the following elements of the transactions with his private key: the amount of 1 BTC the input of the transaction, proving that he can make the transactions based on the information his key provides about formerly received transactions the output (Alice’s address)

The transaction is now broadcasted to the Bitcoin network, where miners can see it waiting for verification as part of a block. Once added to a block which is then mined, the transaction is forever logged.

Alice now has a brand new Bitcoin stashed in her wallet. But does she really possess a Bitcoin now? She actually does not. Only when she proceeds to prompt a transaction herself she refers to the former transaction by Bob, therefore making the value of 1 BTC available to her. What she possesses in BTC is only what is logged in other transactions’ outputs.

I know I’m definitely splitting hairs here, but I find this vital to understanding the essence of blockchain and transactions. Of course you will also say ‘I have 4 Bitcoins’ instead of ‘As per numerous transactions containing one of my addresses as part of their output, I am authorized to draw a total of 4 BTC to conduct transactions myself’. If you prefer to say it like this, you’ll need to see someone…

Does size really matter? BTC vs. BCC/BCH

It’s as easy as that. By the way, Bob has just transferred over $4000 to Alice. Thanks to Satoshi, you can of course transfer fractions of Bitcoins. If you transfer really large amounts, you want to make sure the transaction is verified as soon as possible. To achieve this, be advised to add a higher transaction fee to your transaction as an incentive for the miners to add your transaction to the next block they are mining. Scanning all open transactions, the miners add those to the blocks first that offer them the most benefit in terms of mining fees.

Every ten minutes a new block is mined containing up to as many transactions as the block can hold within its 1MB size. With the recent user activated hard fork (UAHF) there now is also the Bitcoin Cash (short: BCC or BCH) network with a larger block size of 8MB, allowing for more transactions to be logged every ten minutes.

I hope the first two parts of this series conveyed a sense of understanding of what the technology actually is, what it can do and how it works in its very basics. Stay tuned for more. The next part will deal with Ethereum.

Regular micha 02
A post by Micha
Rasender Reporter und King of Content