Smt hard fork testing report #3 : 400 000 smts are live on the testnet !

in #proposal4 years ago (edited)

Hello everyone !

I am back with another smt testing update.

I red more code, and I did quite a bit of back and forth with the steemit team whenever I saw something that seemed odd. I am still a bit perplexed with the nai collision handling algorithm.

Long story short NAIs (numeric asset identifiers) are basically a unique ID that represents SMTS, this is a good way to prevent name squatting and avoid all the problems with handling a naming system directly on-chain.

to quote the smt whitepaper (that can be red here : https://github.com/steemit/smt-whitepaper/blob/master/smt-manual/manual.md it is mostly up-to-date but there are instances but it's not)

An SMT is referred to by a numerical asset identifier or NAI, consisting of two at-signs followed by nine decimal digits, for example @@314159265. The blockchain enforces that the identifier placed by a UI into the smt_create_operation must match a result from the get_nai_pool RPC. Therefore, an NAI cannot be chosen freely by the SMT creator. It is not even possible to "mine" a "vanity NAI" (analogous to the "vanity Bitcoin address" some people use).

The reason for this restriction is that the blockchain designers want to discourage users from using the consensus level identifiers as symbol names, and instead use a non-consensus directory system to attach human meaningful symbols to assets. Distinguishing a "namesquatter" from the legitimate owner of a brand is not something that a blockchain can do, especially if the squatter is willing to pay the SMT creation fee.

So each NAI is unique, but how many SMTS can you create then ? Won't we run out of NAIS ? Well with the current algorithm behind nais, you can create 25 millions SMTs, a cap that will probably never be reached (or that will make sbd moon by then because of the sheer number of sbd needing to be bought)

Anyways, in order to create an smt an user has to get a nai for its smt, and those nais are pulled from the nai pool, there are only 10 available per block. And if an smt is created during a block the pool will replenish itself.

(you can read this yourself in the repository in this file : https://github.com/steemit/steem/blob/master/libraries/chain/smt_objects/nai_pool.cpp)

Long story short, we try to generate a new nai and add it, if the nai is already used, we generate a new one and try again . If we tried more than 10 times we give up and wait for the next block.

next_sym = util::nai_generator::generate( last_block_id._hash[ NAI_GENERATION_SEED_BLOCK_ID_HASH_INDEX ] + attempts_per_block );

That particular line got me a bit perplexed, last_block_id.hash is an array of 5 elements, I'm not sure why we are only using one element NAI_GENERATION_SEED_BLOCK_ID_HASH_INDEX is 4.

And it got me wondering how reliable that would be to avoid collisions. Let's imagine we have 2.5 million smts running, how often would we have collisions, and what happens if someone empties the nai pool and then it keeps running into collisions for too long ?

Realistically this has an extremely low chance of happening, but I figured it would be a good time to start bulk creating smts to also test the robustness of the other operations.

Smt object lifecycle

An smt goes into a few steps before being fully useable and tradeable.

I'll make another post later on to explain this more deeply but long story short there are 4 important operations :

smt_create

It allows you to create an smt object in the blockchain and "reserve" a nai that will be used for all subsequent operations. This is where you specify the number of decimals you want for your smt.

the minimum is 0, the maximum is 12. To give you an idea, steem/sbd have 3 whereas bitcoin has 8

You can only execute that operation once.

smt_setup_emissions

This is where you specify how your token should inflate (if at all). There are a lot of parameters in this operation including which accounts you want to fund and how much they should have (reward pool, individual accounts etc). This is also where you can setup different inflation curves where for each inflation a different number of tokens will be created.

You can execute that operation as much as you want if you want to have a very specific inflation scheme for your smt (inflate early to fund founders, then fund reward pool, then no more inflation for example).

As mentioned above, this operation is huge and deserves it's own post to explain how it works

smt_setup_ico_tier

This is where you setup all of the details for the ico including soft and hard cap. there are quite a few other operations linked to it so I won't go too much about it now.

smt_setup

This is where you put all of the final elements of your smt. that includes the maximum supply, when the ICO starts and when it ends. and most importantly, when the smt actually launches. to give you an idea here's some of the parameters :

(I skipped a few because they would take too long to explain or are not that important)

                'max_supply': max supply
                'contribution_begin_time' : start of ico 
                'contribution_end_time': end of ico
                'launch_time': launch time where the smt will be live and tradeable
                'steem_units_min': minimum amount of steem to participate in the ico

Creating smt in bulk

So there are just too many different parameters to test, and since I wanted to create millions of SMTS to try to get nai collisions, I figured I might as well go the whole way and made a script that does

smt_create -> smt_setup_emissions -> smt_setup

While randomizing almost all of the parameters so that we can test millions of different configurations at the same time.

So I did just that, you can find the script here :

https://github.com/drov0/hf23-testing/blob/master/bulk_full_setup.js

You can setup more than one emission, so I made a script for that too. The issue is that it significantly slowed the script down as you need to wait for the next block before you can setup another emission, so I split it into another script for later use :

https://github.com/drov0/hf23-testing/blob/master/bulk_full_setup_multiple_emissions.js

So far 400K+ smts have been created

you red that right. 400 000 smts are currently running on the testnet without a hitch ! All of them with random parameters. But it's a bit early to shout victory as a lot of those smts are yet to be launched, the launch date is random so it will take a bit of time (at most a month) before all of those will be generating useables tokens on the testnet.

But it's safe to say that there are already a bunch that are doing that. And the sheer fact that I could create so many without any issues is already a great sign of robustness ! We'll see over the next month how the network will handle such stress. (millions of smts generating and transferring tokens left and right)

I am obviously not gonna stop here and the script is still running, I am still creating even more smts.

you can check out the progress here : https://testnet.steemd.com/@petanque one smt is 1 tbd and I started with 1 005 000 tbd so you do the math to check how many have been created ;)

Please consider voting my proposal and steempress as witness

The reason I'm able to do this work and allocate time to it is thanks to the funds from the sps, but I am not too far from not getting funding again, please consider voting on it or unvoting the return proposal : https://steemproposals.com/proposal/50

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

Sort:  

Ok great. A question - What if I want to do the following:

  1. Launch SMT;
  2. Convert a percentage of advertiser revenue to distribute it to readers;
    How can I do that?

It wouldn't be so hard actually.

First launch an smt, token emission could be an ico or whatever. Ideally the initial setup would fund the internal market.

Then just setup a custom site (wordpress + steempress ? ;)) or a communities powered website (a website that uses the communities protocol). Add ads on top of it (ad provider can be whatever).

Buy tokens with the ad revenue to provide constant upward pressure, then track people who red the article thanks to some auto-login feature. (steem user logs in once on your website to subscribe to the reward program, then he gets tokens whenever he visits the site).

Then you can improve by checking your ad provider api and trying to see which readers bought you the most ad revenue to reward them more etc etc

That is going to make things hard I suppose. It involved a lot of manual input

MMh yeah paying the readers is kinda hard unless you completely own the ad system kinda like brave does. I would start with a system where you pay the writers first.

But my audience is normal mum and dad readers, not bloggers. However, I've realised it's easier to launch a token on Tron and integrate it with WordPress. They have pluggins and wallets that are fast and easy to use. Im going to try it out sometime next week...Once SMTs start, I could do one for bloggers too and see how we go.

Sorry, that would be a useful feature that would make Steem immensely attractive as a platform for serious creators and advertisers looking to support and reach communities more directly.

Thus it is not really meant for Steem which only targets internet trolls and stubborn techies who care more about making their pre-existing solutions work, than building tools that address real needs.

LOLLLL ur funny! your sarcasm went over my head for a second...

Loading...

You can only execute that operation once.

Not strictly true. You can execute the smt_create operation more than once for a given NAI if you want to perform the "reset case." See:

https://developers.steem.io/apidefinitions/#broadcast_ops_smt_create

I ment that more in the usual workflow. didn't want to delve too much into the specific cases. But true.

Yeah, hopefully that'll be a rare situation.

Loading...
Loading...
Loading...
Loading...

hopefully it all works out

Loading...

We need more genius developers to make Steem moon. Our future is in our own hands (or keyboard).

Loading...

I'm glad you are testing this extensively.

Thanks ! doing my best but there are so many moving parts I'm not sure we'll ever have every single case tested.

You likely won't, but the fact that you are putting in this much effort is good.

Im using our nice platforme since 2 years now and the value of my account still weak. Need some supports from you guys i trust on you . Check some of my work and have a look

Congratulations @howo!
Your post was mentioned in the Steem Hit Parade in the following category:

  • Pending payout - Ranked 3 with $ 47,83

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

You distributed more than 33000 upvotes. Your next target is to reach 34000 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

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