when a miner solves a block it gets sent out to the network, when other nodes receive it, how do they verify that the block received was indeed solved and can be added to the blockchain.
So you don't know what the answer is but if you got the answer you know what the question was.
- The difficulty (or nBits as it is called in the code) is shorthand for how difficult it is to solve the block. Essentially, it encodes a target value, and the hash of the block (when treated as a 256 bit integer) must be below that target value to be considered solved.
The other nodes can verify it by hashing the block using the supposed solution nonce, and if it returns the same hash as the solution, and it meets the difficulty restrictions (correct number of zeroes at the beginning), the that block is confirmed as solved.
Let's say block #396716 has been just mined. The participants verify:
Is the block really next? Simply look if the previous block is already accepted. Each block contains the ID of previous block.
Has miner performed enough work? Because difficulty is now 120 this means there should be 120÷8 = 15 zeroes in the block ID.
000000000000000 <- 15 zeroes. Therefore miner spent enough work.