Subnets are a layer-2 scaling solution in the Stacks blockchain that offers low latency and high throughput workloads. It enables developers to build fast and reliable experiences on Stacks.
Subnets are designed to transact on Stacks assets, meaning users can move assets in and out of subnets. While a user’s assets are in a subnet, they trust that subnet’s consensus rules. This subnet will interact with the Stacks chain using a smart contract specific to that subnet.
NOTE:
The current implementation of subnets uses a 2-phase commit protocol amongst a fully-trusted pool of miners.
Below are some of the features of subnets:
This diagram outlines the interaction between a subnet and the Stacks layer-1 chain.
When a miner proposes a block to the other miners, the other miners must approve and sign the block before it can be committed to the subnet.
The current implementation of subnets uses a federated system of miners. This federation is fully-trusted, but future work on subnets will explore alternative trust models.
In a fully - trusted model:
You can build subnets using any of the following methods:
NOTE:
Hyperchains have been renamed "subnets" due to the trademark for "hyperchains" already being registered. Learn more here.
You can start building with Clarinet using the instructions noted here. You can run through all the six steps indicated in the Setup section of the NFT_USE_CASE.md document to finish the deposit and withdrawal of NFT.
You can set up configurations for subnet miners on testnet using the instructions noted here.
You can launch your contracts, deposit funds to your subnets layer and withdraw funds using the instructions noted here.
In your terminal, you can run tests by navigating to the testnet/stacks-node/
directory and running the following command:
cargo test
If you want to ignore some tests, you can use the following command:
cargo test -- --ignored --num-threads=1