Browse Source

feat: update diagrams and text for PoX and stacking

fix/microblocks-feedback
Patrick Gray 4 years ago
committed by Patrick Gray
parent
commit
6c7ff00c1e
  1. BIN
      public/images/pox-cycles.png
  2. BIN
      public/images/pox-mechanism.png
  3. BIN
      public/images/pox-mining-flow.png
  4. BIN
      public/images/pox-participants.png
  5. BIN
      public/images/pox-unlocking-btc.png
  6. BIN
      public/images/pox-why-bitcoin.png
  7. BIN
      public/images/stacking-delegation-illustration.png
  8. BIN
      public/images/stacking-dynamic-minimum.png
  9. BIN
      public/images/stacking-illustration.png
  10. BIN
      public/images/stx-microblocks.png
  11. 10
      src/pages/understand-stacks/mining.md
  12. 35
      src/pages/understand-stacks/proof-of-transfer.md
  13. 59
      src/pages/understand-stacks/stacking.md

BIN
public/images/pox-cycles.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 KiB

BIN
public/images/pox-mechanism.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 KiB

BIN
public/images/pox-mining-flow.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

BIN
public/images/pox-participants.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 KiB

BIN
public/images/pox-unlocking-btc.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
public/images/pox-why-bitcoin.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
public/images/stacking-delegation-illustration.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 226 KiB

After

Width:  |  Height:  |  Size: 179 KiB

BIN
public/images/stacking-dynamic-minimum.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 KiB

BIN
public/images/stacking-illustration.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 150 KiB

After

Width:  |  Height:  |  Size: 126 KiB

BIN
public/images/stx-microblocks.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 28 KiB

10
src/pages/understand-stacks/mining.md

@ -15,9 +15,9 @@ This guide highlights some technical details related to mining on the Stacks 2.0
A new Stacks block may be mined once per Bitcoin block. To be considered for mining a block, a miner must have a block commit included in a Bitcoin block. If a miner wishes to update their commitment after submission, they may use Bitcoin Replace-By-Fee. A new Stacks block may be mined once per Bitcoin block. To be considered for mining a block, a miner must have a block commit included in a Bitcoin block. If a miner wishes to update their commitment after submission, they may use Bitcoin Replace-By-Fee.
## Coinbase Rewards ## Coinbase rewards
Miners receive coinbase rewards for blocks they mine. Miners receive coinbase rewards for blocks they win.
The reward amounts are: The reward amounts are:
@ -38,11 +38,11 @@ For transactions mined in microblocks, the miner that produces the microblock re
## Reward maturity ## Reward maturity
Miner rewards, that is, block rewards and transaction fees take 100 blocks on the bitcon blockchain to mature. After successful mining a block your rewards will appear in the Stacks account after ~24 hours. Block rewards and transaction fees take 100 blocks on the Bitcoin blockchain to mature. After successfully mining a block your rewards appear in your Stacks account after ~24 hours.
## Mining with Proof-of-Transfer ## Mining with proof-of-transfer
Miners commit Bitcoin to **two** addresses in every leader block commit. The amount committed to each address must be the same. The addresses are chosen from the current reward set of Stacking participants. The choice of addresses is done using a verifiable-random-function, and determining the correct two addresses for a given block requires monitoring the stacks chain. Miners commit Bitcoin to **two** addresses in every leader block commit. The amount committed to each address must be the same. The addresses are chosen from the current reward set of stacking participants. Addresses are chosen using a verifiable-random-function, and determining the correct two addresses for a given block requires monitoring the Stacks chain.
![mining with pox](/images/pages/mining-with-pox.png) ![mining with pox](/images/pages/mining-with-pox.png)

35
src/pages/understand-stacks/proof-of-transfer.md

@ -9,28 +9,31 @@ images:
## Overview ## Overview
Consensus algorithms for public blockchains require computing or financial resources to secure the blockchain. The idea being to make it practically infeasible for any single malicious actor to have enough computing power or ownership stake to attack the network. 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.
Mining mechanisms used by these algorithms are broadly divided into proof-of-work, in which nodes dedicate computing resources, and proof-of-stake, in which nodes dedicate financial resources to participate in the [consensus algorithm](/understand-stacks/stacking#stacking-consensus-algorithm). 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.
A variant of proof-of-work is proof-of-burn where miners compete by ‘burning’ (destroying) a proof-of-work cryptocurrency as a proxy for computing resources. Proof-of-burn is a novel consensus mechanism where miners compete by ‘burning’ (destroying) a proof-of-work cryptocurrency as a proxy for computing resources.
Proof-of-transfer (PoX) is a new mining mechanism, that generalizes the concept of proof-of-burn. PoX uses the proof-of-work cryptocurrency of an established blockchain 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. Proof-of-transfer (PoX) is an extension of the proof-of-burn mechanism. PoX uses the proof-of-work cryptocurrency of an established blockchain 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.
This allows network participants who are adding value to the new cryptocurrency network to earn a reward in a base cryptocurrency by actively participating in the consensus algorithm, PoX encourages a model where there is one extremely secure proof-of-work blockchain, say Bitcoin. ![PoX mechanism](/images/pox-mechanism.png)
Other new blockchains can be anchored on the secure proof-of-work blockchain instead of introducing new proof-of-work chains. PoX has an interesting property where participants can earn payouts in a separate, potentially more stable, base cryptocurrency while participating in the new blockchain network. This can help solve a bootstrapping problem for new blockchains by providing incentives for early participants. Further, PoX has a potential use case for funding ecosystem developer funds. This allows network participants to secure the PoX cryptocurrency network and earn a reward in the base cryptocurrency. Thus, proof-of-transfer blockchains are anchored on their chosen proof-of-work chain. Stacks uses [Bitcoin](#why-bitcoin) as its anchor chain.
![proof-of-transfer](/images/proof-of-transfer.png)
![PoX participants](/images/pox-participants.png)
## Why Bitcoin? ## Why Bitcoin?
There are a multitude of reasons that Stacks chose Bitcoin as the blockchain to power consensus. It is one of the oldest blockchain protocols having launched in 2009, and has benefited from all the industry learnings that have occurred since that time. It is far and away the most valuable blockchain network, and BTC has held the highest market cap of any cryptocurrency for the past decade. 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.
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 proof-of-transfer consensus mechanism.
Bitcoin champions immutability, and has stood the test of time. It has been proven that influencing or attacking the network would be infeasible or impractical for any potential hackers. It is one of the only cryptocurrencies to bridge the mainstream chasm and gain immense public attention. Bitcoin is now a household name, and is being recognized by governments, large corporations, and legacy banking institutions. Lastly, Bitcoin has been cemented as a reliable store of value, and is the perfect infrastructure to plug into the proof-of-transfer consensus mechanism. 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).
![btc-stacks](/images/btc-stacks.png) ![btc-stacks](/images/pox-why-bitcoin.png)
## Blocks and Microblocks ## Blocks and microblocks
The Stacks blockchain allows for increased transaction throughput using a mechanism called microblocks. Bitcoin and Stacks progress in lockstep, and their blocks are confirmed simultaneously. On Stacks, this is referred to as an ‘anchor block’. An entire block of Stacks transactions corresponds to a single Bitcoin transaction. This significantly improves cost/byte ratio for processing Stacks transactions. Because of simultaneous block production, Bitcoin acts as a rate-limiter for creating Stacks blocks, thereby preventing denial-of-service attacks on its peer network. The Stacks blockchain allows for increased transaction throughput using a mechanism called microblocks. Bitcoin and Stacks progress in lockstep, and their blocks are confirmed simultaneously. On Stacks, this is referred to as an ‘anchor block’. An entire block of Stacks transactions corresponds to a single Bitcoin transaction. This significantly improves cost/byte ratio for processing Stacks transactions. Because of simultaneous block production, Bitcoin acts as a rate-limiter for creating Stacks blocks, thereby preventing denial-of-service attacks on its peer network.
@ -38,15 +41,15 @@ However, in between Stacks anchor blocks settling on the Bitcoin blockchain, the
![stx-microblock](/images/stx-microblocks.png) ![stx-microblock](/images/stx-microblocks.png)
## Unlocking Bitcoin Capital ## Unlocking Bitcoin capital
Stacks also unlocks the over $1+ trillion in capital that exists in the Bitcoin ecosystem, and gives Bitcoiners new opportunities to use and earn BTC. Bitcoin invented the art of the “HODL”, and Bitcoiners are watching and waiting for interesting applications to be built that expand BTC’s usability. Stacks made the deliberate design decision to not create a totally independent network, and instead take advantage of the preexisting network effect of Bitcoin. Stacks also unlocks the hundreds of billions in capital in Bitcoin, and gives Bitcoiners new opportunities to use and earn BTC. Stacks is a accompaniment to the Bitcoin ecosystem, and the two networks working in tandem enables totally novel ways of using BTC. The Stacks ecosystem makes interactive cryptocurrency applications available to Bitcoin holders. Additionally, By stacking STX tokens and participating in the PoX consensus mechanism, users have the opportunity to earn BTC while securing the Stacks chain.
In this way, Stacks is an accessible accompaniment to the Bitcoin ecosystem, and the two networks working in tandem enables totally novel ways of using BTC. The dApp and DeFi ecosystem burgeoning on Stacks will encourage less active BTC addresses to begin experimenting with interactive applications of cryptocurrency. By locking up STX on the network and participating in the Stacking mechanism, users have the opportunity to earn a familiar, native currency like BTC while also enriching the Stacks protocol. ![Unlocking Bitcoin](/images/pox-unlocking-btc.png)
## Clarity and the Bitcoin State ## Clarity and the Bitcoin state
Clarity smart contracts also have unique visibility into the state of the Bitcoin blockchain. This means that contract logic in a Clarity file has the ability to trigger when specific Bitcoin transactions have been confirmed. Clarity smart contracts have a built in Simple Payment Verification (SPV) proofs for Bitcoin that make interacting with Bitcoin’s state much simpler for developers. Additionally, Clarity contracts will potentially fork with the original Bitcoin chain. Therefore, in an edge case where Bitcoin forks, developers wouldn’t have to worry about adjusting the deployment of their smart contracts. Clarity smart contracts also have unique visibility into the state of the Bitcoin blockchain. This means that contract logic in a Clarity file has the ability to trigger when specific Bitcoin transactions are confirmed. Clarity smart contracts have a built in Simple Payment Verification (SPV) proofs for Bitcoin that make interacting with Bitcoin’s state much simpler for developers. Additionally, Clarity contracts can fork with the original Bitcoin chain. Therefore, in an edge case where Bitcoin forks, developers wouldn’t have to worry about adjusting the deployment of their smart contracts.
## See also ## See also

59
src/pages/understand-stacks/stacking.md

@ -17,12 +17,12 @@ Stacking is a built-in action, required by the "proof-of-transfer" (PoX) mechani
The Stacking mechanism can be presented as a flow of actions: The Stacking mechanism can be presented as a flow of actions:
![stacking flow](/images/stacking-illustration.png) ![Stacking flow](/images/stacking-illustration.png)
1. Make API calls to get details about the upcoming reward cycle 1. Make API calls to get details about the upcoming reward cycle
2. For a specific Stacks account, confirm eligibility 2. For a specific Stacks account, confirm eligibility
3. Confirm the BTC reward address and the lockup duration 3. Confirm the BTC reward address and the lockup duration
4. The transaction is broadcasted and the Stacks (STX) tokens will be locked-up. This needs to happen before the prepare phase of the next reward cycle (last 100 bitcoin blocks of the ongoing reward phase) 4. The transaction is broadcasted and the STX tokens are locked. This needs to happen before the prepare phase of the next reward cycle, the last 100 Bitcoin blocks of the ongoing reward phase
5. The Stacking mechanism executes reward cycles and sends out rewards to the set BTC reward address 5. The Stacking mechanism executes reward cycles and sends out rewards to the set BTC reward address
6. During the lockup period, details about unlocking timing, rewards and more can be obtained 6. During the lockup period, details about unlocking timing, rewards and more can be obtained
7. Once the lockup period is passed, the tokens are released and accessible again 7. Once the lockup period is passed, the tokens are released and accessible again
@ -42,12 +42,12 @@ If you would like to implement this flow in your own wallet, exchange, or any ot
The Stacking flow is different for delegation use cases: The Stacking flow is different for delegation use cases:
![stacking flow](/images/stacking-delegation-illustration.png) ![Delegated tacking flow](/images/stacking-delegation-illustration.png)
- Before Stacking can be initiated for a token holder, the delegator needs to be granted permission to Stack on behalf of the account owner. The permission is restricted to the maximum amount the delegator is allowed to Stack. The maximum amount is not limited by the available funds and can be set much higher. An account can only be associated with one single delegator - Before Stacking can be initiated for a token holder, the delegator needs to be granted permission to Stack on behalf of the account owner. The permission is restricted to the maximum amount the delegator is allowed to Stack. The maximum amount is not limited by the available funds and can be set much higher. An account can only be associated with one single delegator
- The account has to define the delegation relationship. They can optionally restrict the Bitcoin reward address that must be used for payouts, and the expiration burn block height for the permission, thus limiting the time a delegator has permission to Stack - The account has to define the delegation relationship. They can optionally restrict the Bitcoin reward address that must be used for payouts, and the expiration burn block height for the permission, thus limiting the time a delegator has permission to Stack
- Delegators have to lock Stacks from different accounts ("pooling phase") until they reach the minimum amount of Stacks required to participate in Stacking - Delegators have to lock Stacks from different accounts ("pooling phase") until they reach the minimum amount of Stacks required to participate in Stacking
- Once a delegator locks enough STX tokens, they can finalize and commit their participation in the next reward cycle(s) - Once a delegator locks enough STX tokens, they can finalize and commit their participation in the next reward cycle
- Certain delegation relationships may allow the STX holder to receive the payout directly from the miner (step 5/6) - Certain delegation relationships may allow the STX holder to receive the payout directly from the miner (step 5/6)
- The termination of the delegation relationship can either happen automatically based on set expiration rules or by actively revoking delegation rights - The termination of the delegation relationship can either happen automatically based on set expiration rules or by actively revoking delegation rights
@ -58,42 +58,51 @@ If you would like to implement this flow in your own wallet, exchange, or any ot
## PoX mining ## PoX mining
PoX mining is a modification of Proof-of-Burn (PoB) mining, where instead of destroying the committed Bitcoin, it is transferred to eligible Stacks (STX) holders that participate in the Stacking protocol. PoX mining is a modification of Proof-of-Burn (PoB) mining, where instead of sending the committed Bitcoin to a burn address, it's transferred to eligible STX holders that participate in the stacking protocol.
-> A PoX miner can only receive newly minted Stacks (STX) tokens when they transfer bitcoin to eligible owners of Stacks (STX) tokens -> A PoX miner can only receive newly minted STX tokens when they transfer Bitcoin to eligible owners of STX tokens
Miners have to run a software (mining client, aka "miner") on their machines to participate in the PoX mechanism. The mining client implements the PoX mechanism, which ensures proper handling and incentives through four key phases: ![Mining flow](/images/pox-mining-flow.png)
- Registration: Miners register for a future election by sending consensus data to the network Miners run Stacks nodes with mining enabled to participate in the PoX mechanism. The node implements the PoX mechanism, which ensures proper handling and incentives through four key phases:
- Commitment: Registered miners transfer bitcoin to participate in the election. Committed bitcoin are sent to a set eligible Stacks (STX) tokens holders
- Election: A verifiable random function chooses one miner to write a new block on the Stacks blockchain - Registration: miners register for a future election by sending consensus data to the network
- Assembly: The elected miner writes the new block and collects rewards in form of new Stacks (STX) tokens - Commitment: registered miners transfer Bitcoin to participate in the election. Committed BTC are sent to a set participating STX token holders
- Election: a verifiable random function chooses one miner to write a new block on the Stacks blockchain
- Assembly: the elected miner writes the new block and collects rewards in form of new STX tokens
[@page-reference | inline] [@page-reference | inline]
| /start-mining/mainnet, /start-mining/testnet | /start-mining/mainnet, /start-mining/testnet
## Token holder eligibility ## Token holder eligibility
Stacks (STX) token holders do not automatically receive Stacking rewards. Instead, they must: Stacks (STX) token holders don't automatically receive stacking rewards. Instead, they must:
- Commit to participation before a reward cycle begins - Commit to participation before a reward cycle begins
- At the time of writing: Hold ~70,000 Stacks (STX) tokens - or pool with others to reach the minimum - Commit the minimum amount of STX tokens to secure a reward slot, or pool with others to reach the minimum
- Lock up Stacks (STX) tokens for a specified period - Lock up STX tokens for a specified period
- Set a supported Bitcoin address to receive rewards (native segwit is not supported) - Provide a supported Bitcoin address to receive rewards (native segwit is not supported)
The following diagram describes how the minimum STX tokens per slot is determined. More information on
[dynamic minimums for stacking](https://stacking.club) is available at stacking.club.
![Dynamic minimum for individual eligibility](/images/stacking-dynamic-minimum.png)
Token holders have a variety of providers and tools to support their participation in Stacking. The Stacks website contains a [list of stacking providers and pools](https://stacks.org/stacking#earn).
Token holders will have a variety of providers and tools to support their participation in Stacking. Current providers, including 1-click options, pools, and more can be found [here](https://stacks.org/stacking#earn). ## Stacking in the PoX consensus algorithm
## Stacking consensus algorithm Stacking is a built-in capability of PoX and occurs through a set of actions on the Stacks blockchain. The [full proof-of-transfer implementation details](https://github.com/blockstack/stacks-blockchain/blob/develop/sip/sip-007-stacking-consensus.md) are in SIP-007. Below is a summary of the most relevant actions of the algorithm.
Stacking is a built-in capability of PoX and is realized through a set of actions on the Stacks 2.0 network. The full implementation details can be found in [SIP-007](https://github.com/blockstack/stacks-blockchain/blob/develop/sip/sip-007-stacking-consensus.md). Below is a summary of the most relevant actions of the algorithm. ![PoX cycles](/images/pox-cycles.png)
- Progression in Stacking consensus happens over reward cycles (with a fixed length). In each reward cycle, a set of Bitcoin addresses are iterated over - Stacking happens over reward cycles with a fixed length. In each reward cycle, a set of Bitcoin addresses associated with stacking participants receive BTC rewards
- A reward cycle consists of two phases: prepare and reward - A reward cycle consists of two phases: prepare and reward
- During the prepare phase, miners decide on an anchor block and a reward set. Mining any descendant forks of the anchor block requires transferring mining funds to the appropriate reward addresses. The reward set is the set of Bitcoin addresses which will receive funds in the reward cycle - During the prepare phase, miners decide on an anchor block and a reward set. Mining any descendant forks of the anchor block requires transferring mining funds to the appropriate reward addresses. The reward set is the set of Bitcoin addresses which are eligible to receive funds in the reward cycle
- Miners register as leader candidates for a future election by sending a key transaction that burns cryptocurrency (proof-of-burn). The transaction also registers the leader's preferred chain tip (must be a descendant of the anchor block) and commitment of funds to 2 addresses from the reward set - Miners register as leader candidates for a future election by sending a key transaction that burns cryptocurrency. The transaction also registers the leader's preferred chain tip (must be a descendant of the anchor block) and commitment of funds to 2 addresses from the reward set
- Token holders register for the next rewards cycle by broadcasting a signed message that locks up associated Stacks (STX) tokens for a protocol-specified lockup period, specifies a Bitcoin address to receive the funds, and votes on a Stacks chain tip - Token holders register for the next rewards cycle by broadcasting a signed message that locks up associated STX tokens for a protocol-specified lockup period, specifies a Bitcoin address to receive the funds, and votes on a Stacks chain tip
- Multiple leaders can commit to the same chain tip. The leader that wins the election and the peers who also burn for that leader collectively share the reward, proportional to how much each one burned - Multiple leaders can commit to the same chain tip. The leader that wins the election and the peers who also burn for that leader collectively share the reward, proportional to how much each one burned
- Token holders' locked up tokens automatically unlock as soon as the lockup period is completed - Token holders' locked up tokens automatically unlock as soon as the lockup period finishes
## Stacking contract ## Stacking contract
@ -101,9 +110,9 @@ Check out the [Stacking contract reference](/references/stacking-contract) to se
## Bitcoin address ## Bitcoin address
!> You must provide a BTC address in one of two formats: [Legacy (P2PKH)](https://en.bitcoin.it/wiki/Transaction#Pay-to-PubkeyHash), which starts with "1". Or, [Segregated Witness / Segwit (P2SH)](https://en.bitcoin.it/wiki/Pay_to_script_hash), which starts with "3". The "Native Segwit" format (which starts with "bc1"), for example, is not supported. !> You must provide a BTC address in one of two formats: [Legacy (P2PKH)](https://en.bitcoin.it/wiki/Transaction#Pay-to-PubkeyHash), which starts with `1`. Or, [Segregated Witness / Segwit (P2SH)](https://en.bitcoin.it/wiki/Pay_to_script_hash), which starts with `3`. The "Native Segwit" format (which starts with "bc1"), for example, is not supported.
The Stacking contract needs a special format for the bitcoin address (the reward address). This is required in order to ensure that miners will be able to correctly construct the bitcoin transaction containing the reward address. The Stacking contract needs a special format for the Bitcoin address (the reward address). This is required to ensure that miners are able to correctly construct the Bitcoin transaction containing the reward address.
The address must be specified in the following format using the Clarity language: The address must be specified in the following format using the Clarity language:

Loading…
Cancel
Save