Miners collect transactions into blocks and try to solve a cryptographic problem associated with that block. The first miner to solve the problem adds the block to the blockchain and receives a reward.