There is no way to make sure everyone on the network is honest. So there must be a way to prevent miners from creating new blocks that benefit them. The way it works is that many people try to guess the answer to the calculation problem and no one knows who will get the right answer first. The person who gets the correct answer first receives a reward, but only if all other nodes agree to accept that transactional record (if it becomes apparent that a miner is creating fraudulent transactions, other nodes may collectively refuse accept their contributions). This is why the process of creating a new block is designed to be energy intensive, so that a cost is associated with the creation of each new block. This prevents miners from simply creating a whole series of new fraudulent blocks in the hope of being accepted, their cost exceeding the potential benefits. The possibility that each miner is the one that resolves each block is quite small, and since it takes a lot of effort to resolve the blocks, they can not just send spam solutions over the network . This means that they are encouraged to deploy their efforts only if their contribution is accepted by the network.