Who pays the fees for transactions initiated by a smart contract in Ethereum?

3

I am wondering who pays the fees for transactions initiated by a smart contract in Ethereum?

For example, if I have a contract that simply forwards any payment made into it to someone else, does the contract have to pay its own transaction fees for payments moving out, or does the transaction that initiate the contract have to pay the fees for both its transaction and the resulting transaction coming from the contract?

ThePiachu

Posted 2015-06-17T20:41:15.050

Reputation: 41 594

Answers

6

A smart contract can only initiate a transaction when it receives a transaction from either another contract or a user. Thus, all transactions must originate from some user transaction, and it is this transaction that must pay for fees. The amount of fees can be limited by setting the gas limit on that transaction to prevent a malicious contract from consuming a horrendous amount of fees.

Also, all transactions that are the result of a specific user transaction will occur before any other user transactions (and it's subsequent contract transactions) are processed.

Thomas Galvin

Posted 2015-06-17T20:41:15.050

Reputation: 61

-1

Usually there is a small transaction fee on any bitcoin transaction. its 0.0002 i think. If the contract says that there is a additional fee for that contract then i would assume you would have both the transaction fee and the contract fee.

Tox

Posted 2015-06-17T20:41:15.050

Reputation: 1