15 year bitcoin charts
14 commentsYottabyte dogecoin minerva
Now, this is a fair question. If you know anything about the blockchain architecture, you instinctively conclude that "no", it's quite improbable that anyone will break it. In practice, it's basically impossible. It's quite amazing that most of my peer programmers have a very difficult time overcoming the prejudice against cryptocurrencies.
I have no idea where this prejudice comes from, but I know very smart people that can solve the most difficult web scalability problems, but that never once glanced over Satoshi Nakamoto extremely short original paper describing the blockchain.
A Peer-to-Peer Electronic Cash System paper is so ridiculously small and easy to understand that most computer science students should be able to understand it. So all the smart programmers I know should be able to grasp it in a coffee break. Any average programmer should be able to read and understand this paper in 30 minutes or so. You can simplify a mental model of it as a Linked List, each node of the List is what we call a Block.
The catch is that each block has the hash signature of the previous block, thus creating a secure "chain". Yes, in computer science terms, we're dealing with undergraduate levels of data structures here. If you understand a Linked List and a stupid Binary Tree, plus the easiest crypto thing to understand, a stupid Digest Hash such as SHA, and boom, you understand the basic backbone of the blockchain database.
Yes, it is just a database. A distributed-database to be more exact. Or a very crude and simple distributed database for that matter. It is not very efficient, and it pales in comparison to more serious NoSQL distributed databases such as Redis or Cassandra. So the query-abilities are basically non-existent beyond finding a block by its identity.
Of course, the Bitcoin source-code is more sophisticated than that but the basics are really so ridiculous that you don't need more than 20 lines of Ruby code to replicate it. Check out this example implementation from Gerald Bauer. Now, either you need to have a centralized "master-copy" out of which all other copies replicate from. Or you need some form of "consensus" between the different copies.
How do you reach consensus between rogue, random node spread across the globe? In a nutshell, imagine that you have Byzantine generals, each with their own armies, surrounding a hostile city. Now, you can either attack or retreat. But all generals must either do one or the other, in consensus.
How do you reach consensus when you don't have direct communication with all the generals and, worse, when some of the generals may be traitors or double-agents? That's the kind of problem we face here. Anyone on the internet can download a copy of the blockchain, and they can check that the blocks are valid and unadulterated by recomputing the digest hashes for each block. That's why Satoshi added the so-called "Proof of Work" to the equation.
Remember that I said that each block is chained together to the previous by containing the hash of the previous block? Computing a digest hash is quite trivial these days. Now, what if I ask you to find the hash that starts with a certain amount of "zeroes" in the beginning of the hash? How do I know that I had to prepend ""?
I don't, I have to start from 0 and incrementing one by one until I find the hash with the format I want. If we check from Gerald' example we would implement this lookup like this:.
Just a simple SHA takes somewhere between 0. Now how long does it take to find that "" which we call a "nonce"? Yep, considerably more, now it takes 0. We can increase the "difficult" variable to make it even more laborious to find the nonce. And that's exactly how Bitcoin is implemented: What a miner does is compute a loop, incrementing nonces, over the block digest to find the correct nonce.
Once a nonce is found, the miner can add the block to the blockchain and broadcast it to other nodes. The other nodes can then double-check and now it's just the 0. When the nodes double-check and confirm the nonce, they all add the block to the top of the blockchain. And usually, when the other miners keep adding other blocks on top of that, that block becomes "solidified". The most recent block on the top of the blockchain is usually unstable, but once you have more blocks on top of it, it is said to be more "guaranteed".
Which is why most exchanges and other services that accept bitcoin wait for the so-called "6 blocks" confirmation. And because the difficulty is such that the fastest node takes around "10 minutes" to find that nonce, a block is said to be "secure" when around 1-hour passes and 6 blocks are added after it.
Mining is the act of signing and confirming blocks to the blockchain. It's a maintenance service, which is why you reward miners with "transaction fees" and a couple of "satoshis" fractions of 1 Bitcoin , for their work. And also why you call this "Proof of Work" because when someone finds a nonce, we know it had to go through a lot of hash computation to reach it.
You need to have an absurd capacity to be able to mine Bitcoins nowadays. No one will use a home-built rig to do it.
One must build special hardware, such as the famous AntMiners. Each crypto-currency different from Bitcoin calculates hashes differently so the hashrate differs from coin to coin. The current Hash Power of the entire Bitcoin consensus network is almost reaching 14 EH exa-hashes or millions of tera-hashes. So, let's say that I am a billionaire and I want to troll the Bitcoin community by adding enough hash power to surpass the entire hash power of the network.
And this is without adding the energy required to boot and run those machines, of course. But even then, do you know what happens?
Remember that difficult variable I mentioned above? It will adjust again, to make sure the next block takes 10 minutes to compute again! Then, no, even if you're willing to put USD 1. And that's how Bitcoin deals with Byzantine generals in this consensus network. But how do you add new blocks and make the other nodes accept your new block? In Ruby if you do: If we check from Gerald' example we would implement this lookup like this: Can we break this?
Now, you will understand why we talk about "hash power" when we talk about mining. I want to find 4 zeros "" in the hash: