Archive for Crypto

The Double Spend FUD – Bitcoin

This past week a double-spend was reported as having occurred on the Bitcoin network. The article set off panic and contributed to a large drop in the price of the asset. I will not link the article because I don’t wish to generate traffic and thus ad revenue for the author, however, the article has been proven as FUD (fear, uncertainty, and doubt), and I’d like to explain why.

Taking Bitcoin’s use as money out of the equation for a minute. The problem the technology solves is the ability to create unique digital assets. So like a file on your computer, you can copy and paste that as many times as you like. You don’t want that for money. The word they’ve come up with is fungible. Bitcoin is non-fungible. i.e. it’s a digital asset that cannot be copied.  

The first technology behind Bitcoin is called Blockchain. Blockchain is the technology that was developed to solve this problem. A blockchain can live on a single computer, and the single computer makes sure the chain is never harmed. That’s called centralized. Or a blockchain can live on multiple computers around the world and they all work together to make sure the chain is never harmed. That’s what Bitcoin is, it’s a decentralized blockchain. These many computers around the world are called full nodes, and at last count, there were something like 10,000 of them. 

Side note —
Here’s a screenshot from https://bitnodes.io/ showing full node distribution.

Full node operators don’t get paid, they donate their computing power and electricity to ensuring the network is safe and secure. And to do this they perform a few basic tasks. I’ll touch on two here for the purpose of this article. The first task is to verify transactions. When they see a new transaction on the network they check that transaction against a set of rules. The next task is to broadcast transactions. Once they have verified a transaction as being valid they will send it out to other nodes.

The next problem getting the nodes to agree on a single chain. There can be many chains, but there can only be one real chain. And this is where the double-spend news came into play. Someone discovered two chains each with the same transaction. Concluding that the same Bitcoin was spent twice. 

The second technology behind Bitcoin is called Proof of Work, or mining. Mining is a technology that secures the blockchain. 

Let’s look at an example. Say you bought a cup of coffee using Bitcoin. –The payment terminal at the coffee shop will be a full node.– The node first checks that transaction against a set of rules to make sure it’s valid. Among the rules to check, one of them is the double-spend. It will look back at the entire blockchain history to make sure the money you’re trying to spend hasn’t already been spent. After checking the transaction against the rules and determining that it’s valid the node broadcasts the transaction to the network. A transaction that has been determined as being valid but not yet having been appending to the blockchain is called an unconfirmed transaction. 

So, miners. The miners are the ones that physically add the transaction to the blockchain. Recall, miners are basically computers trying to solve a random equation, and all the miners around the world are trying to solve the same equation. Eventually, one of them will find the answer. And for doing all that work the network lets the miner take some unconfirmed transaction, pack them up into a block, and add the block to the chain. Once done the network rewards the miner with some newly minted Bitcoin.
Note the group of unconfirmed transactions the miner chooses is up to it. When transactions are submitted to the network the sender will have paid a small transaction fee. Usually, the miner will pick transactions with the highest fees first. 

So, now that the miner has added its block to the chain, the chain has grown by one block. And that new chain is broadcast back out to the full nodes around the world. 

Consider how many miners there are out there. Probably millions of them. What are the chances that 2 miners find the answer to the equation at the same time? Small, but there is a chance. This is allowed and is taken into account. 

Say two miners find an answer at the same time, they each think they solved the equation first, so they each add a block to the chain and broadcast out that new chain. At that moment, the chain has formed a Y. A snake with 2 heads. This is fine. the system keeps working.

Now say some other guy bought a cup of coffee, now his transaction gets broadcast to the nodes and eventually makes its way to a miner. We’re back at the same problem. What are the chances that two miners find an answer to the equation at the same time? Even smaller this time but there’s still a chance. 

This could go on forever in theory, but each time this goes on the chance get smaller and smaller. The general rule of acceptance is that after 6 times the chances are more or less 0 and two miners will solve the equation at the same time. i.e. When you sell something to someone, and they’re going to pay you in Bitcoin, it’s best practice to make sure the transaction has 6 or more confirmations before you part with your goods.  

Here’s a screenshot from a Bitcoin wallet showing this:
So that Y chain we had, this is when the news story was published. Someone saw the Y and panicked.

What actually happened is the miners kept mining and the next equation that was solved was solved by only one miner, and that miner got to append its block to one side of the Y. Now we still have a Y chain, but one side is slightly longer than the other side. And this longer side is the side that the miner broadcasts out the full nodes around the world as being the correct chain. 

The smaller chain will stay attached to the blockchain forever and is called an orphaned chain. Because it’s not the longest chain it is ignored.
So ya, no double spend. Stupid article