In Chapter 4, Understanding the Blockchain we described a hash as the result of a mathematical function applied to a set of data. In our case, the data is the new block of valid transactions. When a hashing function is applied to the data, a numerical value is returned. If we change any byte of the data and recompute the hash, we'll get a completely new hash value that's radically different to the original.Mining involves using the hash function to generate a hash result. If the hash result matches the target, it's considered the solution. If the result is invalid, a throwaway number called a nonce is added to the data. The data set is then hashed again, giving the miner another try. This process is repeated until a solution is found.When a solution is found, it's broadcast to the network as a new block, which also contains the difficulty target and the winning nonce. This is called proof-of-work. The other nodes on the network can recompute the hash on the block and the nonce to verify the proof-of-work.If accepted, the new block becomes part of the blockchain. The nodes that agree on the solution then share the new block with the other nodes on the network. The end result is that the new bitcoins and the transaction fees collected are awarded to the winning miner.