scrobble.life
Hive Learners

Understanding the calculation of the HBD/HIVE price after the 30% debt threshold.

image.png

Banner created in chatGPT

  It can be weird, but I love to be wrong. It is a good feeling to learn something new. And nothing is better to prove that something that we believe is false with data. Yesterday I read this amazing post by @gtg . The guy probably has the Hive code in his mind since he participated in many forks, right? And I really don't remember where, but I had this idea that after our debt surpasses 30%, all the HBD to Hive conversions would be refused. Like the other waydoesn'tt exist after the first threshold. But his posts show us that no, that isn't quite what happens. Conversions from HBD to Hive continue! But there is something that changes, and that's why people call it an HBD "depeg": the Hive price changes through the conversion! The code forces a virtual price of Hive that is totally different from the current market. So it is a depeg for those converting, and probably it is worth checking the current internal market to see how it goes, since it has been regulated by bots for a long time, as hbdstabilizer hasn't been doing orders frequently.

  So where is this code? You can find it in this C++ code: https://github.com/openhive-network/hive/blob/master/libraries/chain/database.cpp. There are some chunks of the code that I think are important for the assessment of the code. First is after the last HF that establishes the threshold of 30% of debt. The chunk below is what matters for the calculation of this price.

image.png

  So we have the limit variable receiving the debt ratio, and there is another important thing that I noticed... it doesn't accept decimals for the threshold limit. It causes a compilation error, so right now it's 30%, not a decimal, so it doesn't crash it. So after that, we have this min_price for HBD calculation using the limit, hbd supply - the hive.fund HBD (today is 31,887,402.583 -23,238,577.866) and the total Hive supply (today 59,9624,572.726). I just asked ChatGPT to give me the answer for min_price,e and it is around 0.033. Then we have another important chunk:

image.png

  This chunk is the one that decides! The condition compares the min_price calculated with the current median witness feed price (at this moment, it is 0.036). So, in this case, the min price is lower than that. But if the min price is greater than the median witness price, it forces it to be the new value! I just asked ChatGPT to simulate a value with the debt ratio slightly above 30% and that's what it gave me:

image.png
ChatGPT screenshot showing an hypothetical new value with debt > 30%

  In this case, the minimum price is 0.0377, and here we have the new Hive price, which might differ from the price on exchanges for Hive to USD. Well Comment bellow if there is something to correct in here. But that is a bit of a summary of what I understood about the next Hard cut.

Banner created in canva

image.png

  Pode parecer estranho, mas eu adoro estar errado. É uma sensação muito boa aprender algo novo. E nada melhor do que descobrir, por meio de dados, que algo em que acreditávamos estava errado. Ontem li esta publicação incrível do @gtg. Esse cara provavelmente tem o código do Hive na cabeça, já que participou de vários hard forks, certo? E eu realmente não me lembro onde, mas tinha essa ideia de que, depois que nossa dívida ultrapassasse 30%, todas as conversões de HBD para HIVE seriam recusadas. Como se, depois de atingir o primeiro limite, essa possibilidade simplesmente deixasse de existir. Mas a publicação dele nos mostra que não é bem assim. As conversões de HBD para HIVE continuam! Só que existe algo que muda, e é por isso que as pessoas chamam isso de "depeg" do HBD: o preço do HIVE muda durante a conversão! O código força um preço virtual para o HIVE que é completamente diferente do preço atual de mercado. Portanto, ocorre um depeg para quem faz a conversão. Provavelmente também vale a pena conferir o mercado interno atual para ver como ele está se comportando, já que há muito tempo ele vem sendo regulado por bots, e o hbdstabilizer não tem feito ordens com frequência.

  Então, onde está esse código? Você pode encontrá-lo neste código C++: https://github.com/openhive-network/hive/blob/master/libraries/chain/database.cpp. Existem alguns trechos que considero importantes para entender o funcionamento desse mecanismo. O primeiro aparece depois do último Hard Fork, que estabelece o limite de 30% de dívida. O trecho abaixo é o que importa para o cálculo desse preço.

image.png

  Temos então a variável limit recebendo a proporção da dívida, e há outro detalhe importante que percebi... ela não aceita valores decimais para o limite. Isso faz o sistema travar! Portanto, por enquanto, o valor é 30%, sem casas decimais, para evitar esse problema. Depois disso, temos o min_price, usado no cálculo do preço do HBD, considerando o limit, a quantidade de HBD em circulação — descontando o HBD do hive.fund (atualmente, 31.887.402,583 - 23.238.577,866) — e a quantidade total de HIVE em circulação (atualmente, 599.624.572,726). Pedi ao ChatGPT para calcular o valor de min_price, e o resultado ficou em torno de 0,033. Depois, temos outro trecho importante:

image.png

  Esse trecho é o que realmente decide! A condição compara o min_price calculado com o preço mediano atual fornecido pelos witnesses (neste momento, 0,036). Nesse caso, o preço mínimo é menor. Mas, se o min_price for maior que o preço mediano dos witnesses, ele passa a ser o novo valor forçado pelo código! Pedi ao ChatGPT para simular um cenário em que a proporção da dívida estivesse um pouco acima de 30%, e foi isso que ele me apresentou:

image.png
ChatGPT screenshot showing an hypothetical new value with debt > 30%

  Nesse caso, o preço mínimo é 0,0377, e é esse o novo preço do HIVE que será utilizado, podendo ser diferente do preço do HIVE em relação ao dólar nas exchanges. Bom, comentem abaixo se houver algo que precise ser corrigido. Mas esse é um pequeno resumo do que entendi sobre o próximo hard fork.

Banner criado no Canva

Comments · 3

  • @cryptocoinkb(70)· 3h

    The detail about the threshold being parsed as a whole number is interesting—if the code only accepts 30%, does that make future tuning harder without a hard fork?

  • @hive3(54)· 5h

    Great post, very clear and helpful for busting a common myth! You're right that once the 30% debt threshold (the haircut) is crossed, HBD → HIVE conversions aren't blocked: they keep working, but a minimum virtual price (min_price) for HIVE is applied to keep the debt ratio at 30%, which effectively causes a depeg for anyone converting (they receive less HIVE than they would at the real market price). A couple of small technical notes that might be useful:

    File link: in the text you wrote database.cp instead of database.cpp (missing a p at the end). Why decimals aren't used for the threshold: on the Hive blockchain, consensus calculations use integer (or fixed-point) arithmetic to avoid any rounding or determinism issues across different nodes (not so much because it "crashes", but because floating-point numbers aren't deterministic across different CPUs). Missing images: the text shows image.png placeholders without the actual screenshots of the C++ code and the simulation, which makes it a bit harder for readers to follow the exact steps.

    Overall, though, the core concept is explained really well! 👍

  • This post was curated by @hive-br team!

    banner_hiver_br_01.png

    Delegate your HP to the hive-br.voter account and earn Hive daily!

    50 HP

    |

    100 HP

    |

    200 HP

    |

    500 HP

    |

    1000 HP

    |

    🔹 Follow our Curation Trail and don't miss voting! 🔹