Key Asymmetric Conversions

avatar

publickeyencryptionasymmetricaleliptic.jpg

There's a certain unit-bias involved in symmetry

The human brain likes when things are patterned and symmetric. Perhaps you've seen people drawing green lines on pictures to show who is an alpha and who is not. It can all get pretty ridiculous.

That being said asymmetry can be a key-component for things like public key encryption. Something like elliptic encryption would not be possible without asymmetry. Imagine how annoying that would be!

Anyone that wanted to send you a message would have to also know the private key to send it (as there would only be 1 key to encrypt & decrypt). Within the context of crypto: anyone that sent you money would also have to know your private keys. Obviously in that case cryptocurrency would fail entirely without this type of asymmetry that allows both public and private keys to exist. The public key is not allowed to give away what the private key is. It's a tricky process that involves some math ninja backflips that I won't go into.

alchemy.jpg

But what of conversions?

I've been poring over the code that I wrote in summer 2021 and notice that a lot of things I thought would work back then... yeah they probably aren't going to work out so well in practice. I was trying to think of solutions last night as I was in bed, but usually my brain is so fried at the end of the day this becomes a frustrating and fruitless experience.

However when I wake up in the morning I usually have an answer instantly. Sometimes I wonder if my subconscious does the work for me while I sleep, or if my brain is just recharged in the morning and actually has the power to figure it out. I suppose it doesn't matter much either way, as the end result is the same... although my subconscious may be offended by this statement and keeps telling me to "delete that shit".

Looking at other types of conversions

There have been many EVM failures that were the direct result of symmetrical conversions. The only one I can think of with clarity off the top of my head is LUNA/UST. We all saw how that dumpster fire went down. Crashed to zero in a couple days.

Another one I remember that failed was... Titan? Iron? Anyone remember that one? Let me go look it up real fast...

image.png

Yeah it didn't work out so well for them either eh?

The point here is that when there is a smart-contract that allows one asset to be transformed into another without the use of a liquidity pool: this will create systemic risk within the system if it isn't handled properly. Conversions create scenarios in which liquidity pools can be attacked or otherwise exploited. Because I want my tokens on Magitek to be able to do these kinds of conversions... I have to look up all the ways in which it can fail and act accordingly.

It appears as though rule number one is to not allow symmetry.

If UST can be traded for LUNA and LUNA can be traded for USD: you're gonna have a bad time. If Titan can be traded for Iron and Iron can be traded for Titan: you're gonna have a bad time.

But what about Hive and HBD?

  • Hive can be converted for HBD.
  • HBD can be converted for Hive.
Doesn't that break the rules?
Does this mean Hive is in danger from systemic risk?
Surprisingly this is not the case.

hivelogoblockchain.jpeg

Hive achieves conversion asymmetry using not one but three different mechanics.

  1. 30% haircut on debt ratio (the ultimate oh-shit button)
  2. Three and a half day price feed average delay.
  3. 5% gap between conversions.

#2

Imagine you were a Hive whale with a big stack of Hive and HBD and you're looking to cash out or go long with your HBD stack. You're trying to get the most bang from your buck, and liquidity on the internal market isn't enough to dump your HBD tokens outright for a fair price. You get the 'brilliant' idea to use your Hive stack to crash the price of Hive. While the price is low you'll then convert HBD into Hive and create far more Hive tokens than you would have otherwise.

The 3.5 day price feed average greatly mitigates shenanigans like this. You might have enough Hive to crash the price for a couple hours or even a day, but that still gives 3.5 days total for market makers and other whales to buy up your cheap tokens before the conversion completes. It's not a free win like it would be on something like Terra Luna that did conversions instantly. A move like this on Hive would be pure gambling with a very high chance of backfire.

#1

The 30% debt-ratio haircut is another way in which conversions on Hive are asymmetric. However this particular mechanic is very much an "oh shit" button and should be avoided at all costs because it breaks the peg of HBD to the downside, which is turn creates a confidence crisis that can lead to a domino effect of bad times. Luckily now that we've increased this number from 10% to 30% we've never even come close to activating it, and Hive would have to be sub 10 cents for this oh-shit button to activate given the current state of the network. That being said the ratio needs to be monitored constantly for instability. A high demand for debt while simultaneously lacking a demand for collateral is a sign of trouble ahead.

#3

Ultimately the best way in which Hive/HBD conversions are asymmetric is the liquidity gap between the two assets. Sure, you can convert HBD to Hive at market price, but Hive to HBD comes with a 5% fee. This 5% fee in turn creates a 5% gap ($1-$1.05) between conversions, creating a strong asymmetry that cannot be exploited like the tokens we've seen fail on EVM. Only legitimate demand for HBD will spike the price higher than $1.05, and only that price or higher can make a conversion worth it in the Hive >> HBD direction.

Personally I believe it is time to narrow this gap to something like 2% or 3%, as 5% was very much the conservative safe play. But all in good time the witnesses will modify this number when they are comfortable doing so.

yinyangfireicealchemyconvert.png

So how would Magitek employ asymmetric conversions?

Because conversions (I call them "spells" within the mage-theme) are inherently risky, they are turned off by default, and have to be voted up to be temporarily turned on. MANA can theoretically be converted into anything (FIRE/LIT/ICE), but in order for FIRE/LIT/ICE to be turned back into MANA, they have to pass through a filter. This filter would be represented by another asset called AETHER. For raw elements to be recombined back into MANA they must pass through the AETHER wall.

Magitek allocates an inflation multiplier to the AETHER wall, which creates linear diminishing returns for conversions in that direction. For example, if too much FIRE is destroyed in the AETHER wall (because that's the cheapest conversion at the time) then the return on that conversion will end up being less than just using the liquidity pool (Potions).

In addition, inflation is only allocated once every 30000 blocks (~25 hours) on a single "resolution block", so anyone who engages in these kinds of conversions doesn't get any kind of instant gratification and needs to wait for the resolution block to... resolve(). It's more of a function for arbitrage and market makers than casual users, just like conversions on Hive are a more advanced feature.

filter.jpg

Reasons to not allow conversions at all:

Again, conversions create systemic risks to the network no matter what. Avoiding systemic risk is never a bad thing, so the reasons for creating systemic risk needs to be very good ones. HBD creates a systemic risk for Hive, but Hive has gone through great lengths to mitigate these risks with the tokenomics listed listed above.

The reward for Hive is greater than the risk: as now we have a pretty awesome stable coin that is only getting better every year. We can outsource our debt to the stable coin, provide unbelievable sustainable returns, and even siphon value from the stable-coin into Hive when demand for our debt increases using Hive >> HBD conversions.

So why allow conversions on Magitek?

Well it does allow for a lot of flexibility, but does that reward really outweigh the risks of allowing it? Very much unclear and I'd need to run some more tests on it.

For example, if I allow anyone and everyone to create FIRE by burning HIVE to @null, and then later I start converting MANA into FIRE with a fire_bolt conversion... it's easy to see how users that created FIRE the OG way might get pissed and claim their assets are being devalued (this may or may not be true depending on liquidity).

On the other hand if the Magitek system had already burned millions of Hive into Fire and we needed to stop value from bleeding out of the system, printing Fire is an easy way to accomplish this. It all very much depends on the context of what the network is trying to get done.

deathspiral.jpg

Conclusion

Well I could say a lot more but I think I can tie it off here. Symmetrical conversions in crypto are prone to massive amounts of systemic risk and should be avoided at all costs. Terra Luna and Titan are classic examples of this theory playing out in practice. It's only a matter of time before such algorithms collapse the price of the underlying token to zero. Conversions outside of liquidity pools create risk to the liquidity pools themselves, which in turn was already the biggest point of vulnerability to begin with.

While Hive appears to have conversion symmetry: there are multiple backstops in play to ensure that the dreaded death-spiral can not happen. At first glance it looks like Hive can be converted into HBD and vice versa, but that is simply not the case for a variety of reasons explained above.

When theory-crafting the rules for my own tokenomics these risks and rewards need to be taken quite seriously. I refuse to put my reputation on the line on a product that was rushed to market and largely untested. If only EVM devs employed the same restraint. Move fast and break things, or take it slow and get it right the first time? Considering financial applications I think we know which one should get picked, but the tech bros and VCs don't seem to agree.

Posted Using LeoFinance Beta



0
0
0.000
10 comments
avatar

I have that same feeling sometimes too when I need to get answers to something and it ends up not coming through till the next day.

I never knew much about the maths behind the Hive/HBD conversion but was able to pull off some little points from here. Thanks for sharing.

0
0
0.000
avatar

It works, until it is not. Internally we should all strive to break it before it is broken by a hacker or market events or both.

The biggest risks are the tails and those we haven’t thought of. The more complicated the system is the higher the probability there is an exploit.

0
0
0.000
avatar

You kind of missed the problem. The symmetric RSA would have worked fine. The problem is the keys would have to be very very long to get the same security as a 256 bit ECC key. The payment addresses could have been RSA-public keys that were hashed to shorter addresses, say to the length of a modern Bitcoin address. You simply generate the private key and the public key simeltaneously rather than generating a private one and then deriving your public key from that.

Posted using Proof of Brain

0
0
0.000
avatar

This post is actually about asymmetric crypto conversions being a systemic threat to liquidity pools.
Did you read it?

Interesting note about symmetric encryption though to be sure.
If I'm reading this right you're saying it has nothing to do with security and more to do with efficiency.
Although the two are not necessarily mutually exclusive.

0
0
0.000
avatar
(Edited)

As I understand your first paragraphs, you were asserting that you couldn't have had a Bitcoin like protocol based on symmetric encryption. I think we could have had it in the 1990s using RSA but the blockchain would have filled up people's hard drives and failed based on that.

I did end up reading the rest of your article and I don't have any comments as you covered the issue quite well. Although, it is something that I wish more people had realized before the depegging of Terra. Pegged assets are tricky to get right and while HBD was ignored Terra was adopted by a whole bunch of exchanges. I don't put money in things that I don't investigate first.

0
0
0.000
avatar

As a newbie this has been very educative. Thank you for this write up

0
0
0.000
avatar

Here in my country where I live in Venezuela, hive blog users use a web page that works as an exchange house called Orinoco. This website is in charge of making those conversions according to the price at which it is in the market. Until now it has always seemed transparent to me and I have not had any kind of problem in making transactions from my cryptocurrency balance to my local currency. Your article is very interesting. Thank you very much for sharing.

0
0
0.000
avatar

Great job on your research and analysis! It's not always easy to identify potential risks and issues in a system, especially when dealing with conversions and smart-contracts. It's clear that you've put a lot of thought and effort into understanding the mechanics of Hive and HBD conversions, and the ways in which they achieve conversion asymmetry. It's also great that you're keeping an eye on potential risks and taking steps to prevent them. Keep up the good work, and don't be too hard on yourself when things don't work out as expected. Sometimes, it takes time and experimentation to find the right solution.

0
0
0.000