how the coins are generated from air ?
It is not from air, but from proof of work algorithm, i.e., from their computer power and energy.
I made a summary here:
Proof of WorkIn the Blockchain, all transactions are publicly announced to all nodes, as there is no central authority who validate transactions.
Proof of Work is an algorithm that rewards participants who solve a cryptographic puzzle in order to validate transactions and create new blocks (this process in known as mining).
This puzzle consists in scanning for a value (called Nonce) that when hashed together with thr block data, the hash begins with a number of zeros.
![](https://ip.bitcointalk.org/?u=https%3A%2F%2Fi.imgur.com%2FfOGqlOz.png&t=665&c=sym7y6HmEMXwww)
In this
website you can see how this process works. You can try to find a Nonce that when hashed generates a hash that start with 0000 on your own. You will see that it is hard, unless you are very lucky. And you are going to be lucky twice in row, if you do go to a casino or something like that lol.
The difficult in finding that nonce increases exponentially as more zeros are required by the block. Difficult is adjusted every 2016 blocks, based on the average hashrate of those past 2016 blocks, so that 2016 blocks are mined every two weeks. (So a block is mined every 10 minutes)
Miners only get their reward if they are mining the longest chain, as it has the greatest processing power invested. If the honest nodes control the majority processing power, the honest chain will always be the longest and will outpace attacker’s chain.