Some things you need to remember about bitcoin:
- Bitcoin is cash, not a bank account. These are very different models.
- You pay by handing over digital coins, not by making a bank-transfer between accounts.
- No one but you cares what total amount of Bitcoin money you have, they don’t need to know.
This fundamental misunderstanding comes up a lot in different forms. The questions below have answers which touch on this and may help form a clearer understanding:
For anonymity reasons key pair of a wallet can change.
HD wallets generate an extra key pair for each transaction but the old key-pairs are still valid and are not changed.
Then how does miner validate if a sender has enough bitcoins?
Miners don’t care how much money is in a wallet. Bitcoin is cash and like other forms of cash, people don’t care how much money you have, they only care that the cash you give them is enough and is genuine and not a forgery.
Is this has something to do with origin of bitcoin sent in transaction?
What you spend as inputs to a new transaction are the outputs of a previous transaction in which you received money. These are unspent transaction outputs (UTXOs).
what if sent sum is 30 BTC, but they are all received from 3 (3×10 BTC) separate wallets?
People don’t care. Your transaction could have hundreds of inputs and hundreds of outputs – though that makes the fee higher. All that matters to the recipient and everyone else is that the cash is genuine. In Bitcoin this means UTXOs and that you provide proof of right to spend (you supply a mathematically derived number that satisfies the spending script of the UTXO)