This question already has an answer here:

As I understand it mining provides the security for the blockchain in that it makes it hard to forge a transaction. The incentive for finding eligible hashes is a reward in the form of Bitcoin. As more blocks emerge, the cost of mining increases. But the number of bitcoins is limited to 21M. Won't that mean that at some point in the future, either all bitcoins will be gone, or mining will not be cost effective anymore? And in both cases, why would anyone still mine? Then wouldn't the hash rate drop considerably and thus the security?

marked as duplicate by Nick ODell Aug 5 '15 at 2:26

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.