SBD Printing Code Walkthrough

STEEM code walkthrough.png

This post is a code walkthrough of claims I've made in this post about SBD, this post about the debt ratio, and this post about SBD and STEEM supply at higher market prices. The beauty of it all is that STEEM code is open source, so anyone can verify any claims made about its behavior.

Author SBD Payout

You can start to chase the code for SBD Payouts, and specifically the author payout here, which is in the middle of the function that separates curation reward from author reward.

This is the function that converts the assigned steem to SBD.

auto to_sbd = ( gpo.sbd_print_rate * steem.amount ) / STEEMIT_100_PERCENT;

Here, to_sbd reprents the amount of STEEM that should be converted to SBD. Pay attention to the sbd_print_rate. In normal conditions when the debt-ownership ratio is below threshold, sbd_print_rate is equal to STEEMIT_100_PERCENT, e.g. all of the STEEM intended for the SBD portion of the payout is converted to SBD.

auto to_steem = steem.amount - to_sbd;

Here, to_steem represents what will remain as STEEM (if the blockchain decides to start limiting SBD production).

auto sbd = asset( to_sbd, STEEM_SYMBOL ) * median_price;

Here is the logic to actually convert. Multiplies the amount of STEEM (to_sbd) by the median price feed (represents USD price per STEEM).

  • Thus, the SBD Portion of the payout is entirely dependent on the median price feed, and moreover, does not take into account SBD market rates.

Nor should it account for SBD market rate, because SBD is hard coded to represent 1 USD worth of STEEM, and it's up to the market and monetary policy to attempt to maintain the peg. And as I've mentioned in this post, the peg is easier to maintain as STEEM's price rises.

Debt Ownership Ratio Computation

Now if you've followed my discussion of debt-ownership ratio, this portion is a deeper dive into the code and verifying how the SBD print cap works.

Recall in the previous section that sbd_print_rate controls how much of your intended SBD payout will actually be converted to SBD, and this rate is usually at 100%.

The sbd_print_rate above is updated here, which is one of the first things that is adjusted before crawling through all the comments, and you can see its invocation here.

As the white paper mentions, the ceiling caps are computed in terms of virtual STEEM supply, and the computation is as follows:

virtual_supply = current_supply + (current_sbd_supply / median_price);

I've modified the line above to boil down to essentials. Virtual supply and current supply are in STEEM. If you are actually following, you'll note that it actually uses the * symbol, but it has been overloaded to mean "convert", and I made a noob mistake of not checking the operators for these C++ objects (Yes, I signed up for github just to ask that question).

auto percent_sbd = (current_sbd_supply / median_price) * 
    STEEMIT_100_PERCENT / virtual_supply;

Also slightly tweaked to clean it up a bit. It simply finds the ratio of the SBD portion of the virtual supply over the entire virtual supply.

Now we get to the actual ceiling cap portion:

if( percent_sbd <= STEEMIT_2_PERCENT )
  sbd_print_rate = STEEMIT_100_PERCENT;
else if( percent_sbd >= STEEMIT_5_PERCENT )
  dgp.sbd_print_rate = 0;
else
  dgp.sbd_print_rate = ( ( STEEMIT_5_PERCENT - percent_sbd ) * 
      STEEMIT_100_PERCENT ) / ( STEEMIT_5_PERCENT - STEEMIT_2_PERCENT );
  }

I've replaced the constants above with the hard coded percentages found here.

The SBD portion of the virtual supply is computed using the witness median price feed. If the median price feed is higher than the actual market rate, it will basically under-report the SBD ratio, which increases the ceiling and allows more SBD to be printed. Which by the way, would go against the intended function of the ceiling (based on market ratios).

The main takeaway?

  • If the SBD's portion of the virtual supply exceeds 2 percent, we start to throttle the SBD production, and at 5 percent, SBD stops being produced altogether. (We get paid in STEEM instead).

Current Ratios

These values are nabbed from steemd.com as of 12/30:

virtual_supply 263,626,318.187 STEEM
current_supply 261,992,170.411 STEEM
current_sbd_supply 4,627,906.502 SBD
feed_price
   base  2.832 SBD
   quote 1.000 STEEM

Remember, feed price is supposed to represent the market price of STEEM, though it says SBD here. Which is still accurate, because to the blockchain SBD is equivalent to 1 USD. Sample computations of the feed price you can find e.g. here.

The white paper mentions that the STEEM accounts for STEEM POWER as well as liquid STEEM.

What is the current debt ratio then?

4,627,906.502 / 2.832 / 263,626,318.187 ~ 0.0062

Or 0.62%. So we're in good shape. But keep in mind the natural state is that on payout you have 50/50, so as time goes on, all other things equal (if the price of STEEM stays flat), this debt ratio increases.

In any case, the hesitance on the part of the witnesses to increase the price feed beyond market to accelerate SBD printing is not unfounded. If the debt ratio becomes high, none of us will get SBD at payout! The white paper mentions that any adjustments to the feed should be gradual, as it may have unintended consequences in the long term.

Summary

I've summarized the main conclusions below:

  • The SBD Portion of the payout is entirely dependent on the median price feed, and moreover, does not take into account SBD market rates.
    • This also bears repeating: The higher the STEEM rate, the higher the rate of SBD printing. Think about that.
  • If the SBD's portion of the virtual supply (computed based on price feed) exceeds 2 percent, we start to throttle the SBD production, and at 5 percent, SBD stops being produced altogether.
  • Right now the debt ratio is 0.6%. This slowly increases over time if STEEM's price is not increasing.

What does this mean for the average user? The reason I went on this journey was to investigate the state of SBD. It all boils down to this:

  • Don't HODL SBD and expect it to rise like Bitcoin. It won't. That's explained here.

Happy to answer any questions if you have any below. I know this isn't really for most audiences, but I really wanted to back up my recent claims with the actual source.

H2
H3
H4
3 columns
2 columns
1 column
25 Comments