Skip to content

Instantly share code, notes, and snippets.

@fernandonm
Last active November 25, 2021 17:35
Show Gist options
  • Save fernandonm/cb9f719b125d93fb84e0988917bdde2a to your computer and use it in GitHub Desktop.
Save fernandonm/cb9f719b125d93fb84e0988917bdde2a to your computer and use it in GitHub Desktop.
Soft pegged sidechains

Soft pegged sidechains

Sidechains have been the Holy Grail to scale and try new features on Bitcoin for a long time. But the trade-offs of the different proposals relying on Bitcoin modifications (SPV two-way peg, drivechains, etc) prevented them from being adopted.

Only proposals not requiring of any change to Bitcoin, like federated sidechains (e.g. Liquid Network), have seen some adpotion. Although they imply significant trust requirements.

I have always found in sidechains the most honest way to explore other applications of Bitcoin technology. E.g. Namecoin, a network with greater privacy, a distributed oracle, or a network with different trade-offs for high velocity money (low fees), etc. So I have tried (in multiple ocasions) to figure out a trust minimized solution for the two way peg problem that did not require changes to Bitcoin.

Statechains improve on federated sidechain trade-offs and could be considered state of the art on sidechains. Ruben Somsen, the inventor of this technology, has been revisiting the old idea of one-way peg sidechains with his P1WP proposal as well, and a few days ago, after exchanging a few tweets with him, I went back to think about this problem again.

Perpetual one-way pegged chains, are dependant on Bitcoin and allow an unbound flow of bitcoin to the sidechain. Whenever users consider one token of the sidechain is worth more than one bitcoin, they will be able to burn bitcoin and claim an equal amount of tokens in the sidechain.

I believe this time I may have identified two mechanisms that will help with one-way peg stability, allowing a soft pegged sidechain to behave closer to a trust-minimized two-way peg sidechain, so I decided to write it down to get some feedback.

1. Scarcity

We are all familiar with bitcoin scarcity, and it is commonly understood that increases in the demand of scarce assets drive their price up. The issuance of tokens in a perpetual one-way peg will only increase when price goes above bitcoin, so during periods of low demand it will become scarcer than bitcoin. Its total utility will not be diluted at all.

Sidechain tokens carry the risk of not being able to keep pace with bitcoin utility growth. But, if this risk is lower than bitcoin dilution, scarcity should push the price of the tokens towards the 1:1 peg.

In the long term, as bitcoin value stabilizes and its utility tracks productivity growth, any chain providing real value should be eligible to be implemented as a soft pegged sidechain.

2. Demurrage

The main issue with one-way pegs is the volatility of the convenience yield of the token, i.e. the utility of holding the token. If we let issuance to increase freely when tokens are in great demand, the moment demand decreases price will follow. Market discounts that risk as a cost of carry, depressing token price and preventing big expansions of supply, but perfect information doesn't exist, otherwise prices would not move up and down, so this will not be able to keep the peg stable.

To discourage even further the desire to hold tokens when supply is expanding (1 token > 1 bitcoin), I propose the introduction of demurrage as an additional cost of carry. It will make the cost of carry certain, clearly measurable and immediate for current owners before allowing supply to grow, incentivising them to sell tokens in the secondary market in order to increase the velocity of the existing supply. The sidechain will act as an account with negative interest rates.

Store of value utility of the tokens of a sidechain can be eroded when convenience yield of their specific utility is already forcing their supply to increase. Canceling increases in convenience yield with an equal cost will lead to an stable value for the tokens, while preserving most of the utility of the sidechain, that is intended to provide transactions with features unavailable in Bitcoin.

Let's see how this may work. Starting at 1000 tokens as the total supply in the sidechain and assuming 10% maximum demurrage before allowing supply to increase.

  • If 0.0005 btc is pegged-in at the next block, holders will suffer a 0.00005% demurrage (0.0005 btc / 1000 tokens), and supply will remain unchanged.
  • If 0.02 btc is pegged-in at the next block, holders will suffer a 0.00019% demurrage (10% / 365 days / 144 blocks per day), the maximum, and supply will only increase by 0.0181 tokens (0.02 btc - 1000 tokens * 0.00019% demurrage).

This mechanism creates a reserve of convenience yield, that will be released as the utility of the tokens decreases from the maximum, allowing it to drop up to (max_demurrage + bitcoin_dilution - sidechain_risk) * PER before causing the lose of the peg. That is the net present value of removing all the adjustable costs of carry relative to bitcoin.

Transforming monetary inflation (at par) into demurrage allows us to cancel price volatility via variable negative interest rates.

This may not be intuitive, so let's try to illustrate it with a simulation. I used 10% demurrage and a PER 10. These parameters are arbitrary, but seem reasonable enough:

Image:

The black line represents total utility of the tokens in a one-way peg chain (e.g. XCP) implementing certain functionality not available in Bitcoin. Let's assume subsidy is not necessary to keep the network secure and issuance is fixed, so the price of each token is not affected by dilution considerations.

Now, if that network allowed for the emission of new tokens at par with bitcoin, price will be capped at 1:1 exchange rate. The thick green line shows a naive approach to this perpetual one-way peg (P1WP) valuation. Actual valuation will be somewhere between this line and 1, as truncated upside works as a variable cost with stabilizaton effects. We can get a hint of how that cost may look like from the thin green line at the top o the chart.

You can also observe how token issuance will grow whenever the value of each token goes above the value of one bitcoin (green shadowed area).

The issue with vanilla P1WP is that, in absence of an efficient options market, it is very difficult to assess the cost of holding tokens. I.e. downside risk. And, when tokens trade at par, supply can increase above what would be rational. The cost of excessive issuance will only materialize into price volatility later. The greater the missjudgement, the greater the volatility.

By using demurrage, the network forces holders to pay part of the cost of holding tokens in cash instead of risk (thin blue line at the top of the chart), as if they had to cover their position with a bear spread, improving their ability to realize what is the magnitude of cost of carry when issuance is about to grow, and making it easier to determine their ideal balance of tokens. Negative interest rate will replace price as the market signal to look at on a regular basis, enabling token price to remain stable.

When a soft pegged token trades at par with bitcoin, it indicates it's potential price without demurrage would be demurrage * PER higher. Thus, until token utility loses 1 - (1/(1+demurrage*PER)), it won't lose the peg.

Making costs explicit eliminates the biased perception of market participants who believe they may be able to pass on the hot potato and go back to bitcoin at no cost before price drops. That perception leading people to knowingly put money on Ponzi schemes.

The volatility of sidechain tokens utility will determine if a soft peg is preferable to a sidechain with additional trust requirements. Volatility generates a downside risk that may no be always lower than the risk of adding trust requirements.

Other considerations

  • To avoid polution of Bitcoin block space, only miners of a sidechain should be able to issue new tokens.

  • In order to prevent manipulation strategies, peg-ins greater than a certain value (e.g. the median of the peg-ins in a number of preceding blocks) can be penalized, making increases of token supply smooth and more predictable. It may be preferable to make that penalty contingent to future volatility, and use maturity time risk instead of a fee.

  • Proof-of-burn based peg-ins and demurrage in the sidechain represent a yield for bitcoin holders.

@UkolovaOlga
Copy link

UkolovaOlga commented Jun 29, 2020

Following the Tweet, just wanted to give a heads up on what we have done.

We have been working on many LNP/BP Standards that would solve existing problems of L1 and L3 (and create a base for L3).
Feel free to check our experience, it might have synergy to your effort:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment