1

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 "A" and there exists a transaction from user "B" 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 "B" from generating a public/private key pair then creating and signing a transaction saying that I, user "A" 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.

1 Answer 1

2

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.

4
  • If I'm understanding correctly, my Bitcoin address that I sent to the payer will be: hash(my address + my (public key that is generated from my wallet) pk)? Then to spend it I will put that pk into the transaction. Then verifiers will check that hash(pk) == hash(transaction sent to me before)?
    – Andrew Q
    Commented May 27, 2021 at 3:24
  • Your address is just hash(pk). This is placed into the transaction sent to you. When you spend, you put pk into your transaction, and verifiers will check hash(pk) == hash from previous tx.
    – Ava Chow
    Commented May 27, 2021 at 4:28
  • Oh ok I think I get it now. Then once my pk is in the transaction and verified, the verifiers will also check that my pk can verify the signed message created with my sk. And I can assume that the life span of using that sk/pk pair is done and next time I use or receive a token, it will be with a different pair?
    – Andrew Q
    Commented May 28, 2021 at 22:40
  • @AndrewQ There's no expiration per se. You can reuse addresses (and thus reuse keypairs) if you want, however this is not advised because it reduces your privacy.
    – Ava Chow
    Commented May 28, 2021 at 23:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.