Proposal #39 - DevPortal Documentation Update - SMT Research

Words
328
Reading
2 min
Listen
Play
7y

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:

https://github.com/steemit/steem/pull/3537

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",
  "params":{"start":{},"limit":10,"order":"by_symbol"},
  "id":1
}' https://testnet.steemitdev.com | 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
}
Proposal #39 - DevPortal Documentation Update - SMT Research | Ecency