EOS Guide: Game Permission

Tikuzero
MonsterEOS
Published in
5 min readSep 17, 2018

This is a quick guide on how to add an extra “games”-Permission, which is controlled by its own private key, so you dont have to use your “active” key, which can do basically everything with your account.

Your EOS account has two default permissions named owner and active. Your active permission is a child of your owner permission. This tells you that your owner permission has full control over your active permission. This is also why it‘s often advised to only use your active permission for daily use and keep your owner key in a cold storage.

The problem is, that if someone comes into possession of your active key, they could immediately transfer all of your liquid tokens. This is why I have created a permission called games, which is only authorized for the actions I specified.

The games permission is controlled by a new private key. So if someone was able to steal this private key, all they could do is interact with a game, but they can’t transfer tokens.

Also note: like you can’t change your owner with your active, because active is a child of owner, games can’t change active, because we create games as a child of active. But your active and owner can change games, because they are parents to games.

Below is simple illustration of this hierarchy of permissions. Each permission can change all permissions that are to its right but not to it’s left.

owner > active > games

Below are the five simple steps you need to take to set up your own custom permission.

Step 1: Create a new keypair

Scatter Desktop 17.09.2018

To generate a new keypair with Scatter Desktop do the following:

  • Blockchains -> New Keypair -> Generate New Keypair
  • Copy your Private Key somewhere safe
  • Copy your Public Key, we will need it later
  • Enter “games” as Name and hit Save Keypair

Step 2: Add the “games” Permission to your account

Change Permission

Enter the following:

  • Account: Your EOS account name
  • Threshold: 1
  • Permission: games
  • Parent: active
  • Authorit: your public key from Step 1 (“EOS…”)
  • Weight: 1

click on “UPDATE” to send the new permission to the blockchain.

To verify everything worked you can go to an explorer like https://eospark.com/ . Your games permission should be listed there now with your active and owner permissions like this:

(keep it open for Step 3)

You just created a permission, which can do exactly nothing :)
To allow your brand new permission to execute your game actions, you need to link Authorizations.

Step 3: Link Authorizations

I will show you how to find and link the actions neccessary on the example of http://monstereos.io/

On your account page on eospark (which you kept open earlier), switch to the “Other Actions” Tab.

The dropdown contains all actions you executed to-date.

For monstereos these are:

  • createpet, awakepet, feedpet, bedpet, destroypet
  • quickbattle, battleleave, battlecreate, battleattack, battlefinish
  • orderask, removeask, claimpet

Inspecting a specific action shows you the contract name, in this case it’s “monstereosio”. You can ignore all actions, that dont have monstereosio as contract name.

And especially make sure to not add any eosio actions like linkauth or transfer, since that would defeat the purpose of your games permission.

Now go to the “Link Auth” tab and enter

  • Account Name: your EOS account name
  • Account Permission: games
  • Contract Name (we found earlier): monstereosio
  • Contract Action (from the dropdown list): awakepet
Link Auth

and hit “LINK AUTH”. After sending the transaction, enter the next Contract Action (createpet, feedpet, …) and repeat until you linked all Actions you need. Below you can find all actions you need to link for monstereos (second and third row optional for batteling and for selling your pets):

  • createpet, awakepet, feedpet, bedpet, destroypet
  • quickbattle, battleleave, battlecreate, battleattack, battlefinish
  • orderask, removeask, claimpet

you can verify in eospark by choosing “linkauth” as action in the dropdown.

Step 4: Fetch Account in Scatter

Open Scatter, choose the keypair we created in Step 1 with the name “games” and hit fetch accounts and click on your account to add it.

Step 5: Verify

Try logging in to Monstereos. You should have the option to choose youraccount@games and execute all actions you linked earlier.

You can also go to https://toolkit.genereos.io/transfer, log in with youraccount@games and try to send some tokens to yourself, which should result in a failure saying “Irrelevant authority included” which means, your permission has no authority to transfer tokens.

Congratulations, you just learned how to create a new keypair, add a new permission to your account and link authorizations.

Also, you now have a keypair, which you can use on mobile and everywhere, without having to fear about your account.

For a more in-depth explanation check out this great read: https://medium.com/coinmonks/eos-permission-management-2c0c1634fe39

--

--