Note: hyperchains have been renamed subnets, due to the trademark for "hyperchains" already being registered. Learn more here.
Roughly 3 months ago, we introduced you to Hyperchains, a scaling solution for Stacks that we have been building at Hiro. Hyperchains come with the promise of high throughput, low latency workloads, so you can build fast and reliable experiences for your users.
TL;DR: We are live on Testnet and on target to launch our first NFT use case on Testnet in July 2022!
Federated vs. Truly Decentralized Hyperchains
We are taking an iterative approach to building & rolling out this solution, and there eventually will be different versions of hyperchains that cater to different use cases, ranging from federated to decentralized, and all of those versions, with differing consensus protocols and functions, can exist simultaneously on top of the Stacks mainchain. A multiverse of hyperchains!
The initial version of Hyperchains will be a federated model. The reason for starting with a federated model is simple: complexity increases as hyperchains become more decentralized.
Regardless of the hyperchains design, the Stacks mainchain itself will always remain decentralized; hyperchains do not change the core protocol. You can think of hyperchains as an optional upgrade: anyone who wants to benefit from the improved performance of a particular hyperchain can choose to opt-in and experience life in the fast lane.
Regardless of the hyperchains design, the Stacks mainchain itself will always remain decentralized; hyperchains do not change the core protocol.
Learn more about subnets (formerly hyperchains) and the hard challenges of scaling a blockchain in a conversation with Hiro's Director of Engineering:
Under the Hood
Staff Software Engineer Aaron Blankstein recently put out a brilliant video primer on the inner workings of the Hyperchains contract, especially how deposits and withdrawals work through the smart contract on the Stacks mainchain, and it’s worth taking a moment to talk about some of those details here.
Each hyperchain is controlled by a single smart contract on the Stacks mainchain. Interacting with a hyperchain is exactly like interacting with a different network of the Stacks blockchain. Transaction formats, RPC interfaces, and the Clarity VM are all the same (much like the difference between interacting with testnet and mainnet).
The key difference is that hyperchains support deposits and withdrawals through this mainchain smart contract. To deposit into a hyperchain, users submit a transaction on the Stacks mainchain that invokes the deposit method on the smart contract. Similarly for withdrawals, when a user is finished interacting with a hyperchain, they submit a mainchain transaction that invokes the withdraw method on that same smart contract.
While interacting on a hyperchain, users trust the consensus algorithm of that hyperchain completely, meaning they trust the hyperchain’s miners. For example, if a given hyperchain gives miners arbitrary control over assets in that hyperchain, then the miners have complete control over those funds. Users need to be mindful of that tradeoff: they gain speed and latency but must place greater trust into the hyperchain itself. This is why we are starting with a federated trust system in the first version of hyperchains and will iterate from there.
An Overview of Mining: Protocol, Blocks, and Confirmations
The first version of hyperchains we are building will use a Byzantine fault tolerant protocol for mining. It will have a coalition of miners where each hyperchain block must be approved by a super majority of the coalition.
Through this design, users must still trust the hyperchain completely, but that trust is spread amongst a coalition of miners rather than a single entity. Miners are incentivized to operate honestly by earning transaction fees on hyperchains transactions as well as from deposits and withdrawals. It’s worth noting that Hyperchains fees will be lower than fees on the Stacks mainchain, since miners have to do less work to confirm a transaction.
Through this design, users must still trust the hyperchain completely, but that trust is spread amongst a coalition of miners rather than a single entity.
At a high level, the status of transactions will parallel that on the Stacks mainchain:
- Pending: submitted by the user, but not yet confirmed .
- In microblock: confirmed by a hyperchains miner and included in a microblock.
- Confirmed in anchor block: the transaction has been included on the Stacks anchor block.
In terms of the user experience, the main difference between the mainchain and a hyperchain is that on the hyperchain, microblocks offer high confidence in finality because of the BFT consensus mechanism in our first iteration. For users, this means they can have faster confirmation times, but they will still see the same notifications in their Hiro Wallet as they do on the mainchain today.
Of course, different hyperchains in the future may offer different methods of consensus and mining, such as offering super-fast blocks or using a Proof-of-Transfer-Light (PoXL), and the user experience will vary between hyperchains as a result. The beauty of hyperchains is that there can be many of them, and each hyperchain can have different rules to best serve the use case they are designed for. For instance, in addition to the performance gains on hyperchains, each hyperchain can define its own consensus rules in ways that can run versions of Clarity with more native functions, improved syntax, etc.
Improved Performance
One of the biggest driving factors informing our design decisions for hyperchains has been a desire for increased throughput and low latency transactions. Hyperchains addresses this in two ways:
- Because hyperchains use a closed-membership mining set and a coalition of consensus, hyperchains can use larger blocks than the Stacks mainchain, increasing throughput.
- Because hyperchains cannot fork on its own, coalition-issued microblocks always get confirmed by subsequent hyperchain anchor blocks, significantly reducing latency.
With these traits, we expect to see a 4X increase in throughput as well as a drastic reduction in confirmation times to ~1/10th of the current time.
You can think of hyperchains as an iterative scaling approach: the way to scale blockchains is to introduce more blockchains. This is at the core of Stacks’ design (the Stacks blockchain is a separate layer from Bitcoin), and we are seeing this design approach gain popularity in Ethereum as well with the rise of its L2 scaling solutions.
To establish more concrete performance metrics, come help us test hyperchains on testnet!
How Will Hyperchains Impact the Stacks Ecosystem?
As mentioned above, hyperchains will not make the Stacks ecosystem more or less centralized/decentralized. They don’t change anything about the mainchain and the protocol design. Indeed, hyperchains are an opt-in experience. Users can decide not to interact with a hyperchain at all if they don’t want to.
You can think of hyperchains as an optional upgrade: anyone who wants to benefit from the improved performance of a particular hyperchain can choose to opt-in and experience life in the fast lane.
Hyperchains offer a solution for specific applications. For example, since microblocks in hyperchains offer finality, hyperchains can be useful for NFT marketplaces. Picture a marketplace where you want to enable bidding functionality for your users. With a hyperchain, those bids would be confirmed in near real time, so you can have auction-style bidding with new offers coming in and getting confirmed with finality in close to real time.
NFT marketplaces can also benefit from hyperchains in the minting process. Popular NFT mints can create a lot of transactions in a short period of time. This can drive up transaction fees for users as they compete with each other to get their transaction confirmed in a block. Leveraging a hyperchain in this instance would help keep those fees down and avoid clogging the mainnet with the influx of transactions.
Similarly, hyperchains could be beneficial to other types of applications that may have a high volume of similar transactions, such as DEXs, video games.
Stepping back to look at the big picture, hyperchains go beyond high throughput, low latency and performance gains. They open up possibilities to innovate and build entirely new use cases on Stacks that weren’t feasible before.
Timeline to Mainnet Launch
We have already launched an MVP of hyperchains on testnet, and we are now pushing towards the launch of an NFT use case as our first case study in July 2022. This is a simulated use case, and we will be the only miner to begin with.
In August, we plan to introduce other miners and then move into the review and auditing process before launching on mainnet in Q1 2023.
If you are rather keen on giving this a spin and providing early feedback, you’re lucky: we are looking for teams interested in testing out hyperchains! If you are interested, join in on the discussion and we will reach out to you to coordinate any testing.
See you on a Hyperchain soon!