In this article we understand basic blockchain block structure and learn about the fields by taking example of a real block with block-number=#601439
In the Block we have following fields:
Block Number/Block Height
It represents the number of a block in line, so the first block would be 1, the second 2, and so on to our block 601439.
Maximum limit for the amount of transactions. It is not the actual number of transactions allowed instead it is the size of transactions that is allowed.
A block hash in this case, which is created from the block header with SHA256
This is a protocol version. Miners need to know protocol versions in order to be able to properly process blocks.
If all the transactions are used to create a single hash, this would be simple, and not what we have here!. This principle is not used because if we wanted to run a verification of a particular transaction we would need to know all of the other ones as well. This is doable, just less efficient than the Merkel tree approach.
In this approach , we only need some of the “hashes”. We go slowly, we first take hashes in a set of 2 transactions till we reach just one hash.
Number of Transactions
Each block contains a number of transactions. Usually a maximum size is defined, but the number of transactions per block varies.
This is the time when the hashing actually took place. It can be in a different format but for all blocks with the same number it should point to the same time. Notation difference is ignored.
In this example transaction refers to payment, but different protocols can define transactions in different ways. Yet it does not always have to be an individual transaction. Instead it can just be observed as an event defined by a given protocol.
It can be a hexadecimal number. This is just another representation of difficulty
When the hashing process takes place, the difficulty is determined by the targeted number of zeroes that the hash needs to begin with. As more people involved in mining we need to increase the difficulty
Difficulty = expected/actual(available computation power)
if D >1 then increase(0.25, 4)
if D < 1, then decrease(0.25,4)
want no sudden change that’s why keeping this threshold
so newDifficulty = oldDifficulty * expected/actual
targetDiff = targetMax(=Bits)/difficulty
so, blockHash<targetDiff always.
This is the data that we need to the block data to make block hash < targetDiff
This is the hash of the previous block, and is embedded into the current block. Hash should have a certain number of zeroes before it.