Skip to content

stacks-network/stacks

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

Stacks: A Bitcoin Layer for Smart Contracts

Stacks is a Bitcoin layer for smart contracts. The Stacks layer enables smart contracts and decentralized apps for Bitcoin.

>> Read the Stacks whitepaper.
>> See the Stacks overview slides.

Why Bitcoin? Bitcoin is the most durable and secure blockchain. Bitcoin is minimal by design and is meant to not change. Stacks layer extends the design of Bitcoin to enable smart contracts and apps without modifying Bitcoin and with minimal transaction load on Bitcoin. Thousands of transactions at the Stacks layer result in a single hash at the Bitcoin blockchain, and Stacks microblocks offer fast confirmations of streaming transactions. Bitcoin is used as a settlement layer and ultra-fast transactions are enabled as scalable hyperchains, amongst other scalability solutions (like appchains).

Bitcoin's Stacks layer makes BTC productive; BTC can be deployed into DeFi applications, NFT marketplaces etc. For example, see native BTC swaps, and Lightning swaps to stablecoins and NFTs. You can see some applications built using Stacks here.

Stacks asset (STX) is used for mining incentives (block subsidy for miners) of the Stacks layer. These miners secure the global ledger of the Stacks layer. This data cannot be stored at the Bitcoin main chain and needs to be stored outside Bitcoin. STX is also used as gas for smart contract execution. STX is a unique crypto asset that can be locked by STX holders to earn Bitcoin rewards from the protocol. More details on earning Bitcoin rewards are at stacking.club.

STX was distributed to the general public through the first-ever SEC qualified token offering in US history. The project decentralized before the mainnet launch in Jan 2021. There are 50+ independent companies that work in the ecosystem.

Clarity Language for Smart Contracts

Clarity is a new language for smart contracts that focuses on safety. Clarity is a decidable language, meaning you can know, with certainty, from the code itself what the program will do. Clarity is interpreted (not compiled) and the source code is published on the blockchain (see this deployed code for the PoX contract).

For details, see the Clarity book and Clarity website.

Proof-of-Transfer (PoX)

PoX consensus is a new algorithm that spans consensus between the Bitcoin blockchain and the Stacks layer. Unlike burning electricity in proof-of-work, miners bid by spending BTC and get a random probability for becoming a leader. Leader election happens on Bitcoin and new blocks are written on the Stacks layer. Miners use BTC to mine newly minted STX. PoX recyles proof-of-work energy to provide Nakamoto-style consensus for the Stacks layer.

See this post on PoX for more details.

Stacks layer

Stacks is a programming layer for Bitcoin. The Stacks layer connects to Bitcoin using PoX and enables smart contracts for Bitcoin. Smart contracts on the Stacks layer can read and react to BTC transactions and developers can build cross-chain apps between Bitcoin and the Stacks layer. With PoX there is no need to modify Bitcoin to enable smart contracts around it. There are two types of participants on Stacks (a) STX miners, and (b) STX holders.

STX miners can view state on both the Bitcoin blockchain and the Stacks layer. STX miners participate in leader election by sending transactions on the Bitcoin blockchain, a Verifiable Random Function (VRF) randomly selects leader of each round, and the leader writes the new block on the Stacks chain. STX miners get newly minted STX (coinbase rewards), transaction fees, and Clarity contract execution fees of each block. STX miners express the cost of mining in BTC and spend BTC to participate in leader election.

STX holders can participate in the PoX contract by locking their STX for a cycle, running a full node, and sending useful information on the network as transactions. STX holders who actively participate in the PoX contract can earn Bitcoin rewards. Unlike proof of stake, there is no risk of slashing for STX holders. See the STX earning model for potential earning rate and stacking.club for details.

Some resources for further details:

Code

Check out the latest docs for the easiest way to get started!

If you're just starting with Stacks, here are the main software repositories you should checkout:

How to Help

  • Contribute open-source code - send us pull requests with improvements! See some good first issues.
  • Help with software testing - we encourage the community to run the software and file issues.
  • Become a community evangelist - join community leaders around the world supporting our mission.
  • Weekly Stacks meetings on Discord.

Resources