create account

Inside HIVE to HBD conversions (slightly technical). by andablackwidow

View this thread on: hive.blogpeakd.comecency.com
· @andablackwidow · (edited)
$66.81
Inside HIVE to HBD conversions (slightly technical).
When I read [first article](https://hive.blog/hive-167922/@edicted/selling-the-hive-hbd-pamp-hive-hbd-conversions) of @edicted about conversions, I was sure I have to write detailed description of how it works. However literally as I finished reading I've noticed price of Hive falling on internal market, checked UpBit to make sure it is related to pump on HBD and ended up using conversions myself for the first time on mainnet. The article turned out to be amazingly well timed. As a result I went to sleep after 5AM and next day I forgot about writing. However, since discussions on how collateralized conversion works continued in [two](https://hive.blog/hive-167922/@edicted/real-hive-hbd-conversion-analysis) [more](https://hive.blog/hive-167922/@edicted/conversion-rollback) articles and in comments, here I am with my description :o)

(Actually there is [one more article](https://hive.blog/hive-167922/@edicted/final-thoughts-perspective) but I'm yet to read it).

---

## The feed.

We have to start from learning how price is established inside `hived`.

Witnesses can send `witness_set_properties_operation` with `hbd_exchange_rate` among properties or just `feed_publish_operation` to declare price of HIVE. The price could be sent manually, but obviously is not. The scripts that read the price from external exchanges can stop working, there can be connection problems or, like recently, some exchanges stopped serving API calls from US based IP addresses. Witnesses can use different sources for their price readings, they might attach volume based weights to it, or even weight their sources based on some arbitrary trustworthiness factor. Finally in the end the price can actually be totally fabricated out of whole cloth. The point is, prices submitted by witnesses can be very different at any given time, although it is assumed that most will be roughly reflecting actual global market conditions and only some will be out of place. For that reason `hived` uses median of witness price feeds to produce an official feed entry. For example, latest price dump on internal market would only be somewhat reflected on feeds of witnesses that use it among their sources, but since it barely showed on most exchanges and only with delay as a result of arbitrage, it would not have much impact on official feed entry (at some point price on internal market was rushing down to 37 cents while price on Binance was still 44 cents - bots were super happy, I presume; notice how it only reached 41 cents on Binance while internal market dipped below 36 cents).

There are two more elements considered: when witness did not publish price for some time - `HIVE_MAX_FEED_AGE_SECONDS` (7 days) - it is considered stalled and discarded. Also when there are less than `HIVE_MIN_FEEDS` (7) witnesses as source of new feed entry, the whole entry is discarded.

## Official internal price and feed history.

So, we know how a single feed entry is formed. It happens once every `HIVE_FEED_INTERVAL_BLOCKS` (effectively one hour). `hived` keeps a moving window of historical feed entries that since HF16 covers `HIVE_FEED_HISTORY_WINDOW` (effectively 3.5 days). When new entry is formed, the oldest one is removed. That window is a source of four internal prices: `current_min_history` - minimum value of feed entry in the window, `current_max_history` - maximum value, `market_median_history` - median value and finally the most important price used almost everywhere in `hived`, `current_median_history`. There is one more price that is considered, price that HIVE would have to have for HBD debt to reach hard limit. For most of the time `current_median_history` equals `market_median_history`, but if debt limit price is higher, the latter is used as official internal price of HIVE.

Notice how official internal price, due to being median from 3.5 days (median, not average!), is going to ignore all short lived pumps or dumps, even if they were broad enough to make it to feed entries. The price movement has to persist for more than half of history window to influence official internal price.

---

## Conversions.

Conversion from HBD to HIVE (`convert_operation`) is simple. You state how much HBD you want to convert and after 3.5 days you get HIVE based on official internal price effective at that moment. Your HBD is burned and new HIVE is created in its place. The 3.5 days is not a coincidence. When you send a conversion request, all the feed entries that will eventually form price used for actual conversion are still in the future. If conversion from HIVE to HBD was the same, there would be no problem. However its purpose is significantly different. It is to allow reaction on situations like the recent pump of HBD price. Waiting 3.5 days to get the ammo for defending the peg would not be acceptable. That's why it gives you HBD immediately, but it comes with a price.

The `collateralized_convert_operation` has to take into account that future price of HIVE might be lower than current one. To prepare for that, it divides given amount of HIVE by `HIVE_CONVERSION_COLLATERAL_RATIO`, effectively considering only half of HIVE for calculating converted amount. Official internal price is a median of prices in feed history window - it can be significantly different from current market price. That's why not that but `current_min_history` is used. This way users can't abuse temporary swings in price. If we are in volatile environment when minimum and median prices are way different, it is safer for the system to use lower price (and if they are close it does not matter that we are going to use minimum). Finally there can still be situations when during next 3.5 days price changes to the downside for more than 50% and stays at that level. It can even happen as a flash crash between feed entries (so users can already see price decline but the system cannot). It only matters if the price stays low for prolonged period of time. In such case future official price, when actual conversion happens, will be at such level that HIVE given by the user won't be enough to cover for the HBD they were given. The Hive network foots the bill in that case. It should be a rare occurrence, but might still happen. That's why there is `HIVE_COLLATERALIZED_CONVERSION_FEE` (5 percent) fee on every conversion. It more than covers potential rare loses.

The procedure is prepared for even more rare case. Normally HIVE to HBD conversions are disabled when HBD debt reaches upper soft limit (<strike>which happens to be the same as hard limit</strike> <sup>(Edit: not at the moment, see discussion with @dalz in comments below)</sup>, when peg is broken for safety reasons, but <strike>could actually be</strike> <sup>(is)</sup> a different, lower value). However it can happen that user starts conversion and only then price declines to the point when official internal price is artificially changed to the upside due to hard limit. User won't benefit from that move though. The conversion uses `market_median_history`, that reflects actual market value of HIVE as reported by witnesses.

Let's sum up all the steps taken during HIVE to HBD conversion and then see an example:
 - user posts conversion request with X HIVE
 - X is subtracted from user balance and placed in separate object as collateral
 - X is cut in half and multiplied by `current_min_history` corrected by 5% fee giving Y HBD
 - Y HBD is created out of thin air and immediately given to the user
 - 3.5 days pass and actual conversion is executed
 - Y HBD is multiplied by `market_median_history` corrected by by 5% fee giving Z HIVE
 - if Z is not more than X, the excess collateral (X - Z) HIVE is given back to the user; Z HIVE is burned
 - if Z is more than X, `system_warning_operation` vop is generated (it can be observed on account history of `initminer`); all the X HIVE collateral is burned and the shortfall of (Z - X) HIVE remains in the system as extra inflation

At the moment of writing this article the official internal prices (accessed with `database_api.get_feed_history`) are:
 - `current_min_history` - 424 HBD for 1000 HIVE
 - `current_max_history` - 458 HBD for 1000 HIVE
 - `market_median_history`/`current_median_history` - 445 HBD for 1000 HIVE

Let's start conversion with 4000 HIVE as collateral.
 - given amount is cut in half - 2000 HIVE
 - `current_min_history` is used; 5% fee means we have to pay 5% more HIVE for the same amount of HBD, that is, we multiply:
```
(2'000.000 HIVE * 424.000 HBD * 10'000 basis points) / (1'000.000 HIVE * 10'500 basis points) = 
8'480'000'000.000000 HBD / 10'500'000.000 =
807.619 HBD
```
 - we get 807.619 HBD

Scenario 1 - prices stayed the same after 3.5 days:
 - `market_median_history` is used, we multiply:
```
(807.619 HBD * 1'000.000 HIVE * 10'500 basis points) / (445.000 HBD * 10'000 basis points) =
8'479'999'500.000000 HIVE / 4'450'000.000 =
1'905.617 HIVE
```
 - excess collateral is (4'000.000 - 1'905.617) HIVE = 2'094.383 HIVE - we get that back
 - we ended up effectively converting our HIVE for HBD at around 0.4238 exchange rate (includes fee)

Scenario 2 - price increased to 0.4835:
 - `market_median_history` with value of 483.500 HBD for 1000 HIVE is used, we multiply:
```
(807.619 HBD * 1'000.000 HIVE * 10'500 basis points) / (483.500 HBD * 10'000 basis points) =
8'479'999'500.000000 HIVE / 4'835'000.000 =
1'753.877
```
 - excess collateral is (4'000.000 - 1'753.877) HIVE = 2'246.123 HIVE - we get that back
 - we ended up effectively converting our HIVE to HBD at around 0.4605 exchange rate (includes fee)

Scenario 3 - price declined to 0.3983:
 - `market_median_history` with value of 398.300 HBD for 1000 HIVE is used, we multiply:
```
(807.619 HBD * 1'000.000 HIVE * 10'500 basis points) / (398.300 HBD * 10'000 basis points) =
8'479'999'500.000000 HIVE / 3'983'000.000 =
2'129.048
```
 - excess collateral is (4'000.000 - 2'129.048) HIVE = 1'870.952 HIVE - we get that back
 - we ended up effectively converting our HIVE to HBD at around 0.3793 exchange rate (includes fee)

Scenario 4 - price crashed to 0.2021:
 - `market_median_history` with value of 202.100 HBD for 1000 HIVE is used, we multiply:
```
(807.619 HBD * 1'000.000 HIVE * 10'500 basis points) / (202.100 HBD * 10'000 basis points) =
8'479'999'500.000000 HIVE / 2'021'000.000 =
4'195.942
```
 - shortfall of collateral is (4'195.942 - 4'000.000) HIVE = 195.942 HIVE - we get nothing back, Hive keeps the shortfall amount as extra inflation
 - we ended up effectively converting our HIVE to HBD at around 0.2019 exchange rate (despite shortfall it is still below actual price, just not whole fee was included)

---

Hopefully now it should be clear how the conversion works. If anyone is interested in technical details it is always best to look into the code:
 - collection of feed entries: [`database::update_median_feed()`](https://gitlab.syncad.com/hive/hive/-/blob/master/libraries/chain/database.cpp#L4568)
 - processing of new conversion request: [`collateralized_convert_evaluator::do_apply( const collateralized_convert_operation& o )`](https://gitlab.syncad.com/hive/hive/-/blob/master/libraries/chain/hive_evaluator.cpp#L2332)
 - price multiplication with fee: [`multiply_with_fee(...)`](https://gitlab.syncad.com/hive/hive/-/blob/master/libraries/protocol/asset.cpp#L322)
 - execution of conversion after 3.5 days: [`database::process_conversions()` starting here](https://gitlab.syncad.com/hive/hive/-/blob/master/libraries/chain/database.cpp#L3618)
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 373 others
👎  , ,
properties (23)
authorandablackwidow
permlinkinside-hive-to-hbd-conversions
categoryhive-167922
json_metadata"{"links":["https://hive.blog/hive-167922/@edicted/selling-the-hive-hbd-pamp-hive-hbd-conversions","https://hive.blog/hive-167922/@edicted/real-hive-hbd-conversion-analysis","https://hive.blog/hive-167922/@edicted/conversion-rollback","https://hive.blog/hive-167922/@edicted/final-thoughts-perspective","https://gitlab.syncad.com/hive/hive/-/blob/master/libraries/chain/database.cpp#L4568","https://gitlab.syncad.com/hive/hive/-/blob/master/libraries/chain/hive_evaluator.cpp#L2332","https://gitlab.syncad.com/hive/hive/-/blob/master/libraries/protocol/asset.cpp#L322","https://gitlab.syncad.com/hive/hive/-/blob/master/libraries/chain/database.cpp#L3618"],"users":["edicted","dalz"],"tags":["hive-167922","hive","hbd","conversion"],"app":"ecency/3.0.30-surfer","format":"markdown+html","image":[],"description":"When I read first article of @edicted about conversions, I was sure I have to write detailed description of how it works. However literally as I finished reading I've noticed price of Hive falling on internal"}"
created2023-02-10 18:22:24
last_update2023-02-18 00:47:36
depth0
children19
last_payout2023-02-17 18:22:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value66.807 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length11,514
author_reputation66,039,169,583,429
root_title"Inside HIVE to HBD conversions (slightly technical)."
beneficiaries
0.
accountandablackwidow
weight10,000
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id120,661,542
net_rshares227,841,065,377,230
author_curate_reward""
vote details (440)
@albertocova ·
Muchas gracias por su información muy interesante y muy bien la explicación excelente 👌
properties (22)
authoralbertocova
permlinkrpxfuj
categoryhive-167922
json_metadata{"app":"hiveblog/0.1"}
created2023-02-11 17:42:24
last_update2023-02-11 17:42:24
depth1
children0
last_payout2023-02-18 17:42:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length87
author_reputation7,373,939,916,854
root_title"Inside HIVE to HBD conversions (slightly technical)."
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id120,691,673
net_rshares0
@codingdefined ·
A great write up, getting into the backend and understanding it takes times whereas you have done the work for all of us.

<sub>I found this post by browsing [Threads](https://leofinance.io/threads/@l337m45732/re-leothreads-76k4co). Learn more [about threads](https://leofinance.io/@anomadsoul/threads-the-conversation-starter).</sub>
properties (22)
authorcodingdefined
permlinkre-andablackwidow-rpxzk0
categoryhive-167922
json_metadata{"tags":["hive-167922"],"app":"peakd/2023.2.2"}
created2023-02-12 00:46:00
last_update2023-02-12 00:46:00
depth1
children0
last_payout2023-02-19 00:46:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length334
author_reputation389,500,584,123,833
root_title"Inside HIVE to HBD conversions (slightly technical)."
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id120,700,799
net_rshares0
@dalz ·
Hey @andablackwidow!

Sorry to ping you here on another topic.
About the HBD printing. There are two limits, 20% and 30%. First is like a soft cap, and the second a hard cap. This is what was before 9% and 10% limits. 

What exactly happens at the 20% limit?

I know that authors rewards start to be rewarded as a mix with liquid hive and hbd.
What about the conversions? Can HIVE to HBD conversions still work when the debt is between 20% and 30%? My guess is that the DHF payouts would be unaffected and will continue with debt above 20% and 30%. What about the HBD interest payouts? Will those stop?

Thanks
properties (22)
authordalz
permlinkrq7yvl
categoryhive-167922
json_metadata{"users":["andablackwidow"],"app":"hiveblog/0.1"}
created2023-02-17 10:09:21
last_update2023-02-17 10:09:21
depth1
children2
last_payout2023-02-24 10:09:21
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length610
author_reputation1,292,654,097,954,012
root_title"Inside HIVE to HBD conversions (slightly technical)."
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id120,858,937
net_rshares0
@andablackwidow ·
$0.51
Oh, a perfect example of a question that forces me to look into the code and learn, that what I thought was certain, I actually remember wrong :o)

The description I've posted [here](https://hive.blog/hive-139531/@andablackwidow/the-hbd-limits-explained-technical) is still valid, although links to code no longer point to exact locations, since the code changed (I wonder if there is a way to keep such links valid even in case of changes; sure, I could link to specific commit, but that would mean I'd be pointing to potentially outdated code...). HF26 changed *BOTH* soft limits to 20% from 9% and 10% (this is where I remembered it wrong thinking upper soft limit is 30%) - meaning there is no smooth transition when less and less HBD is printed for comment rewards (now that I think about it I remember fixing a bug related to those limits being equal). Only the hard cap was changed to 30% from 10%. In other words, when we reach and cross 20% HBD debt, posts won't receive any HBD (that portion of reward is paid in liquid HIVE), conversions from HIVE to HBD with `collateralized_convert_operation` are also completely disabled. Payments from proposals as well as interest on HBD savings are not affected - they are still paid in full with HBD. Only if the debt continues to grow (due to falling price of HIVE or over time from still active sources of new HBD) we can reach 30% hard limit where HBD loses its dollar peg.
👍  
properties (23)
authorandablackwidow
permlinkre-dalz-2023217t194435421z
categoryhive-167922
json_metadata{"tags":["ecency"],"app":"ecency/3.0.38-mobile","format":"markdown+html"}
created2023-02-17 18:44:33
last_update2023-02-17 18:44:33
depth2
children1
last_payout2023-02-24 18:44:33
cashout_time1969-12-31 23:59:59
total_payout_value0.256 HBD
curator_payout_value0.256 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,429
author_reputation66,039,169,583,429
root_title"Inside HIVE to HBD conversions (slightly technical)."
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id120,870,625
net_rshares840,263,496,171
author_curate_reward""
vote details (1)
@dalz ·
A sharp cut for the authors rewards ... I wasnt expecting that. Interesting about the hive to hbd conversions. About the dhf oayouts and the interest, they can be basicly set to zero if the top stakeholders and witnesses decided to.... so they are also regulatable so to speak.
properties (22)
authordalz
permlinkrq8n82
categoryhive-167922
json_metadata{"app":"hiveblog/0.1"}
created2023-02-17 18:55:18
last_update2023-02-17 18:55:18
depth3
children0
last_payout2023-02-24 18:55:18
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length277
author_reputation1,292,654,097,954,012
root_title"Inside HIVE to HBD conversions (slightly technical)."
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id120,870,820
net_rshares0
@edicted ·
# 🤓
Thanks for taking the time to write this.
My ADHD refuses to let me read it right now in full.
But one day!  
properties (22)
authoredicted
permlinkre-andablackwidow-rpxba2
categoryhive-167922
json_metadata{"tags":["hive-167922"],"app":"peakd/2023.2.2"}
created2023-02-11 16:03:39
last_update2023-02-11 16:03:39
depth1
children0
last_payout2023-02-18 16:03:39
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length113
author_reputation2,897,256,391,964,848
root_title"Inside HIVE to HBD conversions (slightly technical)."
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id120,689,101
net_rshares0
@hivebuzz ·
Congratulations @andablackwidow! You have completed the following achievement on the Hive blockchain And have been rewarded with New badge(s)

<table><tr><td><img src="https://images.hive.blog/60x70/http://hivebuzz.me/@andablackwidow/posts.png?202302101905"></td><td>You published more than 10 posts.<br>Your next target is to reach 20 posts.</td></tr>
</table>

<sub>_You can view your badges on [your board](https://hivebuzz.me/@andablackwidow) and compare yourself to others in the [Ranking](https://hivebuzz.me/ranking)_</sub>
<sub>_If you no longer want to receive notifications, reply to this comment with the word_ `STOP`</sub>


To support your work, I also upvoted your post!


**Check out our last posts:**
<table><tr><td><a href="/hivebuzz/@hivebuzz/valentine-2023"><img src="https://images.hive.blog/64x128/https://i.imgur.com/lttnsDy.png"></a></td><td><a href="/hivebuzz/@hivebuzz/valentine-2023">Valentine's Day Challenge - Give a badge to your beloved!</a></td></tr><tr><td><a href="/hive-139531/@hivebuzz/proposal-2324"><img src="https://images.hive.blog/64x128/https://i.imgur.com/RNIZ1N6.png"></a></td><td><a href="/hive-139531/@hivebuzz/proposal-2324">The Hive Gamification Proposal</a></td></tr></table>

###### Support the HiveBuzz project. [Vote](https://hivesigner.com/sign/update_proposal_votes?proposal_ids=%5B%22248%22%5D&approve=true) for [our proposal](https://peakd.com/me/proposals/248)!
properties (22)
authorhivebuzz
permlinknotify-andablackwidow-20230210t192337
categoryhive-167922
json_metadata{"image":["http://hivebuzz.me/notify.t6.png"]}
created2023-02-10 19:23:36
last_update2023-02-10 19:23:36
depth1
children0
last_payout2023-02-17 19:23:36
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,417
author_reputation368,127,239,045,180
root_title"Inside HIVE to HBD conversions (slightly technical)."
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id120,663,136
net_rshares0
@iykewatch12 · (edited)
$0.03
Reading this article on conversion tells how highly technical hive is . Well explained with good details. I recently saw that I could also delegate my [resource credit]() all these are sweet innovation on hive not found anyway else telling the unique nature of #hive
#LeoFinance
👍  , ,
properties (23)
authoriykewatch12
permlinkrpwj6m
categoryhive-167922
json_metadata{"tags":["hive","leofinance"],"app":"hiveblog/0.1"}
created2023-02-11 05:56:54
last_update2023-02-11 05:57:45
depth1
children0
last_payout2023-02-18 05:56:54
cashout_time1969-12-31 23:59:59
total_payout_value0.014 HBD
curator_payout_value0.014 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length278
author_reputation13,668,240,655,441
root_title"Inside HIVE to HBD conversions (slightly technical)."
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id120,676,467
net_rshares51,337,467,477
author_curate_reward""
vote details (3)
@jelly13 ·
$0.14
>  For example, latest price dump on internal market would only be somewhat reflected on feeds of witnesses that use it among their sources, but since it barely showed on most exchanges and only with delay as a result of arbitrage, it would not have much impact on official feed entry (at some point price on internal market was rushing down to ~~37 cents~~ **0.37 HBD** while price on Binance was still 44 cents - bots were super happy, I presume; notice how it only reached 41 cents on Binance while internal market dipped below ~~36 cents~~ **0.36 HBD**).

The top source of confusion when it comes to understanding conversions is using the word "dollar" (in this case "cent") and the "$" sign to describe both USD and HBD. 

Witnesses broadcast HIVE/USD price. Internal market has no HIVE/USD price displayed anywhere. It only trades HIVE/HBD. The apparent discrepancy did not exist, it was just market evaluating HBD over 1 USD. If anyone ever asked witnesses what the HIVE/HBD price was, they would know (*ok, the current scripts would not but the people running them would know how to amend them to respond*).

> For that reason hived uses median of witness price feeds to produce an official feed entry.

Median of what set of feeds? Top 20? Top 20+1? Is there any input from backup witnesses taken?
👍  , , , ,
properties (23)
authorjelly13
permlinkre-andablackwidow-rpwtef
categoryhive-167922
json_metadata{"tags":["hive-167922"],"app":"peakd/2023.2.2"}
created2023-02-11 09:37:27
last_update2023-02-11 09:37:27
depth1
children2
last_payout2023-02-18 09:37:27
cashout_time1969-12-31 23:59:59
total_payout_value0.070 HBD
curator_payout_value0.069 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,307
author_reputation-23,235,237,016,640
root_title"Inside HIVE to HBD conversions (slightly technical)."
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id120,680,307
net_rshares240,301,727,862
author_curate_reward""
vote details (5)
@andablackwidow ·
> Witnesses broadcast HIVE/USD price.

They actually don't. They broadcast HIVE->BUSD or HIVE->BTC->USDT, or HIVE->BTC->KRW->USD. HIVE->HBD from internal market is also taken into account by some witnesses. For the purpose of price discovery all major stablecoins are considered dollars. It doesn't matter if you can actually perform all the steps to exit to fiat dollars - after all you might be limited by sanctions (if you are f.e. from Iran or Russia) or regulatory burden (if you are US citizen). There might also be fees to be paid on each step of conversion and they are also different for individuals, so they can't be taken into account.

When some form of dollars turns out to be trading above "global consensus" of dollar price, like we had recently with HBD, it is an opportunity for quick profit. It is not limited to crypto, although I think in banking system the opposite happens more frequently. The example of one form of fiat dollars being worth more than the other would be if you are in a country with crappy economy and you have some dollars in your bank account, but you can't transfer them abroad and you can only exchange them with fake official rate, while real (black) market rate is vastly different. In such case dollars in physical cash will be worth more than those in the bank.
**[rant mode on]**
But it happens in "stable" countries too. Banks and other financial institutions keep mix of MBS-dollars, USTreasury-dollars, Gold-dollars, CorporateBond-dollars and whatever dollars printed from myriad of assets used as collateral and for inter-bank settlements. When system is healthy (on the surface) we all think we have "actual dollars" on our bank accounts. But when some form of collateral turns out to be mostly fake (like in 2008), the dollars that sprung from that asset disappear, and everyone learns what was true all along: you don't have dollars in YourBank, you have YourBank-dollars. Nothing really changed since the time when each bank printed its own banknotes, just introduction of central banks, lenders-of-last-resort, helped to muddy the waters. At least in crypto everyone can decide for themselves which and if any form of stablecoin to keep, so they are not much affected if some other form fails.
**[rant mode off]**

> > For that reason hived uses median of witness price feeds to produce an official feed entry.

> Median of what set of feeds? Top 20? Top 20+1? Is there any input from backup witnesses taken?

All witnesses from current schedule are taken into account, which means top 20 plus one backup that happened to be in schedule active at time of feed entry creation.
properties (22)
authorandablackwidow
permlinkre-jelly13-2023212t0522384z
categoryhive-167922
json_metadata{"tags":["hive-167922"],"app":"ecency/3.0.30-surfer","format":"markdown+html"}
created2023-02-11 23:05:24
last_update2023-02-11 23:05:24
depth2
children1
last_payout2023-02-18 23:05:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length2,632
author_reputation66,039,169,583,429
root_title"Inside HIVE to HBD conversions (slightly technical)."
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id120,698,885
net_rshares0
@jelly13 · (edited)
> All witnesses from current schedule are taken into account, which means top 20 plus one backup that happened to be in schedule active at time of feed entry creation.

Thanks, these kinds of details are sometimes hard to find.

The rest of your comment happens to be rant from the second sentence on. I agree with you that HIVE/USD price is different to two randomly selected Hive users. That is the exact reason why the blockchain asks the question - if a single price existed, noone would need oracles. And of course, witnesses can use all kinds of info to make their educated guess. 

An extreme example to try and prove your first sentence false: If Witness X broadcasts their Social Security Number by mistake, they have just broadcasted HIVE/USD price. A totally dumb one (that won't influence  the Hive price feed fortunately) but still a HIVE/USD price by definition. 

They cannot broadcast HIVE/HBD price. They can make a Hive post about it but they cannot broadcast it as there is no such variable in the questionnare they got from the chain.
properties (22)
authorjelly13
permlinkrpxwpa
categoryhive-167922
json_metadata{"app":"hiveblog/0.1"}
created2023-02-11 23:46:21
last_update2023-02-11 23:47:00
depth3
children0
last_payout2023-02-18 23:46:21
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,054
author_reputation-23,235,237,016,640
root_title"Inside HIVE to HBD conversions (slightly technical)."
beneficiaries
0.
accounttipu
weight100
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id120,699,614
net_rshares0
@l337m45732 ·
$0.03
i just learned so much. thanks fren
👍  , ,
properties (23)
authorl337m45732
permlinkre-andablackwidow-rpwi4n
categoryhive-167922
json_metadata{"tags":["hive-167922"],"app":"peakd/2023.2.2"}
created2023-02-11 05:34:00
last_update2023-02-11 05:34:00
depth1
children0
last_payout2023-02-18 05:34:00
cashout_time1969-12-31 23:59:59
total_payout_value0.014 HBD
curator_payout_value0.014 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length35
author_reputation330,935,149,126,765
root_title"Inside HIVE to HBD conversions (slightly technical)."
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id120,676,070
net_rshares51,346,645,744
author_curate_reward""
vote details (3)
@solymi ·
$0.03
Thanks a lot for this. This makes it so much easier to understand. Bookmarked to rub it under people's noses who don't know lol.

<sub>I found this post by browsing [Threads](https://leofinance.io/threads/@l337m45732/re-leothreads-76k4co). Learn more [about threads](https://leofinance.io/@anomadsoul/threads-the-conversation-starter).</sub>
👍  , ,
properties (23)
authorsolymi
permlinkre-andablackwidow-rpwvzl
categoryhive-167922
json_metadata{"tags":["hive-167922"],"app":"peakd/2023.2.2"}
created2023-02-11 10:33:21
last_update2023-02-11 10:33:21
depth1
children0
last_payout2023-02-18 10:33:21
cashout_time1969-12-31 23:59:59
total_payout_value0.014 HBD
curator_payout_value0.014 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length341
author_reputation177,022,652,745,392
root_title"Inside HIVE to HBD conversions (slightly technical)."
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id120,681,332
net_rshares51,327,331,164
author_curate_reward""
vote details (3)
@tengolotodo ·
$0.03
The devil is in the detail!
This is well wicked and thanks for showing us the workings of hive, that seems to be shrouded in so much mystery!

<sub>I found this post by browsing [Threads](https://leofinance.io/threads/@l337m45732/re-leothreads-76k4co). Learn more [about threads](https://leofinance.io/@anomadsoul/threads-the-conversation-starter).</sub>
👍  , , ,
properties (23)
authortengolotodo
permlinkre-andablackwidow-rpwl1r
categoryhive-167922
json_metadata{"tags":["hive-167922"],"app":"peakd/2023.2.2"}
created2023-02-11 06:37:03
last_update2023-02-11 06:37:03
depth1
children0
last_payout2023-02-18 06:37:03
cashout_time1969-12-31 23:59:59
total_payout_value0.014 HBD
curator_payout_value0.014 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length354
author_reputation390,889,321,095,200
root_title"Inside HIVE to HBD conversions (slightly technical)."
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id120,677,200
net_rshares51,686,064,443
author_curate_reward""
vote details (4)
@thetimetravelerz · (edited)
Hi this is complex and needs some effort to wrap ones head around it but thanks to the detailed explanation this looks something that I would like to explore further.
With this intent I present to you a noob question.
So a hive conversion is different from a hive trade on an internal exchange ?
If so how can one initiate a hive- hbd conversion ?
Is there a interface for that in place ?

<sub>I found this post by browsing [Threads](https://leofinance.io/threads/@l337m45732/re-leothreads-76k4co). Learn more [about threads](https://leofinance.io/@anomadsoul/threads-the-conversation-starter).</sub>
properties (22)
authorthetimetravelerz
permlinkre-andablackwidow-rpzf13
categoryhive-167922
json_metadata{"tags":"hive-167922"}
created2023-02-12 19:20:00
last_update2023-02-12 19:21:33
depth1
children4
last_payout2023-02-19 19:20:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length602
author_reputation168,526,060,635,316
root_title"Inside HIVE to HBD conversions (slightly technical)."
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id120,721,400
net_rshares0
@andablackwidow ·
$0.02
To be honest I don't know if there is any normal front-end that supports conversions. I suspect there is, but I never looked for that functionality. I've myself only used conversions recently for the first time on mainnet and I've executed them with `cli_wallet`. It is not very friendly tool though.
👍  
properties (23)
authorandablackwidow
permlinkre-thetimetravelerz-2023213t264372z
categoryhive-167922
json_metadata{"tags":"hive-167922","app":"ecency/3.0.30-surfer","format":"markdown+html"}
created2023-02-13 01:06:42
last_update2023-02-13 01:06:42
depth2
children1
last_payout2023-02-20 01:06:42
cashout_time1969-12-31 23:59:59
total_payout_value0.012 HBD
curator_payout_value0.012 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length300
author_reputation66,039,169,583,429
root_title"Inside HIVE to HBD conversions (slightly technical)."
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id120,729,534
net_rshares42,354,678,120
author_curate_reward""
vote details (1)
@thetimetravelerz ·
thanks would try that
properties (22)
authorthetimetravelerz
permlinkrq1yn0
categoryhive-167922
json_metadata{"app":"hiveblog/0.1"}
created2023-02-14 04:18:39
last_update2023-02-14 04:18:39
depth3
children0
last_payout2023-02-21 04:18:39
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length21
author_reputation168,526,060,635,316
root_title"Inside HIVE to HBD conversions (slightly technical)."
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id120,763,095
net_rshares0
@engrave ·
$0.02
It's possible via the peakd.com frontend and possibly ecency.com (not checked)
👍  
properties (23)
authorengrave
permlinkre-thetimetravelerz-rq1l7y
categoryhive-167922
json_metadata{"tags":["hive-167922"],"app":"peakd/2023.2.2"}
created2023-02-13 23:28:48
last_update2023-02-13 23:28:48
depth2
children1
last_payout2023-02-20 23:28:48
cashout_time1969-12-31 23:59:59
total_payout_value0.012 HBD
curator_payout_value0.012 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length78
author_reputation298,277,959,066,723
root_title"Inside HIVE to HBD conversions (slightly technical)."
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id120,757,634
net_rshares41,507,179,895
author_curate_reward""
vote details (1)
@thetimetravelerz ·
Oh that would make things a lot easier
properties (22)
authorthetimetravelerz
permlinkrq1ynn
categoryhive-167922
json_metadata{"app":"hiveblog/0.1"}
created2023-02-14 04:19:03
last_update2023-02-14 04:19:03
depth3
children0
last_payout2023-02-21 04:19:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length38
author_reputation168,526,060,635,316
root_title"Inside HIVE to HBD conversions (slightly technical)."
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id120,763,100
net_rshares0