3

Since creating a smart contract with Ethereum involves the user of ether, refilling all of the users' ethers becomes costly for a company. So let's say a company decide to issue a token over the ethereum network, and that token represents a new currency. Can the original creator of the token receive transaction fees everytime each user send tokens to someone else? That way the company could easily refill everyone's token's with ether.

2 Answers 2

3

You can't receive Ether paid for gas spent on that transaction, it all goes to the miner of current block.

But you can add support for that fee into your token contract. For example you can require to send some Ether with each token transfer, and then automatically send that Ether value into Token contract itself, or send to some other address.

Something like that:

function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
    // accept fees
    if (msg.value < FEE) {
        return false;
    }
    if (!MYADDR.send(msg.value) {
        throw;
    }

    // do token transfer (WARNING, no validation here, don't use, it's for current example only)
    balances[_to]   += _value;
    balances[_from] -= _value;
    return true;
}
2
  • 1
    But what if the user of that token doesn't have enough ether? Can I require users to send a bigger amount of tokens for each token transfer? And just take a cut (in tokens, not ether) from each token transfer?
    – Luis Cruz
    Dec 5, 2016 at 23:43
  • 1
    yes, sure. so instead of that fees lines of code, just add part of the _value to balances[your system address] Dec 6, 2016 at 6:20
-1

If you look at the problem as a whole, every user should spend some ether (as fees) to perform any transaction. If you are planning to fill the users accounts' with ether paid by users, the net sum is zero (looking at all users as an entity and company as another entity). So, either you have to fill the users accounts with ether from your pocket or Users have to burn their own pockets to make transactions (transfer tokens etc.)

Your Answer

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

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