How Stacks 2.0 Builds dApps and Smart Contracts on Bitcoin

Stacks 2.0 is a Layer 1 blockchain that addresses the scalability and utility issue of the Bitcoin network. It helps in designing dApps and smart contracts indirectly on the Bitcoin network. And to achieve this, it uses a unique consensus method called PoX that will connect two blockchains. The Bitcoin layer will act as a finality layer whereas the smart contract will be built on the Stacks chain. The leader election happens on the base Bitcoin chain, and new blocks are written on the connected Stacks chain.

The Stacks 2.0 network is coupled with the Bitcoin network. It depends upon the Bitcoin blockchain for transaction finality and security. And thus, the Stack network matches the block mining and transaction confirmation time with the block time of the Bitcoin blockchain (10 minutes).

The platform uses the Clarity language to design dApps and smart contracts. Clarity is a secure and predictable language for smart contracts with no compiler.

Stacks 2.0 Design Elements

We have already mentioned that the Stacks 2.0 blockchain supports decentralized apps and smart contracts and is dependent on the Bitcoin network for security and finality. It implements PoX mining. We will explore what is PoX consensus and mining in detail.

PoX Consensus

PoX is a consensus algorithm that works on a principle where it uses the proof-of-work cryptocurrency of an established blockchain to secure a new blockchain.

It is the first consensus algorithm between two blockchains. Stacks uses this consensus method where Bitcoin acts as the base chain and Stacks as a connected chain.

In PoX, the STX miners participate in leader elections for each round. The leader election takes place on the Bitcoin blockchain. The protocol selects the leader by using a verifiable random function (VRF) who writes the new block of the Stacks blockchain along with minting the rewards.

The basic concept of the algorithm is that miners transfer the amount of Bitcoin used for bidding purposes to specific network participants who are actively participating in the consensus algorithm. It is an improved version of PoB as opposed to proof-of-burn that burns the base cryptocurrency. In PoX, the Bitcoin consumed in the mining process goes to the Stacks holders in the form of rewards. The rewards are distributed based upon their holdings of STX in the Stacking algorithm. And the PoX miner receives the newly-minted Stacks (STX) tokens.

PoX Participants

The PoX consensus mechanism consists of two types of participants:

  • STX miners
  • STX holders
STX Miners

STX miners can view state on both the Bitcoin blockchain and the Stacks blockchain. They participate in leader elections for each round. They spend Bitcoin by sending transactions on the Bitcoin network. A Verifiable Random Function (VRF) randomly selects the leader of each round. The newly elected leader writes the new block on the Stacks chain.

As a reward, the STX miners get newly-minted transaction fees and Clarity contract execution fees of each block in STX.

STX Holders

STX holders are normal users who participate in the consensus by locking their STX token in the stacking contract, run or support a full node, and send useful information on the network as STX transactions.

As a reward, the holders earn BTC  for a reward cycle that runs for approximately two weeks.

Important: The general reward duration is 2 weeks with a target block time of the network (10 minutes). But sometimes this duration can be higher due to the Bitcoin network confirmation time variances.

PoX Mining

So what is PoX mining and how does an STX holder earns BTC?

PoX mining is the improved version of PoB, i.e., Proof-of-Burn where rather than burning the amount of Bitcoin sent to the network, it is distributed to the STX holders who take part in stacking and help in the smooth functioning of the network.

A PoX miner transfers Bitcoin to eligible owners of Stacks (STX) tokens, and in return, they receive the newly minted Stacks (STX) tokens

Miners who participate in the PoX mechanism run software (mining client, aka “miner”) on their system. The mining client implements the PoX mechanism, which ensures proper handling and incentives through four key phases:

  • Registration – Miners register themselves for the incoming election by sending consensus data to the network.
  • Commitment – To participate in the election, the registered miners transfer Bitcoin to the eligible Stacks (STX) tokens holders proportional to the amount of their staked token.
  • Election – A verifiable random function randomly chooses one miner as a leader to write a new block on the Stacks blockchain.
  • Assembly – The leader writes the new block and, in return, receives newly-minted Stacks (STX) tokens as a reward.
Mining Reward

A PoX miner receives newly-minted Stacks (STX) tokens as a reward when they transfer Bitcoin to the eligible owners of Stacks (STX) tokens.

The reward amounts are:

  • First 4 years,1000 STX per block are released for mining.
  • Next 4 years, 500 STX per block are released.
  • Next 4 years, 250 STX per block are released.
  • For the rest of the period, 125 STX per block will be released.

The miner rewards which comprise of block rewards and transaction fees take 100 blocks on the Bitcoin blockchain to mature. After the successful mining of a block, your rewards will appear in the Stacks account after ~24 hours.

Clarity Smart Contracts

Clarity is a new programming language that is used to design dApps and smart contracts. Stacks uses Clarity to build smart contracts.

The Clarity code is predictable, i.e., developers can predict what the program will do, how much data it will use, and what will be the cost. Solidity (used on Ethereum for designing smart contracts), on the other, is undecidable, which means you cannot predict the outcome without actually executing the contract code in a particular condition.

The Clarity language doesn’t get compiled. The contract source code gets published and executed directly on the blockchain nodes. Clarity contracts have visibility into the Bitcoin state, meaning that contract logic can be triggered based on pure Bitcoin transactions.

Stacks (STX Cryptocurrency)

STX is the native token of the platform. The token has multiple utilities, like it can be used to register digital assets, transaction fees, staking, and to publish Clarity contracts on the blockchain.

Conclusion

Stacks 2.0 is an innovative project that aims to enhance the utility of the Bitcoin network by designing dApps and smart contracts on top of the connected Stacks network. This will definitely make BTC more valuable rather than holding it as a precious asset like gold. The Stack platform also allows the users a passive way of earning Bitcoin by locking up the STX tokens in the stacking pool for a period of two weeks. But as we all know that the Bitcoin network itself does not support any dApps or smart contracts, it will be very interesting to see whether these applications will be able to compete with dApps designed on the Ethereum or Polkadot network.

Join us on Telegram to receive free trading signals.

For more cryptocurrency news, check out the Altcoin Buzz YouTube channel.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.