1

I'm trying to create a custom permission and push an action on my contract, but experience problems with authorization. Alice.acc is the account where the contract is set to. Giveprm is the custom permission level. The two versions I have tried are:

require_auth2(permission_level{N(alice.acc),N(giveprm) }); 

and

require_auth(permission_level{N(alice.acc),N(giveprm)});

When trying to access function increment, which takes no arguments, I wish to use account alice@active, so I have permissions on account alice.acc as this:

cleos get account alice.acc 
privileged: false
permissions: 
 owner     1:    1 EOS77dNi2z2nSrwuVrdGX7QHPyohfHwLeSeZo8CbU3yZKWarbHTSv
    active     2:    2 alice@active, 1 bob@active, 
       giveprm     2:    2 alice@active, 1 bob@active, 

Calling the function like:

  cleos push action alice.acc increment '""' --permission alice@active 

But I'm getting error

 Error 3090004: missing required authority
 Ensure that you have the related authority inside your transaction!;
 If you are currently using 'cleos push action' command, try to add the     relevant authority using -p option.
 Error Details:
 missing authority of alice.acc/giveprm

Am I using require_auth in an incorrect way, or is there a problem with the permissions on the account? Thank you!

  • Try alice@owner a go instead, might not be able to add such a permission with only the active permission. – John Williamson Jun 28 '18 at 8:15
  • @JohnWilliamson This shouldn't be an issue with permission level between active and owner - since it's not changing any permission levels. What I'm specifically trying to do is to use a restricted permission (my maybe not so adequately named) giveprm to access this function, but can't figure out how that's done. – Karl Lundin Jun 29 '18 at 3:07
1

For every transaction, we need to have at least one signer to bill the net and cpu.

And unless we link the action with alice@active permission, the minimum required authority is active.

Try the following command:

cleos set action permission alice.cc alice.cc increament alice@active

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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