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 :
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.
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
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.
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 :
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 :
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