Touring Sonic — What is Time to Finality?
The Sonic testnet phase is currently in full swing, with many people engaging with the open testnet to experience its incredible performance. As part of that, many technical terms are being thrown around for evaluating the network and its transactions. Our Touring Sonic series will shed light on some of these key terms.
In this article, we’ll explain the meaning of time to finality.
What is time to finality?
Finality is the point at which a transaction on a blockchain becomes irreversible and permanently recorded. But before we dive in further, it’s important to have a basic understanding of how a blockchain works.
At its core, a blockchain is simply a database that contains transactions. When a transaction is submitted to a blockchain, it’s not added directly to it. Rather, it’s bundled into a “block” alongside other transactions, which is then incorporated into the database. As such, a blockchain is a sequential chain of blocks that contain transactions, hence its name.
Most importantly, a blockchain is decentralized, which means it doesn’t run on a single server. Instead, the blockchain exists simultaneously on a massive amount of computers around the world that run software to communicate with each other and agree on the content of the database. (On Fantom, these computers are called validators.)
It’s these computers that bundle transactions into blocks and add them to the blockchain at frequent intervals. Every ~10 minutes for Bitcoin, every ~12 seconds for Ethereum, and every ~0.4 seconds for the Sonic closed testnet.
However, once a block is added to the blockchain, it doesn’t mean the transactions contained within are instantly final and permanent. In the majority of blockchains, a single computer is usually picked to create the next block and add it to the blockchain. Other computers in the system then receive this block and validate the transactions within it to make sure they’re valid.
But due to the design of most blockchains, there can be occasions when two computers are simultaneously chosen to create a block. In such a scenario, how does the rest of the system know which block to follow? Well, they must wait until the next computer is chosen to create the next block, and the previous block used by this computer is accepted as the legitimate one, while the alternative block is disregarded.
This is called the longest chain rule as every computer in the system follows the version of the blockchain with the most blocks, which naturally would be the version on the most recent computer chosen to create a block. Both Bitcoin and Ethereum implement this mechanism.
After a computer is selected to create the next block, bringing the blockchain back on track, we still have to wait for several more blocks to be created. Due to potential communication delays between the computers in the system, it’s technically possible for some of them to still have the old invalid block in their version of the blockchain.
After a certain amount of blocks have been created, this is no longer a risk as we can assume those outdated computers have undergone chain reorganization to change their database to the current and correct one. Only then can we consider the transactions in the initial block as final and irreversible.
And now we’re ready to define time to finality, which simply means how long it takes for a transaction to be considered irreversible after it’s submitted. On Bitcoin, it takes around an hour (6 blocks created). On Ethereum, it takes around two minutes (12 blocks created). On the Sonic testnet, it takes around a second.
That’s because the design of Fantom allows for a block and its transactions to be considered final and irreversible the moment it’s added to the blockchain, which takes around 0.4 seconds. The longest chain rule and chain reorganizations do not exist on Fantom. Once a transaction has been added to the blockchain, it’s instantly final.
There are a few things that work in conjunction to make this possible. On Fantom, no single computer is chosen to create the next block. Instead, the block is added to the blockchain once the majority of the computers in the system have received it. As such, there can never be a situation on Fantom in which the computers disagree on the state of the database. If you’re curious to learn more about the technical details behind Fantom’s architecture, read our approachable article on the topic.
Time to finality is important for several reasons:
- Security: The longer it takes for a transaction to reach finality, the greater the risk of something going wrong, like a double spend (where someone tries to spend the same digital asset twice)
- Efficiency: For businesses and users, knowing how long a transaction will take to be finalized is crucial for planning and operations
- User experience: Shorter time to finality leads to a better user experience, as users don't have to wait long to be sure their transaction is irreversible
Frequently asked questions
The launch of Sonic comprises three main components that scale Fantom to new heights:
● A new virtual machine, the Fantom Virtual Machine (FVM), which increases our transaction throughput significantly while maintaining ultra-short finality.
● A new database storage, Carmen, which reduces storage requirements by up to 90%, providing greater cost efficiency for validators and accelerating the Foundation’s ability to deploy archive nodes from weeks to approximately 36 hours.
● An optimized Lachesis consensus mechanism, which brings a vastly improved transaction pool.
Fantom Sonic is in its testnet stage at the moment and will roll out as a mainnet to replace Fantom Opera in spring 2024. Currently, Sonic offers two different testnets: the closed testnet aims to showcase the maximum theoretical limits of Sonic, whereas the open testnet is interactive, allowing any user to experience Sonic directly.
Most importantly, this new virtual machine allows Fantom validators to execute smart contracts more efficiently.
The closed testnet is viewable only and aims to showcase the maximum theoretical limits of Sonic, whereas the open testnet is interactive, allowing any user to experience Sonic directly.
However, there may be even more significant performance gains with further testing that may require a hard fork in the future, but the current plan is not to hard fork Fantom Opera.