Blockchain/Bitcoin data? Transactions? What does this all mean?

  • Posted by: Haaroon Yousaf
  • Category: Big Data, Blockchain, Insights
Bitcoin logo

In our previous post we talked about the background and history of blockchains and where it has come to. In this post we will take a deeper dive into Bitcoin, discussing what it is, how it works and what the data looks like. 

What is it? 

Source https://www.flickr.com/photos/jason_benjamin/8631889823

Bitcoin is known as a peer-to-peer and distributed “electronic cash system” with no third party. Let’s break this down. 

  • Peer-to-peer means the computers that run the software are connected directly to each other. 
  • It’s decentralised and distributed, meaning the ledger (the record of transactions, so who sent whom what coins) can be kept as a copy on every single interested machine. 
  • Electronic cash system” is a monetary system which is done through digital means. 
  • No third party” means that you do not need an intermediary to conduct the transaction, the coins move directly from sender to receiver. So no need for banks or transfer unions. 

There’s a lot of cryptography and other security principles involved, but we can get to that in the future.

How does it work? 

Here is a high level overview about how the system works. We omit many of the technical details for simplicity.

There are also two types of data, blocks and transactions. A Transaction is a record which shows coins being sent between parties. A Block is a group of verified and accepted transactions.

In Bitcoin there are two types of participants, miners and users.

Users send and receive coins to each other using their public addresses. When a user sends a transaction, they also attach a fee. This fee is an incentive to encourage the transaction to be accepted by the miners. It is like when you buy something with your credit card, the bank takes a fee and in return checks the transaction is okay. Unlike traditional finance, blockchain transactions are permanent meaning they cannot be reversed under normal circumstances. Once the coins are sent they can’t come back, unless the recipient sends them back in a new transaction.

Miners mint new coins and validate users transactions. To mint new coins a miner has to make new blocks. Blocks are groups of valid transactions from users. To make coin minting fair for everyone to have a chance, the miners must solve a hard maths puzzle in order to create new blocks. Once you have an answer it’s easy to check if it’s correct.

Once a miner finds a solution, they must then tells everyone on the network. The other people on the network check the answer. If more than half of the network accept, then the miner gets the prize (new unused Bitcoins and all transaction fees of the transactions). All the transactions they choose go into the ledger as a new block. As of 13th August 2020 a new block mints 7BTC which is roughly $80,000 USD.

Note that a miner can also be a user and vice versa.

Now lets put this all together. Let’s say that our friend Alice wants to send Bob 5 Bitcoins. 

  1. Alice creates a transaction. This says “I, Alice, will send Bob 5 BTC (with a transaction fee), whoever mines my transaction can get this fee”. She tells everyone she knows about this transaction. In her transaction she puts Bob’s Bitcoin address as the recipient.
  2. Charlie is a miner, he hears about Alice’s transaction from the network. Charlie validates Alice’s transaction, checking that Alice actually has these coins in her wallet and that she has not already spent them.
  3. Whilst validating, Charlie is also finding the answer to the math puzzle to make a new block. Luckily he finds the correct answer, uses this to create a new block (with Alice’s transaction) and annouces this to the network.
  4. The other miners confirm that Charlie has the right answer to the puzzle and accept his block into the ledger. This confirms Alice’s transaction and the coins are sent into Bob’s wallet.

What does the data look like?

As mentioned previously, Bitcoin has two types of data, blocks and transactions. A Transaction is a record which shows coins being sent between parties. A Block is a group of verified and accepted transactions.

An example block, taken from blockchain.info, a website where you can buy, store and trade bitcoin and look at the transactions. 

Above is an example of a bitcoin block. A bitcoin block contains data such as the time it was made, the amount of fees that were rewarded from the transactions, the transactions in the block, the block number (its position within all the blocks) and its unique identifiers. 

An simplified example transaction taken from blockchain.info

Above we have obtained an example transaction with some fields omitted for simplicity. A transaction contains information such as who was sending the coins (input), who received the coins (outputs), the identifiers of the people who send and received the coins (addresses), the amount of coins send and received, the block this was confirmed in and the unique identifier of the transaction (hash). 

In our example above, we have a single sender who sent 0.7436288 Bitcoins to two addresses. 

The first address (3EunooPX1BQQ6PHEUwicLbkGXuc8AXkQCX) received 0.5438396 Bitcoins, the second address (1EnnACZL3YzUNqhgTM9yBCuSn6bEtRKA3Q) received 0.1991202 Bitcoins, the remaining bitcoins (0.0000669 Bitcoins) were the transaction fee.  

Where is this data stored?

This data is stored in Bitcoin nodes. If you want to get access you can simply download the bitcoin client https://github.com/bitcoin/bitcoin/ and run it in full mode. Watch out for our next blog post where we will explain how you can run this node and some free tools to get access to this data!

References

Author: Haaroon Yousaf