A Merkle tree is like is a binary tree like structure to condense all the transactions to be hashed into a block.
The way it works is like a traditional binary tree.
Merkle Trees are used in many cryptographic functions to provide efficient data storage and reduce the level of data needed to prove something exists.
All of the transactions that the miner has picked are ordered in a row – with the generation or coinbase transaction first (the transaction that generates the Bitcoins for the miner who found the solution to the previous block) – if the number of transactions is odd then the last transaction is added twice to make the number even – the number of levels of the tree depends on how many transactions.
The first transaction is hashed via SHA-256, then the second and the third, and so forth. The next step is to hash the hashes of the first and the second, then the third and the fourth and then the fifth and the sixth. After this step the hash of the hashes of the first and the second with the hashses of the third and fourth transactions. This continues up until the top of the tree.
Remember that the SHA-256 hashing algorithm produces a 32 byte string, so when you concatenate a 32byte string with a 32 byte string you create a 64 byte string. This is then hashed by sha-256 to produce a 32 byte string right up the merkle tree until all the transactions have been joined up.
The corresponding answer after the merkle tree has been calculated is the merkle root – again a 32 byte number. For each miner the Merkle root is generally different as the way each miner orders the transactions is different and so the hashes are different.
This means that all the miners aren’t running through the same set of calculations when they are applying their ASIC’s through brute force to solve the proof of work.
- How to Buy Bitcoin With Luno Sponsored
- How to Buy Bitcoin With EO.Finance Sponsored
- Mining Sky - How to buy a Mining Contract Sponsored
- How To Earn Money With E-Sports Betting? Sponsored
- Everything You Need to Know About Ripple and XRP
- Why Is the Price of Bitcoin so Volatile?
- Why Do Bitcoins Have Value?
- What is a Security Token?
- How to use our API
- Get Instant Crypto Loans in 3 Easy Steps