Why Nostr? What is Njump?
2023-03-27 09:49:44

MTozoni ⚡😺 on Nostr: I wrote this 10 years ago. I find I do have to rely on it for newbues asking "can't ...

I wrote this 10 years ago. I find I do have to rely on it for newbues asking "can't someone just hack it?"
https://www.reddit.com/r/explainlikeimfive/comments/1ka962/eli5_how_bitcoins_work_mining_them_and_spending/

You and I both have a large sheet of paper (account ledger). Both of our papers have two lines, reading:

𝐀𝐜𝐜𝐨𝐮𝐧𝐭 𝐀: 𝟓 𝐛𝐢𝐭𝐜𝐨𝐢𝐧𝐬
𝐀𝐜𝐜𝐨𝐮𝐧𝐭 𝐁: 𝟑 𝐛𝐢𝐭𝐜𝐨𝐢𝐧𝐬

You are account B, I am account A. Both of us also have a secret signature that each of us can verify to be authentic, but can't actually see what secret is used to create it (this is public/private key cryptography, and is beyond 5 year olds) Let's say I want to send you 2 bitcoins. To do that, I take out a scrap of paper, and write

𝐓𝐫𝐚𝐧𝐬𝐟𝐞𝐫 𝟐 𝐁𝐢𝐭𝐜𝐨𝐢𝐧 𝐟𝐫𝐨𝐦 𝐀𝐜𝐜𝐨𝐮𝐧𝐭 𝐀 𝐭𝐨 𝐀𝐜𝐜𝐨𝐮𝐧𝐭 𝐁
--- 𝐒𝐢𝐠𝐧𝐞𝐝, 𝐀𝐜𝐜𝐨𝐮𝐧𝐭 𝐀'𝐬 𝐒𝐞𝐜𝐫𝐞𝐭 𝐒𝐢𝐠𝐧𝐚𝐭𝐮𝐫𝐞.

Then I write the following on my own big sheet of paper

𝐀𝐜𝐜𝐨𝐮𝐧𝐭 𝐀: 𝟓-𝟐=𝟑 𝐁𝐢𝐭𝐜𝐨𝐢𝐧
𝐀𝐜𝐜𝐨𝐮𝐧𝐭 𝐁: 𝟑+𝟐=𝟓 𝐁𝐢𝐭𝐜𝐨𝐢𝐧

And pass that scrap of paper to you, and everyone else using bitcoins. When you get that scrap of paper, you look at your own copy of the ledger sheet to see if Account A has 2 bitcoins to transfer, check that the signature that was used to sign that note is really valid (matches Account A) and if yes, add the same +2/-2 information to your paper as well. Owning that secret signature is what enables you to spend bitcoins, so me owning the secret signature for Account A, and you owning the secret signature for Account B, allows us to spend money from our accounts. In the end, the balance of each account is the beginning balance, plus all the changes we have added on later (so, 5-2=3 for Account A, and 3+2=5 for Account B).

Now, let's say I write a message saying I want to transfer 9 bitcoins from Account A to Account B, and pass that message on to you. When you get it, you will check your sheet, see that Account A doesn't have 9 bitcoins, and simply reject that message. Likewise, let's say that I send you a message saying I want to transfer 2 bitcoins from Account C to Account B. Even if the secret signature for Account C is valid, when you look at your sheet, you'll see that Account C doesn't even exist, and again simply reject it. This is basically how Bitcoin works, with everyone owning a copy of such a list of accounts and balances, passing any changes around as messages, and is how it prevents someone from creating counterfeit bitcoins, or just creating them out of thin air.

Now, regarding mining, basically, instead of you doing the work of writing those changes to the big sheet, you are delegating someone else to do it. You still keep a copy of the sheet and look at it to verify that accounts have the money they say they do, and you still verify that the signatures are correct, but what Bitcoin miners do is they actually thoroughly verify the transfer messages, write that information down on the sheet, and then generate an EXTREMELY complicated and nearly impossible to forge time stamped signature to sign off on all changes to the paper. It's as if they take each completed sheet full of these transactions, and stick it into a glass safe, where everyone can look at the paper, but no one can alter or mess with it (like posting accounting entrees to the ledger in a way that can never be changed again). This keeps others from going back and deleting old transactions, or fudging with the numbers in any way, so that, for instance, I can't send you 2 bitcoins, and then go back, delete that transaction, and try to send those 2 bitcoins to someone else (double-spending). For the work of verifying and securing the transactions, miners get to write a new account on the piece of paper with 25 new bitcoins in it, which from then on belongs to them. That's the only way the system allows for new bitcoins to be added to the ledger sheet, and how Bitcoin gets distributed in the community.

Let me know if I can improve on this somehow.
Author Public Key
npub10ke32hpkj9l0765w0k37pcjd739humclg36zmntcea240t7e6apqwz4y6g