🖥️Manual and API Conversion

Two approaches to convert the BTC PoX yield into STX

In the following section, we will explore two similar PoX rewards conversion, the manual conversion and the API conversion.

Manual Conversion

Manual conversion assumes that the BTC is received on a custodial address owned by the LST protocol. This BTC is manually converted near the end of each PoX cycle and paid out manually to protocol Clarity smart contracts, which can further distribute this state based on the stacking position of each individual principal.

In the image above, we see the Stacks Miner sending BTC PoX rewards into the LST Protocol Owned Bitcoin PoX wallet (rewards wallet). This wallet could be a single sig or multi sig wallet. As an example, the wallet now contains 0.4 BTC, and say we have reached the end of the current PoX cycle. That means, the PoX rewards need to be paid out to the liquid stackers (on the Clarity side).

The team that controls the rewards wallet can now initiate a transaction to swap BTC to STX through any service that supports it. An example service that has worked well is ChangeNow (https://changenow.io/). This service allows you to input an amount of BTC, shows you the amount of STX that will be received including the BTC address you should send the BTC amount to. After receiving the STX (either immediately in the smart contract or on a custodial Stacks address), each individual liquid stacker can claim their yield. Other services such as Binance CEX, Coinbase, Kraken or Bitswap (http://bitswap.so/) could be used as well.

Of course this solution has a few shortcomings. For starters, it requires manual work each PoX cycle. The owner of the rewards wallet should put in manual time and work to convert the BTC into STX. On top of that, all users of the liquid stacking protocol have to trust the person (or group of people) doing the right thing with the yield each cycle (and not run away with the yield). Note that only the yield can be stolen and the principal is always safe (dependant on the Clarity implementation of course).

We can however mitigate the centralisation risk around the trust that is needed in the Bitcoin yield wallet. As an example, the yield contract could always contain double the amount of yield of a given PoX cycle (in this case 0.8 sBTC). When users know that yield is one-way (i.e. anyone can deposit rewards into the yield contract, but only eligible recipients can withdraw), we know that the protocol has created a grace period of at least two weeks (i.e. 2 times 0.4 BTC yield on average). If the owner of the rewards wallet would steal, users still have around two PoX cycles to exit the protocol. Of course this requires extra liquidity since you would need more reserves than just the incoming PoX yield.

Another nice addition to provide transparency would be to build a Clarity contract that reads the rewards address (remember that Clarity can read Bitcoin state) and show the incoming protocol yield in real-time to users of the protocol. This offers no protection against centralisation but is a nice addition to the functionality of the protocol.

API Conversion

It is clear that waiting for the yield to arrive to the yield contract is a bit of an annoyance for the users. A solution could be putting the private keys of the rewards wallet behind an API and allow one API transfer endpoint to be called. This endpoint could consume the UTXOs that have come in so far and trigger a transaction with ChangeNow or Bitswap to automatically turn the BTC into STX whenever a user calls this API endpoint. Of course we can add some Denial-of-Service attack protection and set a minimum amount of BTC in the wallet before a conversion happens (to not overload the amount of transactions, ending up paying too many fees).

It is clear that this is an improvement, although only an incremental one. Nonetheless, it would require a bit less trust in the rewards wallet owners since anyone can call this API endpoint multiple times during a PoX cycle to claim their ongoing rewards. The API hosting is still centralised and the wallet is still owned by a small set of people, but the ease of swapping has been made a lot easier.

Last updated