I’m trying to get to know how cryptocurrency works and everyone treats the blockchain like an active record of every transaction, like if someone wanted to reuse the same bitcoin with the same code identifier thingy specific to that bitcoin then they can’t because it has been used to create a hash that people have and are trying to create a new hash with? I really don’t get how a blockchain provides any security if it’s just a hash of all the transactions in the past with some additional metadata
1 Answer
It's not just a hash. Though you can use a single hash to "represent" or "cryptographically fingerprint" the entire blockchain so that in just a glance you and everyone else in the network can verify the entire history on your both hard drives is identical.
There is an actual blockchain. It's a giant datastructure, today about 500 GiB in size, that holds every transaction ever made and confirmed in the Bitcoin network. But imagine comparing such a record with someone else. That would take maybe an hour if you could put a cable between you and the other person's computer and many hours if the other person was on another continent. Now try to do it with everyone that you try to interact with.
So, instead, we can use cryptography to fingerprint a piece of data. It's "cryptographically secure" which means it's astronomically hard for someone to cheat the fingerprint system. How it works is that each transaction itself, gets hashed. This hash is the fingerprint. Then for each block, each transaction fingerprint is built into a hash tree, resulting in a fingerprint of all the block's transactions. That fingerprint is then inserted into the "block header", a piece of data that contains some metadata of the block, like a timestamp and such, together with this fingerprint of all transactions, to form itself a fingerprint of the block. So we have a single fingerprint that identifies the block and all transactions in it.
Now, every block also contains the fingerprint of the previous block, that's why we call it a block chain. So if every block, mentions the fingerprint of the previous one and is itself again fingerprinted, that means that the fingerprint of the very last block indirectly fingerprints all the previous block and hence all transactions that have occurred inside those blocks.
So a single 32-byte (64 alphanumeric characters) can actually fingerprint the entire history of Bitcoin transactions.
Now of course, you wouldn't know the transactions as such. You would have to ask people about them. But you could both (1) once you have the fingerprint, validate that the history people are telling you about actually matches the fingerprint and (2) once you have all the history, compare your fingerprint with everyone else's to see if they match up.
I guess this answers your question.
I'd like to make a really small additional remark, though. As, of course having a fingerprint to compare with doesn't help if everyone in the room has a different fingerprint. Then all you can conclude is that they don't match, but what then? That's where Bitcoin mining's proof-of-work comes in. Bitcoin mining attaches a certain amount of computational work to a block. Apart from the crucial property that producing this work is hard, it also is easily mathematically quantifiable. This means that in a pretty fast and straightforward way, you can calculate the total work that has gone into a given fingerprint.
This way, in a room full of non-identical fingerprints, if everyone agrees on the mathematical formula to calculate the work and everyone agrees that they will concede to use the fingerprint with the most work condensed into it, this gives us a very efficient way for all the people in this room to agree on which fingerprint they're going to accept as the one they're going to take home as the real history of Bitcoin.
-
Thank you, i think maybe I can’t word my questions well but this was basically exactly what I wanted thanks Commented Oct 25, 2023 at 3:32