As far as I know, to prevent double-spend attack and to confirm that a specific transaction is valid, miners have to go through all blocks in the blockchain and check the sender's history of transactions. until now, the blockchain has over 700,000 blocks. Isn't it computationally hard for miners as the blockchain grows?
-
"to confirm that a specific transaction is valid" -- note that in Bitcoin "confirmation" is producing a block containing a transaction or producing a block on top of such a block. That is very different from checking that a transaction is valid. All nodes validate, only miners confirm.– RedGrittyBrickDec 30, 2021 at 19:54
1 Answer
Bitcoin nodes keep track of what's called the UTXO set – the set of all unspent transaction outputs. Every valid transaction must only spend existing and not previously spent outputs, so this is enough to prevent double-spending. The UTXO set can also be stored in a way to allow efficient (constant-time) lookups, so verifying transactions doesn't require more computing power as the UTXO set grows.