abstract blockchain concept

What is Bitcoin's 'first seen rule'

In an earlier blog, I wrote about the double-spending problem and how Bitcoin solves it for a digital economy:

Bitcoin resolves the issue by using proof-of-work, the first seen rule of transactions and making consensus the act of nodes receiving a block as opposed to the node that found the block.

Today we talk about the first seen rule, where it’s derived from, and how it relates to the double-spending problem.

The Bitcoin white paper on the first seen rule

Section 2, Transactions, of the Bitcoin white paper states the following: 

We need a way for the payee to know that the previous owners did not sign any earlier transactions. For our purposes, the earliest transaction is the one that counts, so we don't care about later attempts to double-spend.

The incentive for following the first seen rule

The rule stipulates that nodes should share transactions as soon as they receive them. To ensure that nodes follow the practice, there’s an incentive involved: 

By sharing transactions quickly and vastly, it increases the probability of a node getting paid when they find a proof-of-work solution. 

Nodes who fail to do so might end up in a situation where they find the solution to a hash puzzle nearly simultaneously with another node, triggering an orphan race. The delay caused by last-minute validation of their block will make them lose against a node whose transactions were shared and validated by the network as they were collected into the block.

How the first seen rule prevents double-spend transactions

The first seen rule incentivises a highly connected network. As a result, it ensures that no other network participant could propagate a double-spend transaction before a node shares a received transaction with the rest of the small world node network.

In other words, all nodes (or at least the overwhelming majority of them) always have an up-to-date transaction/UTXO set. If, by some chance, there happens to be a situation where the same UTXO is being spent in two separate transactions simultaneously, and they're sent at the same time to two separate nodes, Nakamoto Consensus comes into play: the node that is better connected to a greater number of nodes has more hash power building on its block and wins the block reward.

How the first seen rule secures the network

When a valid proof of work solution is found, the block becomes a proof of existence timestamp for all of the transactions it includes whilst establishing which, of any pair of conflicting (double spending) transactions, is accepted as first-seen and valid. Nodes append transactions to a block template in an order that closely matches the chronological order in which they were received.

From the explanation above, it might seem that the determination of which of a pair of attempted-double-spend txs is 'first seen' is indeterminate until such time that one of them is mined into a valid block, and accepted by other miners voting on them by building atop that block.

It is extremely unlikely in the real-world for that to occur, as the separate transactions would have to have the solution to the unlocking script for the same UTXO, and send the TXs simultaneously. 

Attempted double-spending of own funds

In other words, it would have to an individual sending separate transactions spending the same funds to different nodes. 

This again is almost impossible because of how the network forms; i.e. its small world nature means there will likely never be more than a dozen or so nodes on the network, and they'll be geographically dispersed. The latency because of the geographic distance between the nodes themselves would very likely provide enough time for the first seen rule to allow the majority of network nodes to accept one transaction and discard the second.

Attempted double-spending of someone else’s funds

The other, even more unlikely scenario, would be a nefarious actor has the key to unlock the UTXO and spends a TX at exactly the same time as the legitimate owner of the funds, from the other side of the world. 

While it is theoretically possible, it is so unlikely that it's safe to assume it will never happen.

Attempt to bring down the Bitcoin network

It’s sometimes suggested that nefarious nodes could attack the network’s credibility by accepting double-spends. 

In the first place, Bitcoin’s incentive scheme makes it more profitable to mine according to the rules than to expend all your hash power to bring down the network.

And yet, even if a nefarious node puts this plan in motion, it's easy for honest nodes to detect and block them. Because the chain is traceable, these actors could also be criminally charged.

Not following the first seen rule guarantees you a loss

If you want to not follow the first seen rule and spend the money to put forth a block that uses a second spend of a UTXO as the valid one, unless you have 51% of the network’s hash you're pretty much guaranteed to have any block you propose rejected. The rest of the network will deem the second spend of the UTXO invalid and therefore your proposed block too.

Bitcoin’s economic model

Keep in mind that the rule isn't a technical solution, or at least a fully technical solution. You could rather say that it's an economic one predicated on the game theory of the network: a multi-leader, multi-follower Stackleberg game. 

In the original Bitcoin protocol, nodes are defined as participants that enforce network consensus rules, validate transactions and add blocks to the chain. 

There is also only one consensus mechanism in Bitcoin: Nakamoto Consensus. Nakamoto consensus is simply the act of blocks being accepted by the majority of honest nodes. This implies transactions are valid, and there are no double spends because of how the network emerges. 

Nakamoto Consensus, in concert with proof-of-work and the first-seen-rule, naturally form a the small-world network topology because nodes only get paid by being honest and having all the other nodes on the network accept their blocks. 

The by-product of this is that the investment required to become a node is very high (hundreds of millions of dollars at this point), so nodes are even more incentivised to act honestly. At this level of investment, not only are they a corporation with fiduciary responsibilities, but they also have to be in good standing with the other nodes to have their blocks accepted.

An introduction to Bitcoin infrastructure

If the topic of Bitcoin mining and infrastructure is within your professional purview, you’re sure to benefit from the BSV Academy’s introduction to Bitcoin Infrastructure course.

The introduction to Bitcoin Infrastructure course is focused on providing students with a solid understanding of the role that nodes and node operators play in the construction of the network. In particular it will focus on the incentives that drive enterprise operators to spend large sums of money to build and operate their infrastructure.

To sign up for this free course, head over here.

Brendan Lee
Brendan Lee

Training and Development Manager - Bitcoin Association