# Bitcoin block hashing algorithm. nonce [closed]

Referencing the Bitcoin wiki, what is the auhoritative source for providing a hash of the previous block? Or do miners keep listening to latest blocks?

How is hash of the Merkle root generated?

Can a miner generate a block with no transactions? That means generating block by keeping hash Merkle root as all 0s.

One more question: nonce size is only four bytes (32 bits). Given version, previousBlockHash, hashMerkleRoot, bits are constant, would it not be very easy to iterate through all possible nonces?

2^32 = 4 G = 4 G hash machine can finish this task in one second.

## closed as too broad by Murch♦Mar 31 '16 at 16:17

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• -1 Please ask only about one topic per question post. – Murch Mar 31 '16 at 16:17

What is the auhoritative source for providing hash of previous block? or do miners keep listening to latest blocks?

There's no authoritative source, that's the whole point of Bitcoin. Miners keep listening for latest blocks, yes. They decide for themselves which block to accept. And since all miners (and clients) are programmed to accept only valid blocks (where its header hash is equal or below than the current target) they soon reach consensus upon which blocks are valid.

One more question: nonce size is only 4 bytes(32 bits). Given version, previousBlockHash, hashMerkleRoot, bits are constant, would not it be very easy to iterate through all possible nonces? 2^32 = 4 gigs = 4 gig hash machine can finish this task in one second.

More often than not, just that 4 byte nonce is not enough randomness to find a block. Miners constantly add new transactions - therefore the `hashMerkleRoot` isn't really constant.

Also I think there's an `extranonce` field which adds more space.

• You cannot create a block with no transactions at all. Every block needs a coinbase transaction which claims fees and subsidy for the miner. Because of that, the merkle root can never be emoty. Also, it is inside this transaction that the extraNonce is located, so it affects the block header through the merkle root. – Pieter Wuille Nov 17 '13 at 11:06
• @PieterWuille thanks I removed that part of my answer. Perhaps you can answer more specifically on the issue of the transactions as I also wasn't aware of it. – Luca Matteis Nov 17 '13 at 12:01
• @PeterWuille Could you please point me to any documentation about extraNonce and generating MerkleRoot. – Htaras Nov 26 '13 at 16:01
• @Htaras the extranonce is documented here: en.bitcoin.it/wiki/Transactions#Generation Miners also tend to play with the block time to add extra randomness, especially in pool mining. This is one of the reasons block times are a little all over the place. – Matthieu Jun 27 '14 at 2:06