4

Some major questions I have:

  • What does eosio.code mean?
  • When do we require eosio.code?
  • Why it is not mentioned in the official EOSIO developer's documentation?
3
1

Please refer to official documentation: https://developers.eos.io/welcome/latest/getting-started/smart-contract-development/adding-inline-actions/#step-1-adding-eosiocode-to-permissions

1

What does eosio.code mean?

eosio.code is a special permission that can be used to allow the smart contract to call an action without the authorization of a specific user. It is used to allow smart contracts to call inline actions.

When do we require eosio.code?

You need to include the eosio.code permission on any smart contract that will be calling inline actions. Usually it is added as an additional permission to the active key permission, you can do this several ways:

Using cleos with --add-code

cleos set account permission CONTRACT active --add-code -p CONTRACT

Using cleos without --add-code

This assumes that you have a simple key running on active permission, if this isn't the case then the JSON payload has to be adjusted accordingly.

cleos set account permission CONTRACT active '{"threshold":1, "keys":[{"key":"YOUR_PUBLIC_KEY_HERE", "weight":1}], "accounts":[{"permission":{"actor":"CONTRACT","permission":"eosio.code"}, "weight":1}], "waits":[]}' owner -p CONTRACT

Why is it not mentioned in the documentation

It is, but perhaps it wasn't at the time of posting the question.

0

If you are mentioning about eosio.code please refer to this.

https://github.com/EOSIO/eos/issues/3013#issuecomment-388983168

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.