Suppose Alice has 30 bitcoins from David. Now Alice wants to transfer amount 20 bitcoins to Bob.
Now, Alice creates a transaction with Bob's bitcoin address.
To prove authenticity and integrity, Alice digitally signs the current transaction.
To prove that Alice owns the money, the current transaction includes hash from David's transaction which can be verified by the recipient and other nodes on the network.
As per my understanding, transactions are collected in blocks which are linked to form a block chain. Every node on the network stores the block chain. To verify whether Alice owns the money, one has to verify the bitcoin address of Alice in David's transaction. Now David's transaction can be very old, in older blocks. How this check is done? Is the hash of David's transaction for Alice's ownership checked in every block in the block chain?
Is the ownership verified by going from block to block?
Also what prevents Alice from using David's transaction again and again?