What’s in a block?

Introduction

If you’ve spent some time reading up on the fundamentals of bitcoins and the block chain but felt it was way over your head, here it is from another angle.

Reading the likes of:

can be a bit daunting so I’ve created some pretty pictures instead.

The secret sauce at the source

Analyzing a single block is a good starting point. It is not actually that hard to view a single block. You can see the command I ran, but it did take a while to understand it.

Here is the very first block that was ever created called the “genesis” block. You can see the hexadecimal representation in the centre column and the ASCII on the right. 5 different parts of the block can be identified. The magic number, block size, block header, transaction count and transaction. See the diagram below.

But wait. There’s more!

The block header and the transactions portion can be expanded.

The updated block diagram shows the composition of the block header (6 further fields within) and the transaction (also 6 further fields).

Are we there yet?

Almost. The list of inputs and list of outputs in the transaction portion can also be expanded.

Pictures are worth a thousand words as they say. Now, hopefully those links make more sense.

Other points

Block Size

Understanding a block composition allows insight into other concepts also. For example, the recent bitcoin scaling debate of increasing the block size. The transactions in a block are not fixed in size or capped. They are of type Var Int which means it’s of type integer but the size is variable. Does this mean you can put as many transactions as you want here? Yes…. but it’s this line of code that will stop you.

Note this is in contrast to bitcoinClassic where the size is currently 2Mb.

Smart Contracts

The capabilities and potential of smart contracts has been widely publicised. For example, a smart contract is where 3 out of 5 board member’s signatures are required to pass a vote. This can be programmed into the ScriptSig field which lies in the transaction input. Only when the condition is met, will the rule execute.

Summary

It’s great that new applications are being dreamt up everyday utilising the “block chain” technology. From all the hype, it feels as if humanity itself is changing. Regardless though, understanding how things work is the first step in the entire process.


Originally published at www.anintegratedworld.com on February 25, 2016.