Replies: 2 comments 4 replies
-
@jcnelson , thanks for putting this together!
Totally agreed. The way I would solve is to not rely on any specific slot size, and instead only do this in "chunks" of say 1mm STX. I've done research on the optimal chunk size for economic efficiency based on various slot minimums, and I think it's around 1.5mm. You still end up having complexity regarding how many STX the principal can unlock based on the final slot minimum. In my opinion, it's OK to not allow this STX to be unlockable, because the pool users would need to signal their desire to unlock in the next cycle. I admit having this kind of exception doesn't help with complexity. I do agree that using sub-contracts is a potential way to solve for this issue, and that this could technically be done today. However, any solution would be best designed for 2.1 (with Following your described solution, you'd still end up needing a fixed "chunk" size of STX per sub-contract. Otherwise, you end up in a scenario where some sub-contract has locked STX, and in the next cycle that sub-contract needs to move some of it's STX to a different contract in order to be stacked. Ex:
I still agree that having sub-contracts is the next best option, if a principal stacking to multiple reward addresses is not an option. |
Beta Was this translation helpful? Give feedback.
-
I spoke more with @kantai about this. If you're still open to the |
Beta Was this translation helpful? Give feedback.
-
I had a question from @hstove about the possibility of adding a multi-stack operation in pox-2. Essentially, the function would permit stacking a given amount of uSTX to a list of PoX addresses on one go. I'm making my assessment public, since it's pertinent to the community.
The proposed interface is
This was a topic we talked about in person at Bitcoin Unleashed 2022. The purpose of a multi-stack operation is to make it so a stacking pool operator can rent out their reward slots to users, and stack the pool's STX to its users' PoX addresses. Having had time to digest the proposal, I'm writing my thoughts down here.
So, the challenge with doing something like
(multi-stack-stx)
natively is that there doesn't seem to be a good way to deal with the (very likely) case of when the reward slot size changes at the last minute. I can think of different conflicting ways to handle this case, but none appear to be the right thing to do 100% of the time.For example, suppose I have 10 million STX I'm stacking, and the reward slot minimum is 100,000 STX. So, I'd expect to get 100 reward slots at the time I send my transaction, which means I'd supply a 100-item list for
pox-addrs
to have them each stack 100,000 STX. But then suppose at the last minute, the stacking minimum gets bumped to 110,000 STX. What's supposed to happen?Does the whole operation fail to lock any STX? Each address's
amount-ustx
could be beneath the stacking threshold if it were applied, so this is a plausible behavior.Does the whole operation succeed, but lock the STX in a useless way? 100 addresses with 100,000 STX locked into them will receive zero BTC yield. It's not clear who would have the right to call
(stacks-unlock)
in this case.Does the operation partially succeed? Suppose that the act of stacking the caller's STX is what pushes the stacking minimum to 110,000 STX (like, what if the 50th item in the list of 100 addresses is what pushes the global threshold over). Do some entries in the list clinch a reward slot, and others not?
My counter-proposal to this was to implement the pool as a set of contracts: one contract to manage rentals, and a set of sub-contracts to perform the stacking with the pool's STX. The sub-contracts can only be called by the manager contract, and are indirectly called by the renter to stack the pool's STX. The flow would look like this:
Make the user rent the STX, not the reward slot. Then, it's up to the user how much STX they think will be needed to secure the desired number of reward slots. The management contract sets a per-STX rental fee (e.g. pay 1 STX to rent 100 STX or something).
When the user secures the right to borrow the STX from the pool contract (i.e. pays the rental fee; is the highest bidder; etc. -- however this works), the user calls a function in the pool contract that does the following:
Authenticates the user by verifying that they paid the rental fee for the STX they want to use in this upcoming cycle.
Reclaims the requisite STX from "fallow" sub-contracts that hold STX from a previous renter, but are not stacked (such as by a
(stacks-unlock)
call or a(stx-transfer?)
call that transfers the STX from the sub-contract back to the management contract).Find and allocate an unused sub-contract to the user
Moves the requisite STX from the management contract to the sub-contract
Calls a function in the sub-contract to stack the STX. The sub-contract does the call to
(stack-stx)
via(as-contract)
so it, not the user, is the stacker. Note that this function is only accessible from within the management contract -- the user can't call this directly.As the reward cycle progresses, the user receives BTC if they clinch one or more reward slots. If they don't clinch a reward slot, then they're simply out the rental fee (and that's on them -- they should have rented more STX).
This could work today, and it's all self-service. This is because all STX movement and stacking happens within a contract-call transaction submitted by the user. There's no need for the pool operator to scatter/gather the STX, and no need for the pool operator to stack STX on the users' behalves.
Beta Was this translation helpful? Give feedback.
All reactions