4

For example, say I wanted to create a custom permission called delegatee. An account with this permission would be only permitted to preform certain actions within my contract. Is this possible as of right now? I'm having trouble finding any documentation on the topic.

Also, if the above IS possible, could it be possible to modify an account's permissions through an action to have this permission.

The only way this seems possible to give an account the permission is if I had their Active/Owner key which would be insecure to send to my DAPP via a action. (transactions being public and all)

1 Answer 1

1

The article "EOS Permission Management" on Coinbase explains how to set up permissions with an example for an action for claiming rewards.

To do this you need to run the following command using cleos:

cleos set account permission PRODUCERACCT claimer '{"threshold":1,"keys":[{"key":"YOUR_PUB_KEY","weight":1}]}' "active" -p PRODUCERACCT@active

PRODUCERACCT is the 12 character account name that will collect the rewards, claimer is the name of the new permission, "key":"YOUR_PUB_KEY","weight":1 is the new public key, with a weight of 1, that has the new permission and "active" -p PRODUCERACCT@active means that the parent permission of the new permission is the active permission.

After running the command above you need to link the permission to a certain action. To do this you need to run the following command.

cleos set action permission PRODUCERACCT eosio claimrewards claimer

Running this command links the claimrewards action to the claimer permission, eosio is the smart contract.

If you have made a dApp that is usable from the web, then these permissions can be set using Scatter, then you wouldn't need their Active/Owner keys.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.