create account

The SMT setup emission operation explained by howo

View this thread on: hive.blogpeakd.comecency.com
· @howo · (edited)
$53.24
The SMT setup emission operation explained
![](https://cdn.steemitimages.com/DQmSxirGVpGknnPi3du7UjDrV8SRGur9c7DEt1fN4ccMEZL/image.png)
Hello everyone ! Today I want to write a bit of explanation on one of the core smt operations:

<center> smt_setup_emissions </center>

This operation is used, as it's name hints, to setup emission/inflation for an smt. In order to use it you must have previously called the `smt_create operation` to create an smt object in the chain to send this operation on.

Now let's look at the operation and it's parameters : 

```
  account_name_type   control_account;
   asset_symbol_type   symbol;

   time_point_sec      schedule_time;
   smt_emissions_unit  emissions_unit;

   uint32_t            interval_seconds = 0;
   uint32_t            interval_count = 0;

   time_point_sec      lep_time;
   time_point_sec      rep_time;

   share_type          lep_abs_amount;
   share_type          rep_abs_amount;
   uint32_t            lep_rel_amount_numerator = 0;
   uint32_t            rep_rel_amount_numerator = 0;

   uint8_t             rel_amount_denom_bits = 0;
   bool                remove = false;
   bool                floor_emissions = false;

   extensions_type     extensions;
```

You can find this in : https://github.com/steemit/steem/blob/master/libraries/protocol/include/steem/protocol/smt_operations.hpp

# the basics 

So first of all, you need to give the operation the information about which smt you want to add emission to : 

(note that the code examples will be in js from now on) 

this is where you set  

- control_account 
with, for example : "howo"

- symbol 
it's an `asset_symbol_type` which is a struct with a nai and a precision, so it would be akin to something like 

 `{'nai': @@280090049, 'precision': 13}`

- schedule_time

This is where you state when the emission starts, there is no end date for the emissions unless you set it in another emission call (we'll get to that later on) 

## Emission units

This is where we start to dive into the interesting parts, emission units define where the inflation actually goes, the structure looks like this : 

```
[
    ['howo', 50],
    ['steempress', 50],
]
```

And that's it ! Here I state that every time there is an emission, 50 tokens will go to me and 50 will go to steempress, you can put steem accounts and there are also three special strings that you can use : 

`$market_maker` : inflation will go to the decentralized market in order to provide liquidity early on 
`$rewards`: Fund the reward pool for your smt, if you don't set this,  your token won't have proof of brain rewards via inflation (you could fund that account via other means like the ico) 
`$vesting`: Fund the vesting rewards 

Since the parameter is an array you can set several inflation destination at the same time.

## Interval_second and interval_count

Okay so we emit x tokens to those emission sources, but how how often ? 

`interval_seconds` sets how often emissions will be triggered, note that the minimum is 21600, aka 6 hours. 
`interval_count` sets a limit on how many times you want to emit.

if you set it to 10 you will only emit 10 times. It's a good way to set a limit to your inflation, or to get all the tokens at once in everyone's hands. 

## Variable emissions, because otherwise it would be too easy 

This is where things get tricky, and I am not 100% sure myself but here's the gist of it, you can refer to the official smt documentation as well if I'm not making enough sense : https://github.com/steemit/smt-whitepaper/blob/master/smt-manual/manual.md#adding-time-modulation

you can set curves for your inflation, in order to have, let's say a decreasing inflation. 

for that you have `lep_time` and `rep_time` to set both ends of the curve, lep stands for left end point, rep right end. 

values are like this : `1970-01-01T00:00:00`

Side note :

- For times before the left endpoint time, the amount at the left endpoint time is used.
- For times after the right endpoint time, the amount at the right endpoint time is used.

Then you have 4 parameters : 

`lep_abs_amount` and `rep_abs_amount` which are the values taken at lep and rep from which we'll get a curve (100 and 0 for instance to make inflation go to 0 over time).

Abs use integer values aka 10, 20, 30

`lep_rel_amount_numerator` and `rep_rel_amount_numerator`which are the same except that they use a different calculation to take advantage of decimals. Hence why they also have the `rel_amount_denom_bits`to bitwise righ shift the value by the number defined.

So do we need to have both defined and what happens if we only want to set the abs and leave the rel alone ? This is where the `floor_emissions` parameter comes in handly. this is basically what it does : 

```
      if ( emission.floor_emissions )
         new_token_supply = std::min( abs_amount, rel_amount );
      else
         new_token_supply = std::max( abs_amount, rel_amount );
```

If floor emission is set to true, it will take the minimum value between the calculated absolute value and the calculated relative value otherwise it will take the biggest of the two. So if you want to use only abs emission, set `lep_rel_amount_numerator` and `rep_rel_amount_numerator` to 0 and  `floor_emissions` to false.


# Adding multiple emissions 

phew almost done !  Now here's an interesting thing about emissions, you don't have to have a single emission model, you can have several ones ! So you can reward early adopters with a high reward pool inflation and then switch to a model where it's more normal but inflation to vesting is now favored. 

You can have as many inflation as you want but they need to be 6 hours apart from each others. 

# Deleting an emission 

Finally there is one last parameter : `delete` if set to true, it will delete the emission model that you previously submitted. Quite useful if you found out that there is a parameter that isn't right huh ? 

# conclusion 

You can find a complete example for this on my hard fork 23 tests here : https://github.com/drov0/hf23-testing/blob/master/bulk_full_setup.js

The reason I'm able to do this work and allocate time to it is thanks to the funds from the sps, please consider voting on it or unvoting the return proposal : https://steemproposals.com/proposal/50 every bit counts !

And finally I am also doing this as part of the witness @steempress if you like what I'm doing please consider voting on it as well. Every bit counts ! It will take you but a few minutes but will greatly help me test the network and the more we test the more steemit and the witnesses will feel confident enough to launch on the main net
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 239 others
👎  , ,
properties (23)
authorhowo
permlinkthe-emission-operation-explained
categorysmt
json_metadata{"tags":["emission","documentation"],"users":["steempress"],"image":["https://cdn.steemitimages.com/DQmSxirGVpGknnPi3du7UjDrV8SRGur9c7DEt1fN4ccMEZL/image.png"],"links":["https://github.com/steemit/steem/blob/master/libraries/protocol/include/steem/protocol/smt_operations.hpp","https://github.com/steemit/smt-whitepaper/blob/master/smt-manual/manual.md#adding-time-modulation","https://github.com/drov0/hf23-testing/blob/master/bulk_full_setup.js","https://steemproposals.com/proposal/50"],"app":"steemit/0.1","format":"markdown"}
created2020-01-05 18:39:39
last_update2020-01-05 21:13:00
depth0
children10
last_payout2020-01-12 18:39:39
cashout_time1969-12-31 23:59:59
total_payout_value28.635 HBD
curator_payout_value24.608 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length6,620
author_reputation511,962,302,102,641
root_title"The SMT setup emission operation explained"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id94,068,104
net_rshares178,789,089,595,308
author_curate_reward""
vote details (306)
@arcange ·
Congratulations @howo!
Your post was mentioned in the [Steem Hit Parade](/hit-parade/@arcange/daily-hit-parade-20200105) in the following category:

* Pending payout - Ranked 2 with $ 52,49
properties (22)
authorarcange
permlinkre-the-emission-operation-explained-20200105t170243000z
categorysmt
json_metadata""
created2020-01-06 16:04:09
last_update2020-01-06 16:04:09
depth1
children0
last_payout2020-01-13 16:04:09
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_length190
author_reputation1,146,606,601,469,178
root_title"The SMT setup emission operation explained"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id94,099,899
net_rshares0
@borislavzlatanov ·
$0.21
Thanks for doing all this. 

Are you going to compile all the documentation you're creating in some more formal way? Like @intertia's documentation website?
👍  
properties (23)
authorborislavzlatanov
permlinkq3ondo
categorysmt
json_metadata{"users":["intertia"],"app":"steemit/0.1"}
created2020-01-06 11:17:51
last_update2020-01-06 11:17:51
depth1
children1
last_payout2020-01-13 11:17:51
cashout_time1969-12-31 23:59:59
total_payout_value0.103 HBD
curator_payout_value0.102 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length156
author_reputation23,431,256,721,057
root_title"The SMT setup emission operation explained"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id94,091,672
net_rshares1,119,382,461,697
author_curate_reward""
vote details (1)
@howo ·
$0.02
Mmmh I was thinking of actually putting it on the devportal (aka inertia's website, although it's a steemit funded initiative at first), but most of the data is already formatted here :  https://github.com/steemit/smt-whitepaper/blob/master/smt-manual/manual.md#adding-time-modulation

And for now my time is better spent actually testing than documenting, as writing stuff like this takes quite some time.
👍  
properties (23)
authorhowo
permlinkq3pgpb
categorysmt
json_metadata{"links":["https://github.com/steemit/smt-whitepaper/blob/master/smt-manual/manual.md#adding-time-modulation"],"app":"steemit/0.1"}
created2020-01-06 21:51:15
last_update2020-01-06 21:51:15
depth2
children0
last_payout2020-01-13 21:51:15
cashout_time1969-12-31 23:59:59
total_payout_value0.010 HBD
curator_payout_value0.010 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length406
author_reputation511,962,302,102,641
root_title"The SMT setup emission operation explained"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id94,112,768
net_rshares126,347,706,501
author_curate_reward""
vote details (1)
@crypto.piotr ·
Amazing piece of work @howo

I'm far from capable to understand all technicalities, however I can roughly see how useful this content can be for many.

Upvote on the way. And will vote on your sps proposal in a minute.

Would you mind telling me if blockchain is your passion or is your work somehow related to this topic as well? Just curious :)

Yours, Piotr
properties (22)
authorcrypto.piotr
permlinkq4j8wp
categorysmt
json_metadata{"users":["howo"],"app":"steemit/0.1"}
created2020-01-22 23:50:54
last_update2020-01-22 23:50:54
depth1
children0
last_payout2020-01-29 23:50:54
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_length360
author_reputation27,396,789,428,606
root_title"The SMT setup emission operation explained"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id94,664,453
net_rshares0
@cryptocurator ·
$0.06
Great work @howo looks impressive explanation. I am non technical and followed your commentary pretty well.

Posted using [Partiko iOS](https://partiko.app/referral/cryptocurator)
👍  
properties (23)
authorcryptocurator
permlinkcryptocurator-re-howo-the-emission-operation-explained-20200105t191833056z
categorysmt
json_metadata{"app":"partiko","client":"ios"}
created2020-01-05 19:18:33
last_update2020-01-05 19:18:33
depth1
children1
last_payout2020-01-12 19:18:33
cashout_time1969-12-31 23:59:59
total_payout_value0.031 HBD
curator_payout_value0.031 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length179
author_reputation29,866,721,457,384
root_title"The SMT setup emission operation explained"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id94,069,719
net_rshares367,530,707,856
author_curate_reward""
vote details (1)
@howo ·
Thanks ! Glad to hear that you could follow, it was mostly aimed at technical people so it's a great sign :)
properties (22)
authorhowo
permlinkq3t69y
categorysmt
json_metadata{"app":"steemit/0.2"}
created2020-01-08 21:56:21
last_update2020-01-08 21:56:21
depth2
children0
last_payout2020-01-15 21:56: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_length108
author_reputation511,962,302,102,641
root_title"The SMT setup emission operation explained"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id94,200,657
net_rshares0
@jekhy ·
The SMT setup emission operation explained
Thanks for the post[.](https://koreanfoodie.me/34)
properties (22)
authorjekhy
permlinkre-howo-the-emission-operation-explained-20200109t032452303z
categorysmt
json_metadata{"tags":["just_a_test"]}
created2020-01-09 03:24:51
last_update2020-01-09 03:24:51
depth1
children0
last_payout2020-01-16 03:24:51
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_length50
author_reputation-110,666,590,404
root_title"The SMT setup emission operation explained"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id94,207,231
net_rshares0
@sanat ·
Great work, I am sure community developers will find these tests and infos useful
properties (22)
authorsanat
permlinkre-howo-2020115t15542790z
categorysmt
json_metadata{"tags":["emission","documentation"],"app":"esteem/2.2.2-surfer","format":"markdown+html","community":"esteem.app"}
created2020-01-15 13:54:03
last_update2020-01-15 13:54:03
depth1
children0
last_payout2020-01-22 13:54: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_length81
author_reputation2,167,003,527,810
root_title"The SMT setup emission operation explained"
beneficiaries
0.
accountesteemapp
weight300
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id94,425,768
net_rshares0
@steemitboard ·
Congratulations @howo! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

<table><tr><td><img src="https://steemitimages.com/60x70/http://steemitboard.com/@howo/votes.png?202001070358"></td><td>You distributed more than 34000 upvotes. Your next target is to reach 35000 upvotes.</td></tr>
</table>

<sub>_You can view [your badges on your Steem Board](https://steemitboard.com/@howo) and compare to others on the [Steem Ranking](https://steemitboard.com/ranking/index.php?name=howo)_</sub>
<sub>_If you no longer want to receive notifications, reply to this comment with the word_ `STOP`</sub>



###### [Vote for @Steemitboard as a witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1) to get one more award and increased upvotes!
properties (22)
authorsteemitboard
permlinksteemitboard-notify-howo-20200107t083408000z
categorysmt
json_metadata{"image":["https://steemitboard.com/img/notify.png"]}
created2020-01-07 08:34:06
last_update2020-01-07 08:34:06
depth1
children0
last_payout2020-01-14 08:34:06
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_length834
author_reputation38,975,615,169,260
root_title"The SMT setup emission operation explained"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id94,129,644
net_rshares0
@tts ·
To listen to the audio version of this article click on the play image.
[![](https://s18.postimg.org/51o0kpijd/play200x46.png)](http://ec2-52-72-169-104.compute-1.amazonaws.com/howo__the-emission-operation-explained.mp3)
Brought to you by [@tts](https://steemit.com/tts/@tts/introduction). If you find it useful please consider upvoting this reply.
👎  ,
properties (23)
authortts
permlinkre-the-emission-operation-explained-20200105t190121
categorysmt
json_metadata""
created2020-01-05 19:01:21
last_update2020-01-05 19:01:21
depth1
children0
last_payout2020-01-12 19:01: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_length348
author_reputation-4,535,154,553,995
root_title"The SMT setup emission operation explained"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id94,069,009
net_rshares-52,031,473,618
author_curate_reward""
vote details (2)