The Double-Spend That Never Was

On Thursday, January 21, 2021, news outlets began circulating reports of a Bitcoin double spend flaw which led to an 11% drop in the price of the digital asset. This would have been a major exposure of a flaw in the blockchain … except it never was. In fact, what happened or reportedly occurred would be a part of how Bitcoin is supposed to work. It is hard to explain the full details unless you get technical, but let us try to explain it in simpler terms.

First, what is a “double spend“? This was the problem Bitcoin’s creator Satoshi Nakamoto was able to solve for digital currency. Prior to that, it was a problem in computerized electronic payment systems that other developers had proposed solutions for. Since computers are digital, when currency is created it can be easily copied just like a file made in Excel or Word. If you have a file that represents your money in a computer, without any means of control a user can create infinite copies and spend it all they want. It is possible to use the same digital money to purchase two different items, so long as there is no system checking for it.

Nakamoto solves the problem by implementing a blockchain to support provenance and verification. That means that the amount of currency like Bitcoin (BTC) that a user holds, is determined by a mechanism that is verified through a consensus or agreement. In this case it is called Proof-of-Work (PoW) on the Bitcoin blockchain. You have nodes (computers) called miners that run software which run algorithms to try and solve a complex puzzle to discover a block for validation. The block contains transactions that are verified based on cryptographic hashes that can be traced back to what is called a genesis block. If it can be verified, then it is added to the blockchain.

Before a block is added, there is a competition among the miners to try and discover a number called the nonce. This is what is needed in order to validate a block. The miner who discovers it first will become the block validator and will receive a reward in return for their effort. The miners also collect fees for helping to validate transactions on the network. No transaction is ever allowed to pass unless it goes through a consensus among the miners on the network. Double-spends are prevented by the miners through this verification and validation process which also includes confirmations.

Bitmex Research first reported the incident in a tweet of a potential double-spend that occurred in the wild. They were the ones who also pointed out that it was a double-spend, but here is the problem. It was unconfirmed and the researcher who discovered it should have probably waited for what is called a chain reorganization, which is a part of the blockchain’s protocol. It is true that a BTC could appear to be spent two times on different transactions. It must undergo a series of confirmations, usually 6 but it could be more (depends on network activity). This was mentioned by Satoshi Nakamoto in the Bitcoin White Paper.

It is possible for two blocks to be mined simultaneously on the blockchain. This creates a temporary anomaly that can be observed by anyone who has access to the mempool of a Bitcoin node. There is a built-in feature in the code that corrects this problem. It is part of a chain reorganization in which the nodes must add the valid block to the longest chain, or the main network. You can see two transactions that appear to have spent the same BTC, but after the chain reorganization and block confirmation it is resolved. Only one of those blocks that contain the transaction will be valid and added to the blockchain. The other block will be orphaned and not validated.

Many cryptocurrency and blockchain experts like Andreas Antonopoulos, Bitfinex CTO Paolo Ardoino, Coin Metrics Bitcoin Network Data Analyst Lucas Nuzzi and later, even Bitmex Research all agree that it was not a double-spend that occurred. There are counter points though, especially from among the Bitcoin SV (BSV) camp who do have some thoughts of their own. What we know for sure is that only one of the transactions has been verified and validated on a block. The user tried to use a feature called Replace-By-Fee (RBF) in which you can speed up a transaction by paying a higher transaction fee which invalidates a previous transaction that was sent out. What happened here was the lower fee somehow made it to valid block first, perhaps because of the timing. The user had waited too long and by the time the higher paying transaction fee was sent the previous one had already been added to a block on the longer chain which validates it first.

Should we be worried that an actual double-spend can occur? It is always good to be alert and aware of what is happening. While the code does what it is supposed to do, there will be bad actors who may try to exploit these types of attacks to see if they can get past the logic. What will be proof or testament to Bitcoin’s legitimacy as a cryptocurrency is how these measures will stand against the test of time. As long as it is working, it will help the network to remain secure and operational. Until the next news, HODL.

Nodes, Masternodes and Supernodes

I am going to explain the purpose of nodes in the context of the blockchain and digital governance. Nodes are basically an instance of a device that participates in the consensus on a blockchain. Nodes behave according to protocols that determine the exchange of data and functions that contribute to the operations of the network. The nodes also form the digital governance within a blockchain ecosystem to enable policies and rules that serve the interest of the majority. There are three types of nodes to describe, the basic node, masternode and supernode. These are concepts that feature in Third Generation blockchains which aim to bring more efficiency to maintain its operations.

A blockchain can have its own system of government or governance. This is the concept behind digital governance, in which nodes participate in voting to elect delegates who can then become masternodes or supernodes, which we shall explain. In order for a fair system to exist, it must revolve around a token and protocol which can be built in code for a network. The token is used to count as a vote. When voting for a masternode or supernode, voters (which can be any type of node) who have more tokens that are frozen or held, have more votes that are counted. Therefore those nodes that get the most votes become masternodes or supernodes. Each blockchain has its own type of governance with consensus (e.g. EOS, Tron, NEO, Cardano).

A basic node can be any device that performs a function to help verify transactions and validate blocks. This activity is the consensus feedback mechanism algorithms that secures and validates a blockchain. Nodes can either mine (Proof-of-Work) by contributing raw computing power as their resource or they can stake (Proof-of-Stake) by holding funds which is used to provide a proof of how much validating power they own. When a node mines, they must compete with other nodes to solve a cryptographic puzzle and discover its value called the nonce. This is a compute intensive process that requires massive computations that require hash power measured in hash rate (measured in hashes per second). It expends a lot of energy since the nodes’ compute intensive task consume plenty of electricity. A more efficient method is for nodes to stake. In staking, the node will validate their power on the network by the amount of funds they hold. A node that holds the most funds has the greatest amount of validation power on the network.

Above the node, is the masternode. These are more resource intensive devices that can perform more functions than a typical node. The masternode can be assigned specific tasks that not only participates in consensus, but also involved in network operations. This can be anything from routing to simple payment verification (SPV). Although nodes can perform the same task, it will depend on the network’s protocols and policies. For example, in some networks a node only performs simple tasks like payment processing. The masternodes are then responsible for handling the verification of transactions that are then packaged into blocks for validation.

There is an even more resource intensive device above the masternode, the supernode. The supernode performs the validation of blocks. This requires more computing resources in the network since blocks can contain many transactions, and in volume this will require the most processing power on the network. Supernodes are the like the most powerful servers in the data center. You give them the most work to do and they will be able to handle it. However, in the context of a public blockchain which is trustless and permissionless, there has to be an incentive to do work. Therefore, the supernodes are incentivized by payment in the network’s native token. These are also called rewards, and they are given on many blockchains for their contribution to providing compute resources to the network. Masternodes and nodes are also incentivized for their work, so the ecosystem runs on incentives to process transactions and add them to cryptographically secured blocks.

A hierarchy exists on the network in which supernodes are at the top, followed by masternodes and nodes. While blockchains were designed to be decentralized, there are critics who point to how masternodes and supernodes make the system more centralized. The reason being the issue of scalability. When you concentrate validation of blocks only to a few nodes, it centralizes power. That is actually the purpose for Third Generation blockchains like EOS (which uses dPOS or delegated Proof-of-Stake). A blockchain by design is not inherently scalable, but secure. In order to meet scaling, it must be centralized to a certain extent in order to allow more transactions to be processed (the blockchain trilemma). When you have too many nodes trying to validate a block at the same time, it becomes inefficient when applied to an enterprise type of solution for business. By dedicating certain nodes for validating blocks, it becomes more efficient and faster when processing transactions. This does require supernodes to have a tremendous amount of resources. Becoming a supernode is thus a motivating factor in a blockchain because they collect the most rewards. In blockchains like EOS which call their supernodes as block producers, you need nodes that run in data centers that will be able to process transactions by volume. A simple PC or smartphone will obviously not be allowed to do this because it lacks the computing resources.

Supernodes must still follow the consensus mechanism. In this case, they must stake plenty of funds to prove they have the resources to become a validator. They actually first become a candidate by proving their staked funds. They are the largest holders of the blockchain’s native tokens, so there is a lot they have at stake to become a validator. They can also lose it all if they try to become a bad actor. The protocol could have a consequence which can ban the node and take their staked funds. Once voted as a supernode, that is the only time they can produce blocks on the network to add to the blockchain.

Once there are supernodes on the blockchain, they can begin producing blocks. However, supernodes do not need to compete with each other like in mining to validate a block. They are given a round each for validating blocks. On EOS, there are 21 supernodes or block producers only. Each block producer is given a round for producing 6 blocks with a time of 0.5 sec per block. If we do the math, that is 6.3 minutes per round and a total of 126 blocks produced. The consensus among all producers takes place after a block is produced. They try to maintain a 2/3 rule for validation. It means all it takes is 14 block producers to validate a block following byzantine conditions.

Supernodes have the most at stake, followed by masternodes and then basic nodes. The basic nodes do not have to stake anything if they are just accessing wallets or querying the blockchain. Nodes which do participate, may do so for incentives. Since Supernodes have the most at stake, they also have the most to lose. That is why the protocols encourage incentives so that attacks and spam on the network can be minimized. In a sense, if Supernodes collude they can control the network through a 51% attack. However, if the protocol has built in checks and balances to prevent this, the Supernodes could all be replaced and lose all their staked funds.

Separation of tasks among nodes allows a network to operate more efficiently. Less resource intensive nodes can perform the simplest tasks on the network. More resource intensive tasks require processing power. For a fair system to exist, a token is also used for incentives and digital governance. That provides rewards to nodes for their contribution and participation on the network. It also brings digital democracy to an ecosystem, allowing them to elect the nodes they want to become verifiers and validators on the network. While it is more centralized in nature, it still remains decentralized since there is a digital governance process that is open to all nodes. This limits the power of any node that attempts to control the network. Depending on the protocols and policies of a blockchain, there can be consequences to bad actors who attempt to attack or cheat the network. With this system in place, it encourages honest participation in securing and operating a blockchain.