The "Keys" in Bitcoin that Everything Depends on + Insightful Comments get YOU 100SP~
This is part 3 of my series on the basics of blockchain/bitcoin. Start with part 1: https://steemit.com/bitcoin/@ddangerwu/learn-by-interacting-with-hash-blocks-and-blockchain-get-100sp-delegated-for-insightful-comments
This post will focus on public vs private keys and its function in bitcoin transactions. Again, I highly recommend that you play around with the parameters discussed in the post by going to https://Anders.com/blockchain/public-private-keys/keys.html Disclaimer: This website was made by Anders Brownworth and you should check him out at https://anders.com.
So last post ended with our understanding that ledgers on the blockchain because there are many transactions of A sending X amount to B. But what is stopping people from just adding/changing a transaction and spending all of someone else money? Or, we can spend our money to multiple people, creating the problem known as "double-spend".
Let me introduce to you the idea of private and public key pair. Let's assume that you can make up some string of numbers and derive another string of data similar to how you could make up some data and derive some hash as we learned in Part 1. You can think of the public key as the representation of your private key, open for everyone to see. As you can see from the above picture, the public key for the private key "1" is "0479..."
What is very important to understand here is that you can verify the keys match but cannot go backwards and derive a private key with your public key. Imagine that you have a math problem of 2+x=4. You figure out by doing the computation that the answer x=2. You can very easily verify that the answer and the problem match but if only given x=2, you have a infinitesimally small chance of guessing the problem is "2+x=4". This concept is called asymmetrical encryption and it is at the heart of making bitcoin work. My analogy dumbs down the concept a lot and you should read about it further here: https://en.wikipedia.org/wiki/P_versus_NP_problem
For now, let's make up a random private key "1030..." and derive its public key "041b..."
Now, with our private key, we derive again or sign the data "Hello again Steemit! Remember to follow, upvote and resteem if you found this post helpful!" This gives us the signature "3045..."
If we input the same info again, we can check or verify that the data, signature and private key match. This is similar to that given x=2, we can verify the problem 2+x=4 matches with the answer.
Notice that if I change any given components, in the above picture I changed the private key to 1234, then the transaction does not verify.
For a real transaction, we have the data be a structured message with peoples' names replaced by public keys. Similarly, we can verify the transaction given the public keys and the signature of the sender, which was derived from the private key of the sender.
Lastly, let’s put everything together into the blockchain distributed ledger (see part 2 if you don’t understand). I’ve changed the first transaction that I have in block #2 from 10 to 1000, giving myself more money. This causes the block to be invalid because that transaction is invalid.
Notice that even if I re-mined block #2 to make the hash “follow the rule”, the transaction is still invalid because the signature don’t match. This is how can throw the transaction back into the mem-pool and still have a valid block.
Important understanding: These concepts shows that one of the biggest reasons that bitcoin has value is that you can get a new address or public key by just making up a new private key. This allows you to send money peer to peer, cutting out any centralized permission. For details, see my video: https://steemit.com/bitcoin/@ddangerwu/the-reason-that-bitcoin-has-value-is-because-get-100sp-delegated-to-you-by-commenting
Now that you’ve read the post, what did you think? I want to do my part to fight spam and promote insightful comments/discussions. I read every comment and value your feedback. Write something and I will pick the most insightful comment to delegate 100 Steem Power to you for a week.
You may earn curation awards using my STEEM manually OR use a service like SmartSteem to vote automatically for you.
Here is last post's winner: