
Following this post from @flauwy, I've been tasked to start the creation of the new 1UP.
As a reminder, @utopian-1UP was an Utopian bot front-runner in which members of the community would decide which are the best posts to vote for. the @utopian-1up would then vote for the best post every 2.4 hours, followed by hundreds of curators in the trail.
function getUA(steem,config,username){
const enc_user=steem.memo.encode(config.memoKey,config.memoUA,"#"+config.bot);
const request = {
url:"https://steem-ua.com:5000/rpc",
method: 'POST',
body:JSON.stringify({
jsonrpc: '2.0',
method: "get_accounts",
id:0,
params: {"user": config.bot, "encrypted_user": enc_user, "accounts": [username]}
})
};
return rp(request);
}
The first step was to encode our account s name using both our own private memo key and 's public key, for authentication, since the API is private.
Once the result fetched and associated with the account information in the session, we can use the UA to determine is the user has the right to cast 1UP-votes (see next section).
It will send the vote to the cloud, and it will be processed before being saved to see if the user is allowed to cast this 1UP-vote.
It will perform the following tests :
If one of these tests fail, an error will be sent back to the user, otherwise, the number votes will be incremented.
As a demonstration speaks more than lots of words, I ve put back online the old Utopian1UP website. You can try by yourself and create a community and link a trail to it for testing purposes.
No votes will be casted do not worry, but it's an offline token so, for safety reasons, I would recommend using a test account.
https://github.com/therealFlauwy/1UP
