Hey all, recently I've been testing the SMT testnet to see if I can get a toy condenser to interact with one, much like how nitrous interacts with the Scotbot. Here I will document my process for getting to a state where I could start testing the creation of the SMT, and basic operations like powering up and voting with an SMT asset.
I was able to do the following until a testnet crash:
- SMT creation (via wizard)
- SMT RC delegation to enable token emissions (and sending some to reward account and individual account)
- SMT token power up operation
- SMT comment operation enabling SMT
- SMT vote operation
Notes and Prerequisites
Current version of steem keychain needs a local modification to use the new chain-id for the TESTNET setting. (Download as zip from https://github.com/MattyIce/steem-keychain, find js/libs/rpc.js and find the line setting chain ID for the testnet setting, load locally using chrome://extensions, "Load unpacked").
The keychain also needs a version of steem-js that contains SMT ops serialization. It means placing https://cdn.jsdelivr.net/npm/steem/dist/steem.min.js (currently has SMT ops) in the vendor/ folder of the steem keychain and loading it manually.
In addition (for the transfer to vesting, and likely other transfer ops), need to wait for fix for this bug (I npm built steem-js manually after commenting out the problematic line to continue): https://github.com/steemit/steem-js/issues/470
Getting Test SBD / TBD
In order to create SMTs, there is a creation fee of 1.000 TBD. The testnet is bootstrapped with some amount of corresponding funding of TESTS, but no TBD. In order to get TBD, I opted to create a post and vote with my TESTS stake and get author rewards for soon-to-pay-out posts. On the testnet, the cashout window is 1 day, so as operations are being streamed from the mainnet, it is quicker to identify posts that pay out sooner.
Identifying Posts to Vote
Update: forgot that I only get curation rewards which is pure TESTS. Actually need to create and vote a post.
To see what's trending, can use a live UI or... (copying and tweaking a network request from mainnet)
fetch("https://testnet.steemitdev.com/",
{"credentials":"omit","headers":{"accept":"application/json, text/plain, */*","accept-language":"en-US,en;q=0.9",
"content-type":"application/json"},
"body":"{\"id\":7,\"jsonrpc\":\"2.0\",\"method\":\"call\",\"params\":[\"condenser_api\",\"get_discussions_by_trending\",[{\"tag\":\"\",\"limit\":20}]]}",
"method":"POST"});
Update (1/24): when testnet steemd is not using tags/follow API (which is now the case), cannot fetch trending in this way. Instead, probably just trail https://testnet.steemd.com/
Post/Vote
To do the post and vote, I just used the relevant sections of
https://eonwarped.github.io/steem/sk/main.html
using the modified local keychain as described above, connecting to TESTNET.
Note for post need to populate author, title, permlink, parent_perm (category), body, and json_metadata (can use {}).
Claim rewards
After the post pays out, can claim using the following keychain command:
window.steem_keychain.requestBroadcast("eonwarped",
[["claim_reward_balance",
{"account":"eonwarped","reward_sbd": "24.305 TBD", "reward_steem": "0.000 TESTS", "reward_vesting_steem": "55.256 TESTS"}]],
"Posting", x => console.log(x))
And to see reward balance, can use
fetch("https://testnet.steemitdev.com/", {"credentials":"omit","headers":{"accept":"application/json, text/plain, */*","accept-language":"en-US,en;q=0.9","content-type":"application/json"},
"body":"{\"id\":7,\"jsonrpc\":\"2.0\",\"method\":\"call\",\"params\":[\"condenser_api\",\"get_accounts\",[[\"eonwarped\"]]]}","method":"POST"});
Test Proposal Funding
This isn't strictly needed, but would help not having to worry about continuing to vote on testnet for funds. Mileage may vary dependent on other usage of it (I was the only one using this at the time).
Create proposal
Example:
window.steem_keychain.requestBroadcast("eonwarped",
[["create_proposal",{"creator":"eonwarped","receiver": "eonwarped", "start_date": "2020-01-20T03:53:00", "end_date": "2020-03-20T03:53:00", "daily_pay": "1000.000 TBD", "subject": "eon test testnet proposal", "permlink": "nitrous-v1-0-11-autoclaim-on-jan-22"}]],
"Active", x => console.log(x))
List proposals
fetch("https://testnet.steemitdev.com/", {"credentials":"omit","headers":{"accept":"application/json, text/plain, */*","accept-language":"en-US,en;q=0.9","content-type":"application/json",
"body":"{\"id\":7,\"jsonrpc\":\"2.0\",\"method\":\"call\",\"params\":[\"condenser_api\",\"list_proposals\",[[\"\"], 10, \"by_creator\"]]}","method":"POST"});
Vote Proposal
To vote the proposal just made, can then use the vote proposal section of the keychain test page: https://eonwarped.github.io/steem/sk/main.html
Note that votes are tallied at an hourly maintenance window, as in the mainnet.
SMT Testing
SMT Creation
I just used https://smtwizard.steemitdev.com/ with an account I did not mind possibly exposing active key credentials (since it uses active key sign and send the tx).
There's a bunch of settings here I haven't taken the time to fully understand yet but to get what I wanted I disabled the ICO phase (min unit 0) and set all times to be the same. Emissions-wise I set up funding to go to my test account and the rewards fund.
RC Delegation to Pool
In order for the token to begin token emissions, it needs RCs delegated to it.
Below, "000000037" is the nai for VESTS, and "803407266" is the nai for the SMT that I created.
window.steem_keychain.requestBroadcast("eonwarped",
[["custom_json",{"id": "rc", "required_auths": ["eonwarped"],
"json": JSON.stringify([
"delegate_to_pool",
{"from_account":"eonwarped","to_pool": "@@803407266",
"amount": {symbol: "VESTS", amount: "1848808844", precision: 6, nai: "@@000000037"}}])}]],
"Active", x => console.log(x))
Now to wait for emissions, which I believe is can be at most once per 6 hours.
SMT Info
Find SMT's with supply
This is something quick for looping through SMTs and finding what has active supply, and then listing balances for a given account for that SMT. This could be adapted for finding other related info about the token, etc.
Gist:
Paste in console, and call get_bal({})
List SMT Emissions
Use this as an example to call the SMT Emissions endpoint.
fetch("https://testnet.steemitdev.com/", {"credentials":"omit","headers":{"accept":"application/json, text/plain, */*","accept-language":"en-US,en;q=0.9","content-type":"application/json"},
"body":"{\"id\":2,\"jsonrpc\":\"2.0\",\"method\":\"call\",\"params\":[\"database_api\",\"find_smt_token_emissions\",{\"asset_symbol\": {\"nai\": \"@@825672727\", \"precision\": 3}}]}","method":"POST"});
SMT Operations
Transfer to Vesting for SMT asset
window.steem_keychain.requestBroadcast("eonwarp",
[["transfer_to_vesting",{"from":"eonwarp","to": "eonwarp", "amount": "0.500 @@862656508"}]], "Active", x => console.log(x))
Note how SMT is referenced in the amount field.
Creating a post that allows voting for SMT
I modified condenser to make such a post, which requires adding a comment option for the SMT as a votable asset.
The line above shows the format for the extension. This requires the newer steem-js library with the SMT ops.
Voting with the SMT
The above link has the modification I used to do vote2 ops, but can also be done with this:
window.steem_keychain.requestBroadcast("eonwarp",
[["vote2",{"voter":"eonwarp","author": "ewd", "permlink": "test", "rshares": [[{nai: "@@862656508", precision: 3}, 10]]}]],
"Posting", x => console.log(x))
Crash
And after that, the testnet crashed, but that was an interesting process to go through. My end goal is to get a test condenser that links to such an SMT for a testnet. Hopefully this helps with others that are looking to do something similar. Cheers, and happy testing! (Hopefully soon something will be up for other non-technical folks to poke around, but for now it's quite early)