Proposal #39 - DevPortal Documentation Update - SMT Research

in #steemdao4 months ago (edited)

No documentation pull requests this week. Some work is ready but I thought I'd hold off until I had more to submit at once. I spent most of my time continuing to researching SMTs, thanks this week's testnet launch by Steemit, Inc.

TL;DR: My research process works and I have high confidence in the detail I can gather from code.

In fact, while I was fiddling with the testnet, I managed to create an SMT. It's nothing special. Just a single operation to define the asset and park it. I wanted to make sure my research process was accurate. This is because I'm primarily reading the source code to translate it to the devportal for more detailed API definitions.

Once I figured out how to create an SMT, I tried broadcasting it. But I found a bug:

{"error":"network_broadcast_api.broadcast_transaction: Assert Exception:symbol.decimals() == precision: Mismatch between redundantly provided precision 3 vs 0"}

At first, I thought the bug was in my broadcast. But it turns out, the bug was in steemd. Apparently, there was no way to express asset precision in a broadcast other than zero precision. The blockchain supports non-zero precision. It probably works when you use the CLI wallet, though I didn't test that specifically. But when you used a normal signed broadcast, it didn't pick up the precision I wanted.

In order to test this, I tried setting both redundant precision op values to zero, which worked. I managed to create an SMT with zero precision, meaning it would only allow non-fractional amounts. But I know people are going primarily to want to have fractional amounts, so I created a pull request to fix steemd. It's my first steemd contribution:

It's not complicated at all, just a simple fix to a one-line oversight. And in researching this, I found out that you can also change precision for an existing SMT, so long as you use a fee to zero and have not yet issued any emissions for the SMT asset.

Here's my SMT, currently in testnet block # 225263:

curl -s --data '{
  "jsonrpc": "2.0",
  "method": "database_api.list_smt_tokens",
}' | jq
  "jsonrpc": "2.0",
  "result": {
    "tokens": [
        "token": {
          "id": 0,
          "liquid_symbol": {
            "nai": "@@422838704",
            "decimals": 0
          "control_account": "inertia",
          "phase": "setup",
          "current_supply": 0,
          "total_vesting_fund_smt": 0,
          "total_vesting_shares": 0,
          "total_vesting_fund_ballast": 0,
          "total_vesting_shares_ballast": 0,
          "pending_rewarded_vesting_shares": 0,
          "pending_rewarded_vesting_smt": 0,
          "reward_balance": {
            "amount": "0",
            "precision": 3,
            "nai": "@@000000021"
          "recent_claims": "0",
          "last_reward_update": "1970-01-01T00:00:00",
          "last_virtual_emission_time": "1970-01-01T00:00:00",
          "allow_downvotes": true,
          "market_maker": {
            "steem_balance": {
              "amount": "0",
              "precision": 3,
              "nai": "@@000000021"
            "token_balance": {
              "amount": "0",
              "precision": 0,
              "nai": "@@422838704"
            "reserve_ratio": 0
          "allow_voting": true,
          "cashout_window_seconds": 3600,
          "reverse_auction_window_seconds": 900,
          "vote_regeneration_period_seconds": 432000,
          "votes_per_regeneration_period": 50,
          "content_constant": "2000000000000",
          "percent_curation_rewards": 2500,
          "author_reward_curve": "linear",
          "curation_reward_curve": "square_root",
          "max_supply": 0
  "id": 1


upvoted, resteemed and i made a little image template for you personalized for your work :)

Congratulations @inertia! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You distributed more than 27000 upvotes. Your next target is to reach 28000 upvotes.

You can view your badges on your Steem Board and compare to others on the Steem Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

To support your work, I also upvoted your post!

Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Hi, @inertia!

You just got a 0.98% upvote from SteemPlus!
To get higher upvotes, earn more SteemPlus Points (SPP). On your Steemit wallet, check your SPP balance and click on "How to earn SPP?" to find out all the ways to earn.
If you're not using SteemPlus yet, please check our last posts in here to see the many ways in which SteemPlus can improve your Steem experience on Steemit and Busy.

This post has been included in the latest edition of The Steem News - a compilation of the key news stories on the Steem blockchain.

Hi! Thank you for your hard works.

you created SMT token!
Do you have a plan to write a tutorial for creating SMT token?
I am looking forward to create my own SMT token!