How to do an action in a contract to transfer tokens to other user accounts without adding permission? Actually, in dawn3.0 i can use the function like this below, but in dawn 4.0 it doesn't work

            permission_level{ lender, N(active) },
            N(eosio.eos), N(transfer),
            std::make_tuple(lender, _self, shouldback,std::string(""))
  • 1
    What do you mean with “without permission”? If any contract could just take money out of you would be very problematic. What are you trying to accomplish exactly ? Maybe you should start the other way around and start the interaction by making the user transfer money to the contract account ? Commented May 14, 2018 at 11:11
  • thanks for your reply. actually , i want to create a contract and it could pay back the tokens to the other user account in a certain time. “without permission”, i mean the the account related to the contract can have no private key to do such payment action . only in this way, i can do some transaction automatically.
    – Harry Ma
    Commented May 14, 2018 at 12:08
  • 1
    Yeah, so what you should do is make the user transfer tokens to the contract, and then as the contract gets notified of the transfer (see the exchange contract on github.com/EOSIO/eos/blob/…) do what you need. You may need to make it two steps also (first the user "prepares" the transaction calling your contract, then transfers). Then, as the money will be in the contract's account, it can perfectly fire a transfer from its own account back to the user. Commented May 14, 2018 at 20:40
  • Thank you for your excellent answer, it's very useful of me.
    – Harry Ma
    Commented May 15, 2018 at 2:23
  • 1
    I'm voting to close this question as off-topic because it is about outdated pre-launch code.
    – Don
    Commented Jan 17, 2019 at 15:44

1 Answer 1



The new version (dawn-v4.0.0) improved the permissions system which totally makes sense. If you want to do a eosio.token::transfer from your contract you need to add a specific permission for that. Check this:


As Dan said you need to add a permission like this:

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

Then you can still use:

        permission_level{ from, N(active) },
        N(eosio.token), N(transfer),
        std::make_tuple(from, _self, quantity, std::string(""))

And it totally makes sense because you don't want applications transferring your tokens without your consent. So, by the time that I answered this I didn't know that and I just suggested the use of INLINE_ACTION_SENDER because I saw it on the system bandwith routines and thought that it changed, but it's not true. Please stick with the regular action.send you just need a permission.

Although, if you want to follow the best practices for the eosio.token::transfer check this answer:


You need to "listen" the transfer for your contract and have a balance control for your users, so you can use their tokens for whatever action you need!


Did you try the INLINE_ACTION_SENDER already? You need the permission of the lender of course.

INLINE_ACTION_SENDER(eosio::token, transfer)( N(eosio.token), {payer,N(active)},
                                                 { payer, N(eosio), quant, std::string("buy ram") } );

There's no way to execute an action with different permission than the one that you have from the current action. Maybe _self works but I don't think so.

  • Thank you for your help. actually , it's because of the new permission name in the latest version . and Daniel told me that i should use the new permission name "eosio.code" by using command "cleos set account permission..." and it worked for me. maybe your method is also correct and i will try it later.
    – Harry Ma
    Commented May 18, 2018 at 1:45
  • you are right, my answer is not correct at all, I'm in the bed already but tomorrow ill update my answer with the correct steps Commented May 18, 2018 at 2:24
  • Hi, i tried the new version from Dan to set my permission but i get always the error 3030000 and "unknown key" i tried every key i have but nothing works somehow.
    – Mangooxx
    Commented May 20, 2018 at 16:00
  • You will need to change the parameter of your actions from account_name to just name Commented May 20, 2018 at 16:10
  • hmmmm changed every paramter as you said but still the same error but still thank you for your help
    – Mangooxx
    Commented May 20, 2018 at 16:43

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