Replies: 12 comments 31 replies
-
What an amazing post, I'm so excited for things to come. Does your point around
This would be an amazing primitive. I haven't actually begun writing Clarity code, but I've been looking into the work required. At the moment I don't have reason to believe it's not possible today in Clarity, but I can see that a native primitive might be more robust. If I was going to write a verifier, I'd probably start with a few happy paths that cover obvious use cases, but a verifier for all burnchain transactions is probably better done in Rust. Having read a few other verification implementations, there is usually some looping involved. Still, probably not non-deterministic, but I don't really know. I also have some other random thoughts around potential Clarity improvements. Is the best place for a suggestion the stacks-blockchain repo (tagged as 2.1), or the Clarity repo? |
Beta Was this translation helpful? Give feedback.
-
These proposed changes look great to me -- I just want to add here what the priorities for 2.1 are from Hiro's perspective: Stacking / PoX Contract
BNS
Clarity
|
Beta Was this translation helpful? Give feedback.
-
We can't predict if nor when flash blocks appear, and we can't eliminate them, so maybe we could set up a boundary below which we would consider block as being "flash" and like you proposed don't count them in calculation. For example, if the time between mining of two blocks That way if suddenly we'll have a technological breakthrough and hashpower skyrocket, we'll survive until next BTC difficulty adjustment. |
Beta Was this translation helpful? Give feedback.
-
Why is that? What is the purpose of Stacking? Does stacking for more than once cycle helps the network? Should one long stacking period by one user rewarded more than several short stacking period by another user? Stacking distributes block rewards between stackers and miners. Stacking also let stackers indirectly vote on chaintips. It would expect stackers to have a more meaningful role in the consensus than optimize for APY. |
Beta Was this translation helpful? Give feedback.
-
Regarding in-band signaling, it would be best to try and implement them as part of the prepare-phase (so miners must burn, and the decisions are all visible regardless of Stacks block availability). Also, we could add a SIP for just signaling support for various upgrades -- possibly off-chain. |
Beta Was this translation helpful? Give feedback.
-
Great summary Jude! I don't have much to add beyond the comments already given. I would love to see continuous stacking & multiple stacking commitments for one principal (already discussed & confirmed here: #8). I don't know if the following is technically feasible, but another wish would be access to bitcoin without having to use wrapped bitcoin. E.g. through a timelock with multisig it would be possible to be one of the signers of a bitcoin transaction, and this would give control over the bitcoin or allows a smart contract to check whether bitcoin is locked or not. This way (e.g. in Arkadiko), you could create a stablecoin collateralised by bitcoin without it leaving the bitcoin blockchain. I imagine there are lots of other use cases with this. Thinking out loud here, so not sure if this logic makes sense. Ultimately, bitcoiners don't necessarily want their bitcoin to leave the bitcoin blockchain, even if it's a sidechain like Stacks. A trustless wrapped bitcoin would be a good alternative tho. |
Beta Was this translation helpful? Give feedback.
-
Could we get support for accessing the Bitcoin blockchain from smart contracts? I think it's pretty important since we are bringing smart contracts to Bitcoin, it should be able to interact with the native chain. |
Beta Was this translation helpful? Give feedback.
-
Better BNS: make names SIP-009 compliant. |
Beta Was this translation helpful? Give feedback.
-
As promised, I did a study on how hard it would be to build a Clarity library that could:
TL;DR You can totally do this today! Code: https://github.com/jcnelson/clarity-bitcoin Lessons Learned
EDIT: Watching other efforts, let's add the following:
|
Beta Was this translation helpful? Give feedback.
-
what about native segwit support? |
Beta Was this translation helpful? Give feedback.
-
Lower barrier of entry for STX mining The current part of the protocol for mining has an incentive to reduce btc tx fees. This leads to less miner nodes because the higher your commits per tx, the smaller your extra costs for your bids. Proposal: Use equally distributed fees as part of the sortition for each miner Example A:
Example B:
Advantage Disadvantage |
Beta Was this translation helpful? Give feedback.
-
can we get BLAKE3 support in Clarity? |
Beta Was this translation helpful? Give feedback.
-
SUPERSEDED
Hey folks, please see this discussion instead for a much more detailed breakdown of what's going into 2.1: stacks-network/stacks-core#3096
The text below is preserved for informational purposes, but the above discussion supersedes it.
Hey everyone,
We're trying to figure out what exactly should go into Stacks 2.1. We're not at the point where we feel like we can open fine-grained issues and implementation proposals (except for bugfixes, under the "Stacks 2.1" tag in the Stacks blockchain repository), but we have noticed some general themes:
Stacking Improvements
While the blockchain is implemented consistent with SIP-007, there are some user experiences that could be better. Specific improvements include:
Continuous Stacking. There needs to be some way for Stackers to avoid missing a reward cycle in-between Stacking their STX.
Fine-grained bidding. Once you Stack your tokens for an upcoming reward cycle, you can increase the amount of STX you Stack in 50k increments. This threshold could be lower.
Unlock unused STX automatically. STX that get committed for Stacking should not get locked if they do not clinch a reward address slot.
Way back in August 2020 I had a proposal that addressed all three of these here. Other proposals are of course welcome.
Regardless of which proposal eventually gets merged to Stacks 2.1, it needs to be incentive-compatible with honest Stacking while fixing the above issues. That is, the strategy for Stacking in Stacks 2.1 that has the highest payout must be a strategy that permits users to be able to Stack (and pool) however much STX they want at any time, for whatever future reward cycles they desire (within reason). There shouldn't be any way to "game" Stacking.
Better In-band Upgrades
By design, there are numerous ways to soft-fork the Stacks blockchain. However, there are few areas where it could be improved:
Voting to stop the network. Stacks 2.1 is a pre-planned network upgrade (not to be confused with a hard fork). The Stacks 2.0 blockchain will die at Bitcoin block 700,000. However, I doubt that this is the last time the users will want to make backwards-incompatible changes to the network. So, I think there needs to be a way for miners and STX holders to vote on a "stop date" for the current version of the blockchain, such that developers have ample time to release an upgraded version of the blockchain with the new changes. So if there is ever a Stacks 2.2 release, it will only happen if STX holders and miners vote for it. This differs from voting for a hard fork, because if the vote passes, the current chain will die at a pre-determined block height (so there is no risk of an unforced chain split). Any new chain will simply pick up where the old chain left off.
Voting to extend the PoX sunset date. PoX does not (and cannot) last forever, because it is not incentive-compatible with mining in the long term. In case this leads to problems, the chain already supports Stackers voting to disable PoX in order to keep the chain alive. However, there is no mechanism to vote to extend PoX, should PoX prove more resilient than we anticipated. I think it may be worthwhile to make it so STX holders can vote to continue PoX past its targeted sunset date.
Voting on which contract is the PoX contract. I very much doubt that whatever happens in Stacks 2.1 is going to be perfect for all of eternity. I think there needs to be a way for miners and STX holders to be able to decide which contract gets used to execute PoX. That contract must conform to the PoX contract's interface (because the node needs to be able to do some bookkeeping internally whenever methods like
stack-stx
are called), but as long as a contract can be implemented with that trait, the users of the system can upgrade it.Better Clarity APIs
Clarity has native access to Bitcoin state, but its current APIs for reading with it are somewhat rudimentary. I think there's a lot of room for improvement here (most of which could be written in Clarity itself!), but there's a few things that would need to be done through a network upgrade. These include:
Expose PoX reward set info. The PoX contract could represent each reward cycle's list of Bitcoin reward addresses as a list, and keep track of whether or not the Bitcoin address has been up for payment by miners (and how much BTC has been received). I believe this would enable Clarity developers to write much more interesting and complex financial derivatives built on top of Stacking.
Handle PoX STX locking in Clarity. Right now, the node itself manages locking up STX internally. I think this should be moved into the PoX contract itself, so that (1) the locked/unlocked balances can be exposed to contracts, and (2) the lockup semantics can potentially be changed if we can make it so miners and users can vote to change the PoX contract.
Native Merkle proof verification. There should be a Clarity API that (1) defines a canonical representation for a Merkle proof that links a burnchain transaction to a burnchain block header hash, and (2) verifies that a given proof links a given transaction to the burnchain (I intentionally say "burnchain" because this could be Bitcoin, or another instance of the Stacks chain). This could potentially be written in Clarity, but I don't believe anyone has tried doing this yet. There needs to be a case study on how hard this would be to do, so we can figure out if there's anything missing from Clarity that would prevent someone from doing this.
get-block-info?
information. At a minimum, theget-block-info?
function should let Clarity code look up a Bitcoin or Stacks block hash from a Bitcoin or Stacks block height. I think this is all but required in order to implement Merkle proof verifications above.More Clarity Built-ins. There's no end of new things to add to Clarity to make it better. I think we should take advantage of the Stacks 2.1 upgrade to add a few of these. For example, there is already code written to add support for a
tx-sponsor
keyword (indicating the principle who sponsored the transaction; this is not alwaystx-sender
) and astx-transfer?
variant that includes a memo (which improves exchange integration).Reliability Improvements
There are a couple of things that could make mining and Stacking more reliable, but would require a network upgrade to achieve. These include:
Fix mean-of-min-and-median sortition logic. The sortition weight a miner gets when mining STX is a function of how continuously they mine. This is intentional, because it raises the barrier to entry for discount-mining -- a behavior whereby a miner Stacks their STX in order to reduce the amount of BTC they need to spend to mine. Making it so a miner's sortition weight is a function of many block-commits increases the number of STX they must Stack in order to do this reliably. Right now, there is a bug in the way the mean-of-min-and-median is calculated, which causes a missed sortition to over-penalize a miner by reducing their commitment weight to the minimum amount. This should be fixed in 2.1.
Better tolerance for flash blocks in the prepare phase. A Bitcoin behavior we did not anticipate was the presence of flash blocks -- two or more Bitcoin blocks that arrive so quickly that Stacks miners don't have a chance to mine in them. If these happen in the PoX prepare phase, they reduce the quantity
F * w
, which is used to determine how much agreement exists between miners about the PoX reward set. If this value is less than 80%, then PoX is disabled for the subsequent reward cycle (see SIP-007 for details). I believe that flash blocks unfairly penalize the network's measurement ofF * w
-- I think that the first 10-ish flash blocks shouldn't count towards theF * w
calculation. This would make it far less likely that a flurry of Bitcoin mining activity doesn't accidentally shut down PoX, even though all Stacks miners are reliable.Order-independent multisig signing and verification. Right now, the Stacks transaction wire format implicitly requires signers to sign in the given public key order. This could be fixed so that the signing order does not matter, but it would be a breaking change.
EDIT:
I think all of the above could be written as a set of SIPs that describe the Stacks 2.1 blockchain (perhaps one per theme?). Please let us know what you'd like to see. Also, don't be afraid to add new ideas or suggestions for backwards-incompatible changes you'd like to see!
Best,
Jude
Beta Was this translation helpful? Give feedback.
All reactions