From a5747926af6795d8ddf3a158e70b6911c5d6ca62 Mon Sep 17 00:00:00 2001 From: paps Date: Sat, 13 Dec 2025 15:33:07 +0100 Subject: [PATCH] docs: improve readability and fix typos in documentation - Fixed typos in various docs files - Simplified complex sentences for better clarity - Improved grammar and flow in documentation - Enhanced readability without changing technical accuracy --- docs/build/README.md | 26 ++--- .../build/get-started/developer-quickstart.md | 97 +++++++++++-------- docs/contribute/README.md | 6 +- docs/learn/README.md | 24 +++-- docs/learn/stacks-101/bitcoin-connection.md | 74 +++++++------- docs/learn/stacks-101/proof-of-transfer.md | 28 +++--- docs/learn/stacks-101/what-is-stacks.md | 36 +++---- 7 files changed, 159 insertions(+), 132 deletions(-) diff --git a/docs/build/README.md b/docs/build/README.md index 4c1097fbf4..cc0753edf0 100644 --- a/docs/build/README.md +++ b/docs/build/README.md @@ -10,10 +10,10 @@ description: Build powerful apps, secured by Bitcoin. New to building with Stacks? Check out these weekly virtual meets! -* **Stacks DevRel office hours**: Follow and enable notifications for [@StacksDevs](https://x.com/StacksDevs) on Twitter to catch alerts for our weekly livestreams every Thursday at 10am EST. Office Hours are the easiest way to stay in the loop on product drops, live demos, community builder spotlights, and more. Stay up-to-date with release discussions, real-time walkthroughs, and builder highlights that matter. -* **Clarity Working Group**: An open, developer-focused initiative dedicated to supporting builders across the Stacks ecosystem. The group brings together experienced Clarity engineers (“Clarity giga chads”), auditors, educators, grant project teams, and new developers to collaborate, learn, and advance smart contract development on Bitcoin. Check out the calendar [link](https://www.addevent.com/event/yc0x95fky8y4) to join every other Tuesday. -* **AI BTC Working Group:** Join the **AI BTC Working Group**'s (WG) weekly meeting on AIBTC's twitter account, where they delve into the exciting intersection of AI and Bitcoin. Check out the calendar [link](https://www.addevent.com/event/c3qjy462xr82) to join every Thursday. -* **Runes Capsule Webinars:** Join a weekly deep-dive into Runes Capsule architecture, Bitcoin bridging, and trust minimized design patterns on Stacks. Check out this [link](https://calendar.google.com/calendar/u/0/r?cid=b247d75eb1a11dc3ebbf0c62eb4a1c83b4a53d4d2f903eaa19d685f28f087f92%40group.calendar.google.com) to join every Sundays. +- **Stacks DevRel office hours**: Follow [@StacksDevs](https://x.com/StacksDevs) on Twitter for weekly livestreams every Thursday at 10am EST. Office Hours keep you updated on product drops, demos, builder spotlights, and more. Get release discussions, walkthroughs, and highlights. +- **Clarity Working Group**: An open initiative supporting Stacks builders. It unites experienced engineers, auditors, educators, and new developers to collaborate and advance Clarity development on Bitcoin. Join every other Tuesday via [calendar](https://www.addevent.com/event/yc0x95fky8y4). +- **AI BTC Working Group:** Join the AI BTC Working Group's weekly meeting on AIBTC's Twitter, exploring AI and Bitcoin. Join every Thursday via [calendar](https://www.addevent.com/event/c3qjy462xr82). +- **Runes Capsule Webinars:** Weekly deep-dive into Runes Capsule architecture, Bitcoin bridging, and trust-minimized patterns on Stacks. Join every Sunday via [calendar](https://calendar.google.com/calendar/u/0/r?cid=b247d75eb1a11dc3ebbf0c62eb4a1c83b4a53d4d2f903eaa19d685f28f087f92%40group.calendar.google.com). @@ -25,17 +25,17 @@ Stacks ranks #5 among all crypto ecosystems for new developers in 2025! \[source Stacks is a fast, low-cost, builder-friendly layer 2 network on Bitcoin. It’s built on Bitcoin, inheriting Bitcoin’s battle-tested security. By jumping into our docs, you’re joining the Stacks builder community that’s bringing a global onchain economy to Bitcoin. -If you're here on this page, hopefully you've already gotten a good sense of _what_ Stacks' purpose is, if not, head to the [Learn](https://app.gitbook.com/o/hoh4mQXTl8NvI3cETroY/s/H74xqoobupBWwBsVMJhK/) section. Or if you're still on the edge of _why_ you should build with Stacks, head to [Why Build with Stacks](get-started/introduction/why-build-with-stacks.md). +If you don't know Stacks' purpose, check the [Learn](https://app.gitbook.com/o/hoh4mQXTl8NvI3cETroY/s/H74xqoobupBWwBsVMJhK/) section. For why to build with Stacks, see [Why Build with Stacks](get-started/introduction/why-build-with-stacks.md). -*** +--- ### Pick your learning path -We all have different styles of learning. If you've already got a good concept of web3 fundamentals and want to get a quick taste of what the DevEx is like on Stacks, then check out the [Developer Quickstart](get-started/developer-quickstart.md). Or find the path that clicks for you — and if bandwidth allows, tackle them all! +Learning styles vary. If you know web3 basics and want a quick DevEx taste, try [Developer Quickstart](get-started/developer-quickstart.md). Find your path—and tackle all if possible!
Try the Developer Quickstartdeveloper-quickstart.md
Start Learning Clarityclarity-crash-course.md
Bitcoin Primer TutorialBitcoin Primer
Earn a Stacks Developer Degreehttps://learnweb3.io/degrees/stacks-developer-degree/
Watch Our Hands-On Videoshttps://www.youtube.com/@stacks-developers
Clarity Development Using ClarinetBroken link
-*** +--- ### Who should use what @@ -48,12 +48,12 @@ We all have different styles of learning. If you've already got a good concept o | Launching a token | [Create Tokens](get-started/create-a-token/) | | Interested in security / auditing | [Stacks Bug Bounties](https://immunefi.com/bug-bounty/stacks/information/) | -*** +--- ### Still got questions? -We know, it's a lot. But we, along with our large community, are always more than welcome to help you throughout your journey with Stacks. +It's a lot, but our community is here to help with your Stacks journey. -* [**Stacks Discord**](https://discord.gg/stacks): Connect with other developers and our team -* [**Stacks Forum**](https://forum.stacks.org/): Ask questions and share projects -* [**Stacks Twitter**](https://x.com/StacksDevs)**:** Follow us on Twitter and ask us questions there +- [**Stacks Discord**](https://discord.gg/stacks): Connect with other developers and our team +- [**Stacks Forum**](https://forum.stacks.org/): Ask questions and share projects +- [**Stacks Twitter**](https://x.com/StacksDevs)**:** Follow us on Twitter and ask us questions there diff --git a/docs/build/get-started/developer-quickstart.md b/docs/build/get-started/developer-quickstart.md index 51092eac5d..aaa6d47d69 100644 --- a/docs/build/get-started/developer-quickstart.md +++ b/docs/build/get-started/developer-quickstart.md @@ -7,16 +7,16 @@ description: Your 0→1 guide for building a Clarity contract and app on Stacks.
**Welcome to the Stacks Developer Quickstart Guide!**\ -This is your fast-track path for understanding what you'll need to become a Stacks developer. In this guide, you’ll build a real Clarity smart contract, wire up a functioning Stacks app, and pick up about 75% of the practical knowledge every Stacks builder needs. Whether you’re shipping your first project or leveling up your skills, this guide takes you from zero to deployed—quickly and confidently. +This guide helps you become a Stacks developer quickly. You'll build a real Clarity smart contract, create a working Stacks app, and learn about 75% of the practical knowledge needed. From zero to deployed—fast and confidently. ### What you'll achieve By the end of this quickstart, you’ll have built an onchain app by: -* Building a Clarity smart contract with Clarinet -* Utilize the 1:1 Bitcoin backed token, sBTC -* Deploying your smart contract to Stacks' testnet -* Interacting with your deployed contract from a frontend app +- Building a Clarity smart contract with Clarinet +- Utilize the 1:1 Bitcoin backed token, sBTC +- Deploying your smart contract to Stacks' testnet +- Interacting with your deployed contract from a frontend app {% hint style="success" %} **Why Stacks?** @@ -26,19 +26,19 @@ Stacks is a fast, low-cost, builder-friendly layer 2 network on Bitcoin. It’s ### What You'll Build -The app you'll build will be a message board contract. Users can add a new message to store on-chain for a fee of 1 satoshi in sBTC. Other functionality to read data from the contract will also be handled. Besides sBTC, there will be other things that'll be introduced to you such as post-conditions, Bitcoin read access, unit testing, wallet connectivity, BNS, Hiro, and more. Hopefully all this will give you a good flavor of what you can expect in the Stacks builder ecosystem. +You'll build a message board contract. Users add messages on-chain for 1 satoshi in sBTC. It includes read functions. You'll learn about sBTC, post-conditions, Bitcoin read access, unit testing, wallet connectivity, BNS, Hiro, and more. This gives a good taste of the Stacks ecosystem. -Let's start building on Bitcoin! :orange\_square: +Let's start building on Bitcoin! :orange_square: {% hint style="info" %} **Prerequisites** -* Basic familiarity with web development -* Basic familiarity with web3 concepts -* A modern web browser -* Node.js -* Visual Studio Code or any other popular IDE -{% endhint %} +- Basic familiarity with web development +- Basic familiarity with web3 concepts +- A modern web browser +- Node.js +- Visual Studio Code or any other popular IDE + {% endhint %} ### Set Up Your Developer Environment @@ -52,33 +52,41 @@ Below are a few different ways to install Clarinet on your machine using your te {% tabs %} {% tab title="Homebrew" %} + ```bash brew install clarinet ``` + {% endtab %} {% tab title="Winget" %} + ```bash winget install clarinet ``` + {% endtab %} {% tab title="Source" %} + ```bash sudo apt install build-essential pkg-config libssl-dev git clone https://github.com/stx-labs/clarinet cd clarinet cargo clarinet-install ``` + {% endtab %} {% tab title="Binary" %} + ```bash wget -nv https://github.com/stx-labs/clarinet/releases/latest/download/clarinet-linux-x64-glibc.tar.gz -O clarinet-linux-x64.tar.gz tar -xf clarinet-linux-x64.tar.gz chmod +x ./clarinet mv ./clarinet /usr/local/bin ``` + {% endtab %} {% endtabs %} {% endstep %} @@ -119,14 +127,17 @@ There are many Stacks supported wallets in the market. For this guide, we'll be Let's start by creating a new Clarinet project which will house our smart contract. The `clarinet new` command sets up everything you need for smart contract development, including a testing framework, deployment configurations, and a local development environment. {% code title="terminal" %} + ``` clarinet new my-stacks-contracts ``` + {% endcode %} A Clarinet project will be scaffolded with the below: {% code title="terminal" expandable="true" %} + ``` Created directory my-stacks-contracts Created directory contracts @@ -159,6 +170,7 @@ Once you are ready to write your contracts, run the following commands: $ clarinet check Check contract syntax for all files in ./contracts. ``` + {% endcode %} {% endstep %} @@ -189,8 +201,8 @@ Open `contracts/message-board.clar` and remove its existing content. This is whe Let's first define some constants: -* contract owner to establish control access -* custom error codes to handle errors in functions +- contract owner to establish control access +- custom error codes to handle errors in functions
;; Simple Message Board Contract
 ;; This contract allows users to read and post messages for a fee in sBTC.
@@ -212,8 +224,8 @@ You'll notice in the `CONTRACT_OWNER` constant that `tx-sender` is set in place
 
 We'll then need to define some data storage:
 
-* A map to store key-value pairs of the message id and it's related metadata
-* A data variable to count the total number of messages added
+- A map to store key-value pairs of the message id and it's related metadata
+- A data variable to count the total number of messages added
 
 
;; Define a map to store messages
 ;; Each message has an ID, content, author, and Bitcoin block height timestamp
@@ -229,6 +241,7 @@ We'll then need to define some data storage:
 ;; Counter for total messages
 (define-data-var message-count uint u0)
 
+ {% endstep %} {% step %} @@ -286,8 +299,8 @@ There's quite a lot going on in this function above that covers in-contract post By using the `define-public` function, we can literally create a public function where anyone can invoke. -* `(add-message ... )` : the custom name of the public function -* `(content (string-utf8 280))` : the custom paramater name and type +- `(add-message ... )` : the custom name of the public function +- `(content (string-utf8 280))` : the custom parameter name and type @@ -339,7 +352,7 @@ The `restrict-assets?` acts as an in-contract post-condition to protect user and }) ``` -The function `map-set` will allow the existing mapping of `messages` to add a new key-value pair consiting of the metadata of the new message. +The function `map-set` will allow the existing mapping of `messages` to add a new key-value pair consisting of the metadata of the new message. We'll be using the current Bitcoin block height (via `burn-block-height`) as a way to capture the time of when this new message was added. Through `burn-block-height` , Clarity allows us to have read access into the Bitcoin state at anytime. @@ -403,9 +416,11 @@ Since we're working with sBTC in our local developer environment, we'll need to In our case, all we'll need to do is add the [`.sbtc-deposit`](https://explorer.hiro.so/txid/SM3VDXK3WZZSA84XXFKAFAF15NNZX32CTSG82JFQ4.sbtc-deposit?chain=mainnet) contract as a project requirement. {% code title="terminal" %} + ``` clarinet requirements add SM3VDXK3WZZSA84XXFKAFAF15NNZX32CTSG82JFQ4.sbtc-deposit ``` + {% endcode %} You'll notice in the `add-message` public function, we're making an external contract call to the [`.sbtc-token`](https://explorer.hiro.so/txid/0xead2080826685a98886891cbd9b288d367ae19b357353c71fff4a3330da582c8?chain=mainnet) contract. This is the official sBTC token contract that contains the [SIP-010](https://github.com/stacksgov/sips/blob/main/sips/sip-010/sip-010-fungible-token-standard.md) standard `transfer` function that we are invoking. @@ -475,10 +490,10 @@ You'll notice the usage of a `at-block` function in the highlighted line of code Now with the actual writing of your contract complete, we now need to test its functionality. There's a few different ways we can go about iterating and testing the functionality of your contract. -* Contract interaction in the [Clarinet REPL](../clarinet/contract-interaction.md) -* Running your contract in a [local blockchain environment](../clarinet/local-blockchain-development.md) -* Fuzz testing with [Rendezvous](https://stacks-network.github.io/rendezvous/) -* Writing unit tests with the [Clarinet JS SDK](/broken/pages/I1W2xGQYVmPwMEEfqje6) +- Contract interaction in the [Clarinet REPL](../clarinet/contract-interaction.md) +- Running your contract in a [local blockchain environment](../clarinet/local-blockchain-development.md) +- Fuzz testing with [Rendezvous](https://stacks-network.github.io/rendezvous/) +- Writing unit tests with the [Clarinet JS SDK](/broken/pages/I1W2xGQYVmPwMEEfqje6) We'll go with unit testing for now. In your `tests` folder, open up the related `message-board.test.ts` file and let's use the unit test written below. @@ -553,6 +568,7 @@ You'll notice we have two `it` blocks setup to test out 2 different scenarios: Run the test via `npm run test` to confirm that the two scenarios are functioning as intended. {% code title="terminal" %} + ```bash $ npm run test @@ -566,6 +582,7 @@ $ npm run test Start at 14:05:07 Duration 886ms (transform 40ms, setup 42ms, collect 8ms, tests 46ms, environment 699ms, prepare 4ms) ``` + {% endcode %} Great! Now that your contract is working as intended, let's deploy the contract to testnet. @@ -625,6 +642,7 @@ For more information on configuring deployment plans, check out the specific gui {% endhint %} {% code title="terminal" %} + ```bash $ clarinet deployments generate --testnet --medium-cost Analyzing contracts... @@ -632,6 +650,7 @@ Calculating deployment costs... Generating deployment plan Created file deployments/default.testnet-plan.yaml ``` + {% endcode %} {% endstep %} @@ -641,9 +660,11 @@ Created file deployments/default.testnet-plan.yaml Once your deployment plan is generated and configured properly, go ahead and deploy the contract to testnet. {% code title="terminal" %} + ```bash clarinet deployments apply --testnet ``` + {% endcode %} If the contract was successfully deployed, you should see the below confirmation: @@ -818,18 +839,18 @@ For the complete set of available API endpoints for the Stacks network, check ou And that's it, you've successfully created an sBTC powered Clarity smart contract which can be interacted with from a frontend app. There's obviously much more you can do to complete this but you've got some of the basics down pat now. Go ahead and finish creating the frontend functions to call on the other contract functions we have. -*** +--- ### Further Improvements This is just the beginning. There are many ways we can improve upon this app. Here are some suggestions for you to extend the functionality of this app: -* Deploy to mainnet and share your project with the community -* Use [Chainhooks](https://docs.hiro.so/en/tools/chainhooks) to index emitted events from the contract -* Integrate the [`sbtc`](../more-guides/sbtc/bridging-bitcoin/) library so users can directly bridge their BTC to sBTC in-app -* Utilize SIP-009 NFTs to uniquely identify each message for each author +- Deploy to mainnet and share your project with the community +- Use [Chainhooks](https://docs.hiro.so/en/tools/chainhooks) to index emitted events from the contract +- Integrate the [`sbtc`](../more-guides/sbtc/bridging-bitcoin/) library so users can directly bridge their BTC to sBTC in-app +- Utilize SIP-009 NFTs to uniquely identify each message for each author -*** +--- ### Next Steps @@ -837,17 +858,17 @@ Now that you have the basics down, here are some ways to continue your Stacks de **Learn More About Clarity** -* [**Clarity Crash Course**](https://docs.stacks.co/docs/clarity-crash-course): Quick introduction to Clarity concepts -* [**Clarity Book**](https://book.clarity-lang.org/): Comprehensive guide to Clarity development -* [**Clarity Reference**](https://docs.stacks.co/docs/clarity): Complete documentation of Clarity functions +- [**Clarity Crash Course**](https://docs.stacks.co/docs/clarity-crash-course): Quick introduction to Clarity concepts +- [**Clarity Book**](https://book.clarity-lang.org/): Comprehensive guide to Clarity development +- [**Clarity Reference**](https://docs.stacks.co/docs/clarity): Complete documentation of Clarity functions **Development Tools** -* [**Clarinet**](https://github.com/stx-labs/clarinet): Local development environment for Clarity -* [**Hiro Platform**](https://platform.hiro.so/): Hosted development environment -* [**Stacks Explorer**](https://explorer.stacks.co/): View transactions and contracts +- [**Clarinet**](https://github.com/stx-labs/clarinet): Local development environment for Clarity +- [**Hiro Platform**](https://platform.hiro.so/): Hosted development environment +- [**Stacks Explorer**](https://explorer.stacks.co/): View transactions and contracts **Community Resources** -* [**Stacks Discord**](https://discord.gg/stacks): Connect with other developers -* [**Stacks Forum**](https://forum.stacks.org/): Ask questions and share projects +- [**Stacks Discord**](https://discord.gg/stacks): Connect with other developers +- [**Stacks Forum**](https://forum.stacks.org/): Ask questions and share projects diff --git a/docs/contribute/README.md b/docs/contribute/README.md index 53a04b8288..3c92876adf 100644 --- a/docs/contribute/README.md +++ b/docs/contribute/README.md @@ -12,15 +12,17 @@ Because of this two-way sync, you can contribute to the documentation in one of {% stepper %} {% step %} + ### Fork the repo and create a PR -You can fork the docs repo, add your change, and then create a PR to be merged into the main docs. +You can fork the docs repo, make your changes, and then create a PR to be merged into the main docs. {% endstep %} {% step %} + ### Create an issue -You can create an issue, and someone that works on the docs will take a look and implement it if it is a necessary change. +You can create an issue, and someone who works on the docs will take a look and implement it if it's a necessary change. {% endstep %} {% endstepper %} diff --git a/docs/learn/README.md b/docs/learn/README.md index 793e0179e2..0f967899b9 100644 --- a/docs/learn/README.md +++ b/docs/learn/README.md @@ -1,5 +1,5 @@ --- -description: 'Stacks: The leading Bitcoin L2.' +description: "Stacks: The leading Bitcoin L2." layout: width: default title: @@ -26,7 +26,8 @@ For the official Stacks whitepaper: [https://stacks-network.github.io/stacks/sta ### Stacks: The TL;DR -Stacks activates the Bitcoin economy. Bitcoin is the most adopted, most valuable, and most decentralized cryptocurrency. The Stacks L2 enables fast, cheap BTC and full-featured smart contracts on the L2 without modifying Bitcoin itself. Users and developers can use BTC in their apps and pay gas fees with BTC. All transactions on Stacks L2 are secured by Bitcoin L1 with 100% finality, enabling you to build apps and digital assets that are integrated with Bitcoin security. +Stacks activates the Bitcoin economy. Bitcoin is the most adopted, most valuable, and most decentralized cryptocurrency. The Stacks L2 enables fast, cheap BTC and full-featured smart contracts on the L2 without modifying Bitcoin itself. Users and developers can use BTC in their apps and pay gas fees with BTC. All transactions on Stacks L2 are secured by Bitcoin L1 with 100% finality, enabling you to build apps and digital assets that are integrated + with Bitcoin security. The Stacks layer for smart contracts has the following innovations that make it unique: @@ -41,14 +42,16 @@ The Stacks layer for smart contracts has the following innovations that make it {% stepper %} {% step %} + #### Proof of Transfer -Proof of Transfer (PoX) is the block production mechanism of the Stacks chain. Essentially, it attempts to recreate the block production patterns of PoW programmatically. Stacks miners spend BTC for a chance to mine new Stacks blocks. Under the hood, this block production mechanism anchors Stacks blocks to Bitcoin blocks, making it as hard to reverse a Stacks block as it is to reverse a Bitcoin block. That's a big claim, and we unpack it in further detail in the sections on Nakamoto block production. +Proof of Transfer (PoX) is the block production mechanism of the Stacks chain. It tries to recreate the block production patterns of Proof of Work in a programmed way. Stacks miners spend BTC for a chance to mine new Stacks blocks. Under the hood, this block production mechanism anchors Stacks blocks to Bitcoin blocks, making it as hard to reverse a Stacks block as it is to reverse a Bitcoin block. That's a big claim, and we unpack it in further detail in the sections on Nakamoto block production. [Learn more about PoX](stacks-101/proof-of-transfer.md) {% endstep %} {% step %} + #### Clarity Clarity is the smart contract language that Stacks uses. It has been designed from the ground up to make it easier for developers to write safe, secure smart contracts. Additionally, since it has been purpose-built for Stacks and Bitcoin, there are built-in functions for reading Bitcoin state, which means you can use Bitcoin state to perform actions in Clarity. For example, you could set up a check to make sure a particular Bitcoin transaction has occurred before executing a mint function in Clarity, which just so happens to be what happens with the third component: sBTC. @@ -57,17 +60,18 @@ Clarity is the smart contract language that Stacks uses. It has been designed fr {% endstep %} {% step %} + #### sBTC -sBTC is the trust-minimized 2-way Bitcoin peg on the Stacks layer. sBTC is the key to making Bitcoin programmable and bringing full smart contract functionality to Bitcoin via Stacks. sBTC is not a federation, but operates as an open-network, decentralized 2-way peg solution to bring smart contract functionality to Bitcoin with as little counterparty risk as possible. +sBTC is a trust-minimized two-way Bitcoin peg on the Stacks layer. It's the key to making Bitcoin programmable and adding full smart contract functionality to Bitcoin through Stacks. Unlike a federation, it operates as an open, decentralized peg solution that brings smart contract functionality to Bitcoin with minimal counterparty risk. [Learn more about sBTC](sbtc/) {% endstep %} {% endstepper %} -*** +--- -### Why you need to learn the fundamentals of Stacks? +### Why learn the fundamentals of Stacks? Stacks fundamentals give you the intuition to build apps that are safer, more Bitcoin-aligned, and more future-proof. A developer who learns the basics doesn’t just write Clarity—they build apps that actually _feel like_ Bitcoin apps. @@ -76,15 +80,15 @@ Stacks fundamentals give you the intuition to build apps that are safer, more Bi 3. You'll write better smart contracts 4. You'll use sBTC and Bitcoin writes correctly -*** +--- ### What to learn next?

Stacks 101

Really dive into the nuts and bolts of how Stacks is built on Bitcoin.stacks-101

Network Fundamentals

Learn about accounts, testnets, SIPs, authentication, BNS, and more.network-fundamentals

Block Production

How do Stacks blocks get validated and mined?block-production

Transactions

Learn about the lifecycle of a transaction on Stacks.transactions

Clarity

Discover the philosophy and design principles of the Clarity smart contract language.clarity

sBTC

Understand how bitcoin is unwrapped into a productive and programmable asset.sbtc

Dual Stacking

A financial innovation on top of the core foundation of Stacking. Earn bitcoin with bitcoin.dual-stacking
-*** +--- ### Additional Resources -* \[[Stacks YT](https://youtu.be/0erpW7IEo6Y?si=Ldu4RlVVnLqOL4eP)] How Stacks Will Grow In 2025 With Stacks Founder Muneeb Ali -* \[[Token2049 Dubai](https://youtu.be/DFTXAOmi0es?si=sMOO6Yfj_TCVdFTF)] Muneeb Ali - Building Bitcoin’s Future: The Role of Stacks L2 +- \[[Stacks YT](https://youtu.be/0erpW7IEo6Y?si=Ldu4RlVVnLqOL4eP)] How Stacks Will Grow In 2025 With Stacks Founder Muneeb Ali +- \[[Token2049 Dubai](https://youtu.be/DFTXAOmi0es?si=sMOO6Yfj_TCVdFTF)] Muneeb Ali - Building Bitcoin’s Future: The Role of Stacks L2 diff --git a/docs/learn/stacks-101/bitcoin-connection.md b/docs/learn/stacks-101/bitcoin-connection.md index e1032d52d8..420370d03d 100644 --- a/docs/learn/stacks-101/bitcoin-connection.md +++ b/docs/learn/stacks-101/bitcoin-connection.md @@ -8,23 +8,23 @@ That's a big promise, but how does Stacks actually deliver on it? And what makes Before we get into the technical details of how Stacks works, it's important to get a high-level overview of the problem it's solving and how it actually does that. We'll dive deeper into some of these topics as we go through the docs, but it's good to get a high-level picture to bring everything together. -This topic is a bit of a rabbit hole, and this section is pretty long, but it will give you an in-depth understanding of exactly the problem Stacks is looking to solve, and how it solves it. +This topic is deep, and the section is long, but it provides an in-depth understanding of the problem Stacks solves and how. Let's get into it. ### Is Stacks a Bitcoin L2? -Stacks is a Bitcoin layer for smart contracts. The classification as a layer-1 (L1) or layer-2 (L2) or sidechain really depends on the definition used. With that said, generally speaking L1 chains are sovereign meaning that (a) they have their own security budget, and (b) they can survive without the need for any other L1 chain. L2 chains typically do not have their own security budget and share the security of the underlying L1 chain, and they cannot live without the underlying L1 chain. There are many different design mechanisms that L2s can use, and we cover several of them and how Stacks compares in the [Stacks Among Other Bitcoin Layers](stacks-among-other-layers.md) section. +Stacks is a Bitcoin layer for smart contracts. Classification as L1, L2, or sidechain depends on the definition. Generally, L1 chains are sovereign with their own security budget and can survive independently. L2 chains share the L1's security and can't survive without it. We cover different L2 designs and Stacks' comparison in [Stacks Among Other Bitcoin Layers](stacks-among-other-layers.md). -The initial release of Stacks in early 2021 had a separate security budget from Bitcoin L1. Even though the Stacks layer could not function without Bitcoin L1, the developers working on the project described it as a different system that does not fit neatly into existing classifications, sometimes using the term layer 1.5 (see [this Decrypt article](https://decrypt.co/82019/bitcoin-defi-thing-says-stacks-founder-muneeb-ali) for example). +The initial Stacks release in early 2021 had its own security budget separate from Bitcoin L1. Though it couldn't function without Bitcoin, developers called it a unique system, sometimes 'layer 1.5' (see [Decrypt article](https://decrypt.co/82019/bitcoin-defi-thing-says-stacks-founder-muneeb-ali)). -The upcoming planned release of Stacks, called the Nakamoto release, will no longer have a separate security budget from Bitcoin. Instead, a 100% of Bitcoin hashpower will determine finality on Stacks layer. After the next upgrade, to reorg Stacks blocks/transactions the attacker will need to reorg Bitcoin L1 itself (which is very hard to do and therefore a great security property for a Bitcoin layer to have). More details in the [Stacks paper](https://stacks.co/stacks.pdf). +The upcoming Nakamoto release will eliminate Stacks' separate security budget. 100% of Bitcoin's hash power will determine Stacks' finality. To reorganize Stacks blocks, an attacker must reorganize Bitcoin L1 itself—a hard task providing strong security. See the [Stacks paper](https://stacks.co/stacks.pdf) for details. -The definition of [L2 used in Ethereum](https://ethereum.org/en/layer-2/) and other newer ecosystems is different and focuses on the ability to withdraw assets using only L1 security and L1 miners. According to that definition Stacks layer is not a clear L2, given the set of peg-out signers determine if users can withdraw sBTC. Bitcoin cannot support such verification without changes to Bitcoin L1 (which may happen in the future). The Ethereum L2 definition also does not apply that cleanly to Bitcoin L2s, given new assets are issued on L2s when it comes to Bitcoin and not issued on L1 (only BTC is the L1 asset). Therefore, using the definition of security of withdrawing assets is not directly applicable given assets are defined and used on L2s and not withdrawn out to Bitcoin L1 anyway (with the exception of BTC itself). Rather, what becomes more important is "settlement on Bitcoin" i.e., is contract data and state secured by 100% of Bitcoin's hashpower or not. +The [Ethereum L2 definition](https://ethereum.org/en/layer-2/) focuses on withdrawing assets using only L1 security. By this, Stacks isn't a clear L2 because peg-out signers control sBTC withdrawals. Bitcoin can't verify this without L1 changes. Also, assets are issued on L2s, not L1 (except BTC). So, 'settlement on Bitcoin' matters more—is data secured by 100% of Bitcoin's hash power? -Remember that L2s on Bitcoin also have to serve the additional purpose of expanding both functionality and scalability, which means L2s accomplish fundamentally different goals depending on the functionality of the L1. +Bitcoin L2s expand functionality and scalability, so their goals differ based on the L1's capabilities. -Users and developers organically call Stacks a Bitcoin L2, since it is a simpler concept to understand. There are certain properties of Stacks layer that also help the concept of Stacks as a Bitcoin L2: +Users and developers call Stacks a Bitcoin L2 for simplicity. Key properties support this: {% stepper %} {% step %} @@ -58,19 +58,19 @@ Contracts on Stacks layer can read Bitcoin L1 transactions and respond to them. {% endstep %} {% endstepper %} -Given all the details above, why would some people think that Stacks is not a Bitcoin L2? There are a couple of reasons this question comes up often: +Why do some think Stacks isn't a Bitcoin L2? Common reasons: {% stepper %} {% step %} **Old security-budget material** -The initial version of Stacks (released early 2021) had a separate security budget which changed to following 100% Bitcoin hashpower with the Nakamoto release. There is old material and blog posts floating around that still talk about the initial Stacks version. The old materials will likely get updated with time. +The initial Stacks version (released early 2021) had a separate security budget, which changed to following 100% Bitcoin hash power with the Nakamoto release. Old materials and blog posts still reference the initial version but will likely be updated. {% endstep %} {% step %} **Ethereum L2 withdrawal definition doesn't map cleanly** -According to the Ethereum definition of L2s a user should be able to withdraw their base-layer assets purely by doing an L1 transaction and relying only on L1 security (this is true for Lightning for example). This definition does not apply cleanly to Bitcoin L2s because assets are not defined at Bitcoin L1 but are defined in L2s instead. The only asset where this matters is the pegged BTC asset from Bitcoin L1, given all other assets are native to L2s anyway. In the upcoming Stacks release, users can withdraw their BTC by sending just a Bitcoin L1 transaction but Bitcoin L1 cannot validate that complex transaction and a majority of peg-out signers will need to sign on the peg-out request. In an ideal world Bitcoin miners can validate such transactions but that would require a change to Bitcoin L1. Therefore, Stacks design optimizes for a method that is decentralized and can be deployed without any changes to Bitcoin L1. If in the future it is possible to make changes to Bitcoin L1 then Stacks layer security can benefit from that as well. +The Ethereum L2 definition requires withdrawing base-layer assets via an L1 transaction using only L1 security (true for Lightning). This doesn't apply cleanly to Bitcoin L2s because assets are defined on L2s, not L1. The only relevant asset is pegged BTC. In the upcoming Stacks release, users withdraw BTC with a Bitcoin L1 transaction, but L1 can't validate it, requiring majority peg-out signer approval. Bitcoin miners could validate if L1 changes, but Stacks optimizes for decentralization without L1 changes. Future L1 upgrades could improve this. {% endstep %} {% step %} @@ -80,31 +80,31 @@ Bitcoin community members are generally skeptical of claims and on the lookout f {% endstep %} {% endstepper %} -Why don't we use the term 'sidechain' for Stacks then? Sidechains in Bitcoin typically have a different security budget from Bitcoin L1, typically as a subset of Bitcoin miners who participate in the sidechain (they don't follow 100% Bitcoin finality), their consensus runs on the sidechain (vs running on Bitcoin L1), and they don't publish their data/hashes on Bitcoin L1. The Stacks layer does not fit that definition cleanly given the consensus runs on Bitcoin L1, it follows Bitcoin finality, and publishes data/hashes on L1. +Why not call Stacks a sidechain? Sidechains usually have separate security budgets, subset of miners, consensus on the sidechain, and don't publish data on Bitcoin L1. Stacks doesn't fit: consensus on Bitcoin L1, follows Bitcoin finality, publishes data on L1. Can Stacks layer work with rollups? -Yes! There is already an active R\&D effort to integrate rollups with the Stacks layer. Both with the Stacks layer and sovereign rollups the technically challenging part is how to get BTC in and out of the Stacks layer or the sovereign rollup. The decentralized BTC peg, [sBTC](../sbtc/), applies to both the Stacks layer and sovereign rollups. Without modifying Bitcoin L1, an sBTC-like design with a decentralized open-membership group of signers is the most trust-minimized way to move BTC in and out of Bitcoin layers. Once the necessary upgrades to Bitcoin L1 can be made to enable validity rollups i.e., Bitcoin L1 can enforce BTC withdrawal from a layer, then the Stacks layer can also upgrade to benefit from it. +Yes! There's active R\&D to integrate rollups with Stacks. The challenge is moving BTC in and out. The decentralized [sBTC](../sbtc/) peg works for both Stacks and sovereign rollups. Without Bitcoin L1 changes, sBTC's decentralized signers provide the most trust-minimized way. Future Bitcoin upgrades for validity rollups could let Stacks benefit too. -Given a trust-minimized asset like sBTC is needed for sovereign rollups, with the launch of sBTC such sovereign rollups become even more interesting to deploy. The Stacks layer can potentially provide the decentralized group of signers for a trust-minimized BTC asset that can be used in a sovereign rollup, and DA comes directly from Bitcoin L1 e.g., with Ordinals. +With sBTC, sovereign rollups become more appealing. Stacks could provide decentralized signers for trust-minimized BTC in rollups, with data availability from Bitcoin L1 via Ordinals. ### Why Does Stacks Need a Token? -This brings us to a central philosophical conversation in the world of crypto and Bitcoin, whether or not blockchains need tokens. +This leads to a key debate in crypto and Bitcoin: do blockchains need tokens? -Let's start by looking at the fundamental reason why tokens exist: to fund the maintenance and forward progress of a blockchain. +Tokens exist to fund blockchain maintenance and progress. -Bitcoin is a token. It is a cryptocurrency that is used to incentivize miners to add new blocks to the chain. In Bitcoin's case, mining rewards are set on a predefined schedule, and once those mining rewards run out, the chain will need to survive on transaction fees alone. +Bitcoin is a token that incentivizes miners to add blocks. Rewards follow a schedule; after they end, the chain relies on fees. -The purpose of a blockchain is to have a permanent historical record of every transaction that has ever occurred on the chain. Blockchains are basically ledgers. The token aspect is used as an incentive mechanism to secure and maintain the chain. +Blockchains maintain permanent transaction records. Tokens incentivize securing and maintaining the chain. -This is why networks like Lightning and other P2P networks don't need tokens, they don't need to maintain a historical record. Channel-based solutions like Lightning rely on users opening 2-of-2 multisigs with each other. Once those channels are closed, the state disappears. When we are talking about a system that is supposed to maintain a global financial system, it is important for the maintenance of that system to be incentivized correctly. +Networks like Lightning don't need tokens because they don't maintain historical records. Channels use multisigs; state disappears when closed. For global financial systems, incentives are crucial. -Let's look at this concept in the context of Stacks and its goals. Stacks seeks to provide smart contract functionality to Bitcoin, to serve as the programming rails for building a decentralized economy on top of Bitcoin. +In Stacks' context, it provides smart contracts for Bitcoin, serving as rails for a decentralized economy. -Many Bitcoin community members are skeptical of new tokens and rightly so. There are countless projects out there that force the use of a token on their project and in many cases a token is actually not needed. The Stacks project was started by Bitcoin builders who have a long history of building apps & protocols on Bitcoin L1 without any token (e.g., BNS launched in 2015 on Bitcoin L1 which was one of the largest protocols using OP\_RETURN on Bitcoin L1). So why did a bunch of Bitcoin builders decide to have a separate token for Stacks L2? Great question! Let's dig into the details. +Bitcoin community members are rightly skeptical of new tokens. Many projects force tokens unnecessarily. Stacks' founders are Bitcoin builders with history of tokenless apps (e.g., BNS in 2015 using OP_RETURN). Why a token for Stacks L2? Let's explore. -The Stacks token (STX) is primarily meant to be used for two things: +The STX token serves two main purposes: {% stepper %} {% step %} @@ -120,46 +120,46 @@ Signers participating in peg-out operations receive incentives in STX to economi {% endstep %} {% endstepper %} -The only way to remove the token is to build Stacks as a federated network like Liquid. In a federation the pre-selected group of companies control the mining and block production and a pre-selected group of companies need to be trusted for peg-out transactions. +To remove the token, Stacks would need a federated network like Liquid, where pre-selected companies control mining and peg-outs. -Stacks developers wanted to design an open and permissionless system. The only way to have a decentralized mining process is through incentives. As mentioned above, this is how Bitcoin works as well, where newly minted BTC are used as incentives to mine new blocks and anyone in the world can decide to become a miner. Anyone with BTC can mine the Stacks L2 chain, it is open and permissionless. +Stacks' developers aimed for an open, permissionless system. Decentralized mining requires incentives, like Bitcoin's new BTC for miners. Anyone with BTC can mine Stacks L2. -Similarly, the way sBTC is designed is that the group of signers is open and permissionless (unlike a federation). These signers have economic incentives to correctly follow the protocol for peg-out requests. In a federation, users need to blindly trust the pre-set federation members to get their BTC out of the federation and back on Bitcoin L1. Stacks developers wanted to have an open, permissionless, and decentralized way to move BTC from Bitcoin L1 to Stacks L2 and back. This is made possible through economic incentives i.e., need for a token. +sBTC's signers are open and permissionless, incentivized to follow protocol. Federations require trusting pre-set members for peg-outs. Stacks' developers wanted decentralized BTC movement, enabled by economic incentives—a token. {% hint style="info" %} With more and more Bitcoin layers emerging, there is some nuance in this federated vs open network design. Some protocols like Botanix's Spiderchain offer an open network but have different incentive mechanisms. We dig into these in detail in the [Stacks Among Other Layers](stacks-among-other-layers.md) section. {% endhint %} -Other than these two reasons, STX is also used to pay gas fees for transactions. However, once the upcoming sBTC peg is live most of the economy of Stacks L2 is expected to follow a Bitcoin standard and work using BTC as the economic unit. It is expected that users will mostly interact just with Bitcoin and use BTC in wallets and apps (gas fees can be paid with BTC using atomic swaps in the background). It is important to note that BTC cannot be used for mining incentives on Stacks L2 because the only way to incentivize decentralized block production is through newly minted assets by the protocol (similar to how Bitcoin works itself) i.e., need for a token. +STX also pays gas fees. With sBTC, the economy will use BTC as the unit. Users will interact with Bitcoin, paying fees with BTC via atomic swaps. BTC can't incentivize mining; only new protocol assets can, like in Bitcoin—hence the token. ### The Symbiotic Relationship Between Stacks and Bitcoin -Stacks and Bitcoin complement each other. Stacks leverages the extreme decentralization of Bitcoin, its PoW consensus mechanism, and its value as a cryptocurrency. +Stacks and Bitcoin complement each other. Stacks uses Bitcoin's decentralization, PoW, and value. -But Stacks also complements Bitcoin by unlocking additional use cases, thereby increasing its value over time. This also helps to solve the additional problem of the future maintainability of Bitcoin after the coinbase rewards are gone and Bitcoin has to function on transaction fees alone. +Stacks complements Bitcoin by enabling new use cases, increasing its value. This helps Bitcoin's long-term maintenance after mining rewards end, relying on fees. -If Bitcoin is seen as only a store of value, the economic density, meaning how much value is being exchanged, of each transaction will be minimal. But if Bitcoin is the underlying foundation for an entire decentralized economy, those [transactions become much more valuable](https://twitter.com/muneeb/status/1506976317618728963), increasing transaction fees. This is a crucial incentive for miners to continue securing the network as coinbase rewards drop. +If Bitcoin is just a store of value, transactions have low economic density. As a foundation for a decentralized economy, transactions gain value, boosting fees. This incentivizes miners as rewards decrease. ### Reading from Bitcoin State -One of the things that gives the Stacks chain its superpowers in connecting with Bitcoin is not only how it connects to Bitcoin at a protocol level, discussed above, but also how we can utilize that Bitcoin at a programmatic level. +Stacks' superpower is programmatic Bitcoin access, beyond protocol connection. -That's where Clarity comes in. Clarity is the smart contract language for Stacks, and is how we actually build out a lot of the functionality we are talking about here. +Clarity, Stacks' smart contract language, enables this functionality. -One of the often-touted features of Clarity is that it has access to the state of the Bitcoin chain built in, but how does it actually do that? Because of Stacks' PoX mechanism, every Stacks block is connected to a Bitcoin block, and can query Bitcoin block header hashes with the [`get-burn-block-info?` function](https://github.com/stacksgov/sips/blob/feat/sip-015/sips/sip-015/sip-015-network-upgrade.md#new-method-get-burn-block-info). +Clarity accesses Bitcoin state via Stacks' PoX. Each Stacks block links to a Bitcoin block, querying header hashes with [`get-burn-block-info?`](https://github.com/stacksgov/sips/blob/feat/sip-015/sips/sip-015/sip-015-network-upgrade.md#new-method-get-burn-block-info). -This function allows us to pass in a Bitcoin block height and get back the header hash. The [`burn-block-height` Clarity keyword](https://docs.stacks.co/docs/write-smart-contracts/clarity-language/language-keywords#burn-block-height) will give us the current block height of the Bitcoin chain. +It takes a Bitcoin block height and returns the header hash. [`burn-block-height`](https://docs.stacks.co/docs/write-smart-contracts/clarity-language/language-keywords#burn-block-height) gives the current Bitcoin block height. -However, `get-burn-block-info?` only returns data of the Bitcoin block at that height if it has already been processed and was created after the launch of the Stacks chain. So if we want to evaluate whether or not something happened on Bitcoin, we have to wait at least one block later to do so. +`get-burn-block-info?` returns data only for processed blocks after Stacks' launch. To check Bitcoin events, wait at least one block. -This is step 1 of Clarity contracts being able to serve as the programming layer for Bitcoin. When a BTC transaction is initiated, the first thing that needs to happen is that a Clarity contract needs to become aware of it. This can happen manually by utilizing Clarity functions discussed above with the [BTC library](https://explorer.stacks.co/txid/0x8b112f2b50c1fa864997b7496aaad1e3940700309a3fdcc6c07f1c6f8b9cfb7b?chain=mainnet), as [Catamaran Swaps](https://docs.catamaranswaps.org/en/latest/catamaran.html) do. +This is the first step for Clarity as Bitcoin's programming layer. For a BTC transaction, the Clarity contract must detect it. This can be manual using Clarity functions and the [BTC library](https://explorer.stacks.co/txid/0x8b112f2b50c1fa864997b7496aaad1e3940700309a3fdcc6c07f1c6f8b9cfb7b?chain=mainnet), like [Catamaran Swaps](https://docs.catamaranswaps.org/en/latest/catamaran.html). {% hint style="info" %} Note that this process is made easier by the additional Clarity functions added in 2.1, like the `get-burn-block-info?` function we looked at above. {% endhint %} -Or we can automate (albeit at a cost of some centralization in our dapp) using an event-based architecture using something like Hiro's [chainhooks](https://www.hiro.so/blog/meet-4-new-features-in-clarinet#setting-up-trigger-actions-with-chainhooks), which will allow us to automatically trigger a Clarity contract call when a certain BTC transaction is initiated. +Automation is possible with event-based architecture, like Hiro's [chainhooks](https://www.hiro.so/blog/meet-4-new-features-in-clarinet#setting-up-trigger-actions-with-chainhooks), triggering Clarity calls on BTC transactions (with some centralization). -This is the first component of using Stacks to build Bitcoin dapps, the read access to Bitcoin chain. +This is the first component for building Bitcoin dApps on Stacks: read access to the Bitcoin chain. -Next up, let's dig a bit deeper into how exactly Stacks is "built on Bitcoin" by taking a look at Stacks' block production mechanism, Proof of Transfer. +Next, let's explore how Stacks is 'built on Bitcoin' through its block production: Proof of Transfer. diff --git a/docs/learn/stacks-101/proof-of-transfer.md b/docs/learn/stacks-101/proof-of-transfer.md index ff325fea74..5af97bf38f 100644 --- a/docs/learn/stacks-101/proof-of-transfer.md +++ b/docs/learn/stacks-101/proof-of-transfer.md @@ -2,31 +2,31 @@
-In the previous sections, we took a look at the vision and ethos of Stacks and talked a lot about it being connected to Bitcoin and how it enables expanding functio nality without modifying Bitcoin itself. +In the previous sections, we took a look at the vision and ethos of Stacks and talked a lot about it being connected to Bitcoin and how it enables expanding functionality without modifying Bitcoin itself. In this section, we'll run through the block production mechanism that makes that happen, Proof of Transfer. This section will be a conceptual overview of Proof of Transfer. For more details on exactly how block production happens at a technical level, check out the section on [Block Production](../block-production/). -Consensus algorithms for blockchains require compute or financial resources to secure the blockchain. The general practice of decentralized consensus is to make it practically infeasible for any single malicious actor to have enough computing power or ownership stake to attack the network. +Consensus algorithms require compute or financial resources to secure blockchains. They make it hard for any single malicious actor to attack the network with enough power or stake. Popular consensus mechanisms in modern blockchains include proof of work, in which nodes dedicate computing resources, and proof of stake, in which nodes dedicate financial resources to secure the network. Proof of burn is another, less-frequently used consensus mechanism where miners compete by ‘burning’ (destroying) a proof of work cryptocurrency as a proxy for computing resources. -Proof of Transfer (PoX) is an extension of the proof of burn mechanism. PoX uses the proof of work cryptocurrency of an established blockchain (Bitcoin in this case) to secure a new blockchain. However, unlike proof of burn, rather than burning the cryptocurrency, miners transfer the committed cryptocurrency to some other participants in the network (Stackers in this case). +Proof of Transfer (PoX) extends proof of burn. It uses an established PoW cryptocurrency (Bitcoin) to secure a new blockchain. Instead of burning the crypto, miners transfer it to other participants (Stackers).
-This allows network participants to secure the PoX cryptocurrency network and earn a reward in the base cryptocurrency (BTC). Thus, PoX blockchains are anchored on their chosen PoW chain. Stacks uses Bitcoin as its anchor chain. +This lets participants secure the PoX network and earn BTC rewards. PoX blockchains anchor to their chosen PoW chain. Stacks anchors to Bitcoin.
### Why Bitcoin? -There are a number of reasons that Stacks chose Bitcoin as the blockchain to power consensus. It's the oldest blockchain protocol, having launched in 2009, and has become a recognized asset outside of the cryptocurrency community. BTC has held the highest market capitalization of any cryptocurrency for the past decade. +Stacks chose Bitcoin for consensus for several reasons. It's the oldest protocol (launched 2009) and recognized beyond crypto. BTC has the highest market cap for a decade. -Bitcoin champions simplicity and stability, and has stood the test of time. Influencing or attacking the network is infeasible or impractical for any potential hackers. It's one of the only cryptocurrencies to capture public attention. Bitcoin is a household name, and is recognized as an asset by governments, large corporations, and legacy banking institutions. Lastly, Bitcoin is largely considered a reliable store of value, and provides extensive infrastructure to support the PoX consensus mechanism. +Bitcoin emphasizes simplicity and stability, proven over time. Attacking it is impractical. It's widely recognized by governments and institutions. It's a reliable store of value with infrastructure for PoX. SIP-001 provides a full [list of reasons why Bitcoin was chosen to secure Stacks](https://github.com/stacksgov/sips/blob/main/sips/sip-001/sip-001-burn-election.md). @@ -36,26 +36,26 @@ By the way, SIP stands for Stacks Improvement Proposal, and it's the process by ### Unlocking Bitcoin capital -In the previous section we talked about Stacks being able to allow us to build a decentralized economy on top of Bitcoin and that PoX was a key piece of being able to do that. +Previously, we discussed how Stacks enables a decentralized economy on Bitcoin, with PoX as key. -The reason is two-fold. First, as a part of this PoX mining process we have covered here, a hash of each Stacks block is recorded to the OP\_RETURN opcode of a Bitcoin transaction. If you aren't familiar, the OP\_RETURN opcode allows us to store up to 40 bytes of arbitrary data in a Bitcoin transaction. +The reason is twofold. First, in PoX mining, each Stacks block's hash is recorded in a Bitcoin transaction's OP_RETURN opcode, storing up to 40 bytes of data. {% hint style="info" %} This [Stack Exchange answer](https://bitcoin.stackexchange.com/questions/29554/explanation-of-what-an-op-return-transaction-looks-like) gives a good overview of the reasoning and history of this opcode. {% endhint %} -This is the first part of how Stacks inherits Bitcoin's security: its history is anchored block-by-block to the Bitcoin chain. Anyone can use merkle roots to verify these hashes to determine if the history is correct. +This anchors Stacks' history to Bitcoin block-by-block, inheriting its security. Anyone can verify hashes using Merkle roots. -Additionally, after the Nakamoto Upgrade, Stacks no longer forks on its own. Miners are required at a protocol level to build atop the last mined Stacks blocks, meaning that **Stacks is secured by both 100% of Bitcoin's hashrate in addition to the Stacks security budget from its miners.** We'll get into this process in more detail in the [Block Production](../block-production/) section. +After the Nakamoto Upgrade, Stacks doesn't fork independently. Miners build on the last blocks, securing Stacks with 100% of Bitcoin's hash rate plus its own budget. Details in [Block Production](../block-production/). -Additionally, part of this PoX process involves each Stacks block also knowing which Bitcoin block it is anchored to. Clarity, Stacks' smart contract language, has built-in functions for reading this data, such as [`get-block-info`](https://docs.stacks.co/docs/write-smart-contracts/clarity-language/language-functions#get-block-info), which returns, among other things, a field called `burnchain-header-hash`, which gives us the hash of the Bitcoin header corresponding to this Stacks block. +Each Stacks block knows its anchored Bitcoin block. Clarity has functions like [`get-block-info`](https://docs.stacks.co/docs/write-smart-contracts/clarity-language/language-functions#get-block-info) to read the `burnchain-header-hash`. -This allows us to do really interesting things like trigger certain things to happen in a Clarity contract by watching the chain and verifying whether or not certain transactions occurred. You can see this in action in [Catamaran Swaps](https://docs.catamaranswaps.org/en/latest/catamaran.html), with other interesting projects like [Zest](https://www.zestprotocol.com/) seeking to expand on this functionality. +This enables triggering Clarity contracts based on Bitcoin transactions. See [Catamaran Swaps](https://docs.catamaranswaps.org/en/latest/catamaran.html) and [Zest](https://www.zestprotocol.com/). -The ultimate goal of all this is to enable the vision of web3, building a decentralized economy and enabling true user ownership of assets and data, on top of Bitcoin as a settlement layer, and using Bitcoin as a base decentralized money. +The goal is web3: a decentralized economy with user-owned assets and data on Bitcoin as settlement layer. ### Proof of Transfer Contracts and Technical Details The Proof of Transfer functionality is implemented on the Stacks chain via a [Clarity smart contract](https://explorer.hiro.so/txid/0xc6d6e6ec82cabb2d7a9f4b85fcc298778d01186cabaee01685537aca390cdb46?chain=mainnet). An overview of this contract is available in the docs. -You can see the original design for stacking and proof of transfer by reading the relevant SIP, [SIP-007](https://github.com/stacksgov/sips/blob/main/sips/sip-007/sip-007-stacking-consensus.md). You can also utilize [Hiro's API](https://docs.hiro.so/api#tag/Info/operation/get_pox_info) to get proof of transfer details including the relevant contract address. +See the original design in [SIP-007](https://github.com/stacksgov/sips/blob/main/sips/sip-007/sip-007-stacking-consensus.md). Use [Hiro's API](https://docs.hiro.so/api#tag/Info/operation/get_pox_info) for PoX details. diff --git a/docs/learn/stacks-101/what-is-stacks.md b/docs/learn/stacks-101/what-is-stacks.md index 37a45a7cbd..acfeb7f318 100644 --- a/docs/learn/stacks-101/what-is-stacks.md +++ b/docs/learn/stacks-101/what-is-stacks.md @@ -6,9 +6,9 @@ We can get an idea of the goal and ethos behind Stacks by looking at [how Satosh > "...to be a completely separate network and separate block chain, yet share CPU power with Bitcoin...all networks in the world would share combined CPU power, increasing the total strength." -This is a major theme in the design decisions for Stacks. A bit of a contradiction in the Bitcoin world, the Stacks network is a Bitcoin L2, but it does have its own token. +This is a major theme in the design decisions for Stacks. The Stacks network is a Bitcoin L2, but it has its own token—a bit of a contradiction in the Bitcoin world. -This is an intentional and critical design decision primarily for the purpose of maintaining decentralization, rather than needing to rely on a federation. +This is an intentional design decision to maintain decentralization without relying on a federation. If that's confusing or you are skeptical, that's understandable — we'll be diving deeper into these ideas as we go through the docs. @@ -16,9 +16,9 @@ If that's confusing or you are skeptical, that's understandable — we'll be div When evaluating new blockchain technologies, it's important to keep the original intent and purpose of them intact. If we go back to Bitcoin, it was originally designed to be: -* Decentralized -* Immutable -* Secure +- Decentralized +- Immutable +- Secure You've likely heard of the blockchain trilemma — the problem of trying to balance decentralization, scalability, and security of a blockchain network. @@ -28,9 +28,9 @@ So at the bottom, you have the foundational layer: Bitcoin. Bitcoin is the most decentralized, most secure, and most immutable blockchain network. However, that comes with a few tradeoffs. -* Bitcoin is very slow compared to other networks. Bitcoin only has a new block written once every \~10 minutes, making its throughput negligible compared to networks designed for speed like Solana. -* Bitcoin is also "boring". Ethereum came along after Bitcoin and sought to do the same thing for software that Bitcoin did for money. Ethereum's goal is to be a decentralized supercomputer of sorts, serving as a global compute environment for smart contracts (code that is written to a blockchain). -* Bitcoin is not scalable. Because every new block must propagate to every node on the network, Bitcoin can only run as fast as the slowest node in the network. +- Bitcoin is very slow compared to other networks. Bitcoin only has a new block written once every \~10 minutes, making its throughput negligible compared to networks designed for speed like Solana. +- Bitcoin is also "boring". Ethereum aimed to do for software what Bitcoin did for money—a decentralized supercomputer for smart contracts. +- Bitcoin is not scalable. Because every new block must propagate to every node on the network, Bitcoin can only run as fast as the slowest node in the network. Now we are seeing the rise of modular blockchain networks like Cosmos that are designed to make it easy for people to spin up their own blockchain networks. @@ -38,37 +38,37 @@ While most new blockchain protocols popping up these days see these properties a ### The Stacks Way -Stacks takes a layered approach: the foundational settlement layer is Bitcoin, and scalability and functionality are added on top of that using layers. +Stacks uses a layered approach: Bitcoin as the base settlement layer, with added scalability and functionality on top. There are many different types of L2s and different ways they can be built. They all come with [different tradeoffs](stacks-among-other-layers.md) and have their own way of accomplishing the goals of scalability or functionality. By taking this layered approach, we are able to have all of the same functionality as chains like Ethereum, but built on Bitcoin. -So Stacks is a Bitcoin layer 2 with some unique properties, like having its own token, that acts as an incentive mechanism to maintain a historical ledger of all of its transactions and operate with its own security budget (in addition to Bitcoin's security budget — more on this in the next section). +Stacks is a Bitcoin L2 with unique properties, including its own token. This token incentivizes maintaining a historical ledger of transactions and provides an additional security budget alongside Bitcoin's. This is one of the things that separates Stacks from other Bitcoin layers like Lightning. -* Lightning doesn't add any additional functionality to Bitcoin; it simply helps to scale functionality Bitcoin already has and helps it operate faster. Lightning is also ephemeral — it has no permanent state — and so is unsuitable for things like smart contracts that need to keep track of data and maintain state. -* Contrast this to Stacks, which adds additional functionality to Bitcoin but still ultimately settles to Bitcoin (we'll cover this in the next section as well). +- Lightning scales Bitcoin's existing functionality and speeds it up but doesn't add new features. It's ephemeral with no permanent state, making it unsuitable for smart contracts that need to track data. +- Contrast this to Stacks, which adds additional functionality to Bitcoin but still ultimately settles to Bitcoin (we'll cover this in the next section as well). -The benefit is that we can maintain a separation of concerns and keep Bitcoin simple and sturdy, chugging along producing blocks, while adding additional layers for functionality and speed. If those other layers were compromised, the foundational layer would remain unaffected. +The benefit is separation of concerns: Bitcoin stays simple and secure, producing blocks, while additional layers add functionality and speed. If those layers are compromised, the base remains unaffected. This is important when building systems intended to be a global decentralized money (Bitcoin) and a decentralized economy built on top of that money (Stacks). -The STX token is a separate token used to incentivize honest block production. It does not represent pegged Bitcoin (there is a separate Bitcoin peg called [sBTC](../sbtc/) for that purpose). While this may ruffle some feathers among parts of the Bitcoin community, it has several advantages. +The STX token incentivizes honest block production. It doesn't represent pegged Bitcoin—[sBTC](../sbtc/) does that. This may upset some in the Bitcoin community, but it has advantages. By implementing a token into the Stacks chain, we provide additional economic incentive for miners to produce Stacks blocks honestly. -This token provides additional incentive as a way to grow the chain. Rather than relying on altruism to produce blocks and grow the chain, we can incentivize builders, token-holders, and investors all at the same time by having a token. +The token incentivizes growing the chain, rewarding builders, holders, and investors instead of relying on altruism. The ICO scams of 2017 put a bad taste in many people's mouths, which has justifiably made a lot of people skeptical of every new blockchain project that pops up with a new token. -But the problem with many of those projects was they had no actual value, weren't anchored to anything else of value, and provided no real utility. +Many projects lacked real value, weren't anchored to valuable assets, and offered no utility. -With a project like Stacks, we have real utility in the sense of serving as a way to utilize Bitcoin and make it a productive asset in a decentralized way. This is a key point: currently the only common ways to make Bitcoin productive are to give it to a custodial service or transfer it off the Bitcoin chain via something like wBTC on Ethereum. +Stacks provides real utility by making Bitcoin productive in a decentralized way. Currently, making Bitcoin productive usually means using custodial services or moving it to chains like Ethereum via wBTC. Stacks allows us to do this while ultimately still settling to the Bitcoin chain. -In addition, Stacks allows us to build decentralized and censorship-resistant software utilizing Bitcoin as the foundational settlement layer. Eventually, the goal is to build a network of financial systems and decentralized software products that all utilize Bitcoin as their money. +Stacks enables building decentralized, censorship-resistant software on Bitcoin. The goal is a network of financial systems and dApps all using Bitcoin as money. With that context, let's dive into exactly how Stacks is connected to Bitcoin.