What does bitcoin do that prevents someone from using your coins by just generating a key pair and saying "you" sent those coins? I think I'm missing and understanding about the current process of how your wallet works and how the transactions are signed.
For example, if I'm user &quot;A&quot; and there exists a transaction from user &quot;B&quot; where I received 10 BTC that has been written into a block. Then for me to use it I just generate a random public/private key pair and sign the transaction with the private key.
What is stopping user &quot;B&quot; from generating a public/private key pair then creating and signing a transaction saying that I, user &quot;A&quot; sent them 10 BTC?
I've read that some wallet implementations generate a list of public/private key pairs that can somehow be associated with the wallet address? I'm not sure how this would come into play if this is the case or if I'm misunderstanding this bit of information.
When you spend Bitcoin, you are not just using a new randomly generated keypair. You are using a specific keypair generated before. In order for you to have been sent Bitcoin, you have to give the sender a Bitcoin address. This Bitcoin address contains the hash of your public key. When you want to spend those Bitcoin, you put your public key into the transaction and verifiers will check that that public key hashes to the hash specified in the transaction that sent those Bitcoin to you. If you just put a newly generated public key there, it would not match the hash and so the spending transaction would not be valid.