1

Imagine I have account A and account B.

Account A is the "owner" of B and A wants to deny EOS Transfers for Account B and allow all other Actions(that means A should have full "active" operations)?

MultiSig solution is not an option.

There Exists "Transfer" permission but it seems not working for EOS.

  • «Account A is the "owner" of B»? What do you mean by that? There is no way an account can be the owner of another account. An account is an account and there are keys and permission associated to an account, but there is no way an account can be the owner of another account. – StR Aug 8 at 21:45
  • A better way is to make B a contract and reject transfer to others, I think it's worthy to create a contract to store big money, I can provide you the contract if you trust – Jimmy Guo Aug 17 at 4:20
1

Create simple contract for AccountB.

Explanation:
eosio.token::transfer uses require_recipient(to) which sends notification to the account/contract.

What it effectively means is that your contract will execute action with eosio::on_notify("eosio.token::transfer") hook as inline action. ALL Inline actions need to succeed in order to transaction be valid. So if you fail incoming transfer in your hook - the whole transfer will not succeed.

Here is a example of blocking eosio.token::transfer from any sources

#pragma once

#include <eosio/eosio.hpp>
#include <eosio/asset.hpp>

using std::string;

CONTRACT DenyTransfer : public eosio::contract
{
public:
    using contract::contract;

    [[eosio::on_notify("eosio.token::transfer")]]
    void on_transfer(eosio::name from, eosio::name to, eosio::asset quantity, string memo) {
        eosio::check(false);
    }
};
0

Imagine you have an EOS account called accounttest and you have 100 EOS and the 100 EOS are staken. For you to transfer them you will need to unstake them first.

EOS by default has 2 keys for your account, the @owner and the @active. You could then create a 3rd key which is used only to unstake. This way, if you use your @active key for, let's say, test a game, the game would not be able to use that key to transfer the staken EOS, nor would it be able to unstake them to transfer them to another account.

This is described in more detail in an EOS Newyork article at https://medium.com/eos-new-york/your-eos-account-in-safe-mode-86ad99fd8c40

If you wanted to have a key that was able to do anything BUT transfer, that is a feature EOS does not have right now, but you can try to upvote it at https://github.com/EOSIO/eos/issues/6536

  • this is another case which is not a solution – DarDev Aug 8 at 15:12
0

You can do this by using the set action permission command. This will create a permission that is required for sepcific actions. For the permission you can create a new keypair that only the owner of account A knows, or you can use the owner permission of account A. The latter here is shown here as a cleos command:

cleos set action permission accountB eosio.token transfer '{"threshold":1,"accounts":{["permission":{"account":"accountA","permission":"owner"},"weight":1]}}'

Where accountA and accountB are of course the account names for A and B. Note that this will only deny eosio.token transfers, not the transfers of any other type of tokens.

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.