I know it has something to do with public/private key pairs, but let's say that I want to send 1 BTC to a friend, how does my friend verify that I actually have the rights(own the bitcoin) to the BTC being sent? |
Your friend doesn't need to verify that. If the transaction comes through the network verifies that. It does that like this:
When someone sent you those bitcoins they assembled the TXOs with a small script. The TXI in your spending transaction will contain another small script. To verify that your TXI is allowed to spend that TXO the node concatenates both scripts and executes the concatenation; the TXI is valid if the result is 1. The script could be something like
TXI script:
Push [signature of challenge with your private key]
TXO script:
Push [random 32 bytes (challenge)]
Push [your public key]
VerifySecp256k1
Someone can know that you're able to spend those UTXOs because your BTC address is your public key encoded, so your BTC address must match the public key in the TXO script.
Also (and hopefully this is not too vague) how do I know somebody else can't just send my Bitcoin? ** Probably a stupid question.. |
The security of ECC signatures is based on the difficulty of solving the discrete logarithm problem in a reasonable time. It's currently (mathematically) unproven that the problem has no fast solution in a non-quantum computer, but no such solution is currently known. If quantum computers become feasible, though, both ECC and RSA are broken.