# Does nonce same for all node?

Suppose in blockchain network we have 5 nodes and we have new transaction done by first node of network, so now rest of 4 node will mine the transaction to commit it in blockchain network, will the nonce be same for all node mining the same transaction?

A miner (honest) more or less,in high level, runs the following algorithm:

1. Listens the network for transactions and blocks.
2. Constructs a block that includes: a) all valid transactions b) a reference to the previous block (parent hash) c) new state.
3. Search for a proof of work based on the constructed block in step 2.
4. If she finds a block she broadcast it to the network.
5. If another miner found a block she drops her previous work and continue the mining in the most recent block.

Proof-of-Work (high level):

``````H(state || txs || nonce || parent-blockid) < T
``````

where T is the target.

To find a proof of work each miner runs the following algorithm (high level / pseudocode):

``````do {
nonce = rand();
} while (H(state || txs || nonce || parent-blockid) >= T);

return nonce;
``````

So the nonce is totally random and that's what miners try to find: a nonce that satisfies a condition.

The first miner to find a block wins and all other honest miners drop their work and start mining on the new block (miners adopt the "heaviest" chain).