Exploring the Depths of Stacks Proof of Transfer: Insights from Ortege Lakehouse Datasets

What is Stacks Proof of Transfer 3?

Stacks Proof of Transfer 3 (PoX 3) consensus mechanism represents an innovative layer built on top of the Bitcoin blockchain, introducing a unique way to secure the network and distribute rewards. Unlike traditional Proof of Work (PoW) or Proof of Stake (PoS) mechanisms, PoX leverages Bitcoin as a base layer for security and consensus. In PoX 3, Stacks (STX) holders can participate in the network by "stacking," or locking up their STX tokens, to actively support network consensus.

In return for their contribution, stackers earn rewards directly in Bitcoin, creating a direct economic link between the Stacks and Bitcoin blockchains. This mechanism not only enhances network security but also fosters a symbiotic relationship between the two ecosystems, leveraging Bitcoin's unmatched security while adding functionality and enabling smart contracts on the Stacks side.

The PoX 3 mechanism allows for various forms of participation, including solo stacking, delegated stacking, and aggregate stacking, accommodating a wide range of contributors from individual STX holders to larger pooling entities. This flexibility ensures broad community involvement and decentralized consensus.

How to Analyze PoX datasets
with Ortege Lakehouse

In the process of data management and analysis within the Stacks blockchain ecosystem, we begin at the Bronze layer, where every transaction recorded on the Stacks network is meticulously cataloged in the db_stacks.tbl_prod_br_transactions table.

This foundational layer is rich with transactional data but can appear complex due to its comprehensive nature. Transactions at this level encompass a variety of types, including smart contract deployments, contract calls, STX mining rewards (coinbase transactions), STX token transfers, and poison microblock events. Each transaction type serves a specific purpose, from deploying new smart contracts to transferring tokens, thereby capturing the full spectrum of network activity.

What Are Cycles in the Stacks Network?

Cycles in Stacks are defined in relation to Bitcoin blocks, taking advantage of the predictable nature of Bitcoin's block production, which occurs approximately every ten minutes. The initiation of these cycles began with Cycle 0, starting at Bitcoin block 666,050, with each cycle spanning 2,100 Bitcoin blocks, or roughly 14.58 days.

How Can Stacks' Cycles Be Analyzed for Transaction Data?

To facilitate the analysis of these cycles and their impact on transactions within the Stacks network, a dedicated table, db_stacks.tbl_prod_br_cycles , was created. This table houses crucial information, including the start and end blocks for each cycle, along with the corresponding dates and times. The purpose of structuring the data in this manner is to provide a clear framework for querying transactional data. By referencing this table, users can easily determine the specific Stacks cycle a transaction falls into, enhancing the ability to perform detailed analyses based on temporal parameters.

Important to note: When you initiate stacking and specify a start burn bitcoin block number, if this height falls within an ongoing reward cycle, your participation and potential rewards do not start immediately but instead will begin at the start of the next full reward cycle. Rewards are not pro rated.

Silver layer

Our focus now narrows to the sophisticated dynamics of the Proof of Transfer 3 (PoX 3) smart contract transactions. By zeroing in on contract calls—interactions with the PoX 3 smart contract—we abstract away the initial complexities found in the Bronze layer. This focused approach allows us to sift through the diverse transaction types, setting aside those not pertinent to our current analysis, such as poison microblock transactions, and concentrating on those that directly impact PoX 3's functionality.

What is a Solo Stacker?

A solo stacker is an individual who participates in the stacking process independently. They lock a certain amount of Stacks (STX) tokens directly through the PoX smart contract to support network consensus and, in return, earn Bitcoin (BTC) rewards. Solo stackers have full control over their tokens, deciding when and how much to lock, and they must meet the minimum STX threshold required (at the time of writing ~72K STX) for stacking.

Key characteristics:

  • Operates independently without delegating to another party.
  • Must meet the minimum threshold of STX required for stacking.
  • Directly interacts with the PoX3 smart contract.

For Solo Stackers, comprehensive data has been consolidated into the db_stacks.tbl_prod_sl_pox3_stackers_solo database table.

This dataset includes several noteworthy elements:

  • Function Calls: The dataset encompasses various function calls such as stack-stx, stack-extend, and stack-increase, pivotal for understanding stacking actions.
  • BTC Rewards Address: Participants must specify a Bitcoin address to receive BTC rewards. This address is inputted as hashbytes with a version, labeled as btc_rewards_address_undecoded in our dataset. Although not a direct BTC address, it's preserved for reference. The btc_rewards_address_decoded field represents the actual BTC address post-decoding, where rewards are sent.
  • Lock Periods and Unlock Burn Height: The stack-stx function includes a lock_period specifying the cycle duration for which STX are locked. We use unlock_burn_height emitted after a successful contract call and then find the cycle the STX is unlocked.
  • Stack Extension and Increase: The stack-extend function allows stackers to prolong their stacking duration by an additional cycle, as indicated by the extend_cycle field, with unlock_burn_height providing the timeline for when STX will be unlocked. Meanwhile, stack-increase tracks when additional STX are added to the lock, leveraging block dates for this purpose.
  • STX Amounts: It's crucial to note that all STX amounts are denominated in STX units, not microSTX (uSTX), for clarity and consistency in our analysis.
  • Cycles : We include both the start and the end cycle for the STX.

What is a Delegate Stacker?

A delegate stacker is someone who chooses to participate in stacking by delegating their STX tokens to another party (a delegator), who stacks on their behalf. This approach allows users who may not meet the minimum STX requirement for solo stacking to still participate in the rewards system by pooling their tokens with others.

Key characteristics:

  • Delegates STX tokens to another party for stacking.
  • Does not need to meet the minimum STX requirement individually.
  • Relies on a delegator to manage stacking participation and distribute rewards.

For Delegate Stackers, essential data is organized within the db_stacks.tbl_prod_sl_pox3_stackers_delegates database table.

Here are the key components and considerations of the dataset:

  • Function Calls: The dataset records delegate-stx, delegate-stack-extend  and delegate-stack-stx function calls. It's crucial to understand that delegate-stx represents an agreement, allowing a delegate to stack on behalf of the user. However, this does not guarantee stacking actions will occur. Actual stacking is executed through the delegate-stack-stx call.
  • Delegate To: This field identifies who will stack the STX on behalf of the wallet. We don't use the term stacker as oftentimes people will confuse delegate and delegator as both being Stackers.
  • BTC Rewards Address: Similar to the Solo Stackers, this dataset includes btc_rewards_address_undecoded and btc_rewards_address_decoded fields to manage BTC rewards addresses, following the same procedure for decoding and utility.
  • Burn Heights: The concepts of start_burn_height and until_burn_height are aligned with those used for Solo Stackers, detailing the commencement and conclusion of the stacking period.
  • STX Amounts: All quantities of STX are represented in their standard unit, STX, rather than microSTX (uSTX), ensuring consistency across the dataset.
  • Cycles : We include both the start and the end cycle for the STX.

What are Aggregate Stackers?

Aggregate stackers refer to the collective participation of multiple STX holders who pool their tokens together to meet the minimum stacking threshold. This can be facilitated through a delegator, who aggregates STX from various holders into a single stacking entry. The concept encompasses both those who delegate their tokens and the entity that organizes the aggregated stacking.

Key characteristics:

  • Involves pooling of STX tokens from multiple holders.
  • Facilitated by a delegator who manages the pooled tokens for stacking.
  • Allows participants to earn rewards without individually meeting the minimum threshold.

For Delegate Stackers, we have meticulously gathered all pertinent information within the db_stacks.tbl_prod_sl_pox3_stackers_delegates database table.

Here are the critical points to note about this dataset:

  • STX Denomination: All amounts within this dataset are represented in STX, not microSTX (uSTX), to maintain clarity and uniformity across the data.
  • Function Calls: The dataset incorporates specific function calls relevant to delegate stackers, namely stack-aggregation-commit and stack-aggregation-commit-indexed. These function calls are essential for understanding the mechanics of delegate stacking, where stackers commit their STX to be pooled and stacked collectively.

How to Analyze BTC rewards on the Stacks Network

To delve into the BTC rewards destined for stackers, our focus shifts to analyzing the Bitcoin-related data housed in db_btc.tbl_prod_sl_l2_stacks. This dataset is pivotal for understanding the Bitcoin transactions committed by STX miners as rewards for stackers.

Key aspects:

  • Transaction Types: Among various transaction types such as Other, stack-STX, vrf, transfer-STX, and commit, our primary interest lies in the "commit" transactions. These are the transactions where STX miners commit Bitcoin to be distributed as rewards to stackers.
  • Commit Column: This boolean column is essential for identifying transactions where miners commit BTC. It helps distinguish between different kinds of transactions submitted by STX miners, including:
    • The OP_RETURN output transactions, signaling the intent to commit BTC as a miner.
    • Transactions that actually commit the BTC to stackers.
    • Transactions indicating the "change" being returned to the miner's wallet. Specifically, the commit column flags the change and OP_RETURN transactions as false, focusing solely on the transactions where BTC is committed.
  • Burnt Column: Another critical column is burnt, indicating whether the committed BTC was sent to a burn address (specified as 1111111111111111111114oLvT2). This detail is crucial for understanding the final disposition of the committed BTC.

With this structured approach to the Bitcoin tables, we can accurately determine the amount of BTC allocated to stackers per cycle. This granular analysis forms the backbone of our Silver tables, enabling a comprehensive understanding of how much STX is stacked and the corresponding BTC rewards distributed, thereby enhancing our insights into the stacking process and the economic incentives it entails.

Gold layer

The Gold layer in our data pipeline presents an evolved phase of data refinement, where we draw on insights curated from the Silver layer. Here, we integrate and crystallize information into the vw_prod_gld_pox3_stackers_all view, which captures stacker activity across various types, denoted by the stacking_type identifier. Within this view, we consciously omit the delegate-stx function calls to distinguish between mere delegation approvals and actual committed STX.

We've also refined the representation of reward cycles. Unlike the Silver layer, which marks the commencement and conclusion of stacker engagement, the Gold layer disaggregates this data, assigning an individual record for every cycle within a stacker's activity span. For instance, a stacker's transaction extending from cycle 65 to 70 would manifest as six distinct entries, each corresponding to a single cycle's engagement.

In addition to stack quantities, this view integrates the average STX pricing data within the cycle timeframe, alongside the corresponding USD valuation of the STX commitment. This nuanced financial perspective not only anchors the data in real-world currency equivalencies but also sets the stage for the subsequent view: vw_prod_gld_pox3_all.

The vw_prod_gld_pox3_all view serves as a pivotal analytical tool, differentiating between Bitcoin rewards and STX transactions on the Stacks network. It also includes direct transaction URLs, providing an accessible gateway to transaction explorers. Both BTC and STX addresses are detailed, together with currency amounts, cycle relevance, and average pricing, culminating in a comprehensive USD conversion.

This meticulous data architecture is indispensable for calculating Annual Percentage Rates (APRs), enabling us to traverse beyond raw data towards actionable financial insights across varying cycles and timeframes.

In closing, the Stacks Proof of Transfer 3 (PoX 3) mechanism is an innovative layer atop Bitcoin's blockchain, enabling a secure network and a unique rewards system. Our data analysis journey through the Bronze, Silver, and Gold layers offers a comprehensive view of transactions and cycles, facilitating a deep dive into the intricate dynamics of the PoX 3 smart contract. With the detailed Gold layer, we calculate APRs, providing stakeholders with valuable financial insights and the ability to trace, measure, and predict the economic ramifications within the Stacks ecosystem.