how does bitcoin solve the same chain replay attack?
In all cases what you are describing is a double-spend. Bitcoin uses a UTXO model (not an account based model) which means that there is a set of coins also known as the UTXO set or Unspent Transaction Output set.
Transactions destroy coins and create new coins.
A new transaction attempting to spend a coin that has been destroyed is simply invalid.
Your concept of you and Bob &quot;having x BTC&quot; as a balance is incorrect for Bitcoin. What you have is a set of coins (a subset of the network-wide UTXO set) that you can destroy with a transaction by solving an output script. When you send 10 BTC to Bob what's really happening is you are taking one of your coins (lets say a coin with a 20 BTC value) and destroying it. Your transaction replaces it with two new coins, both for 10 BTC -- one secured by Bob's public key and the other secured by your own public key (this is your &quot;change&quot;).
Once that transaction is confirmed the original 20 BTC coin no longer exists. Sending the same transaction a second time would be invalid because it attempts to destroy coins that don't exist.