1

Let's suppose that an entity deploys an SC and wants to perform an allocation (which computationally speaking has a high gas cost). The participants of this delivery (registered persons) must be the ones who pay the cost of execution, therefore, when registering, they will have to pay a fee. The ether is stored in the SC. My question is: is it possible to pay the execution cost of a SC with the ether stored in the SC itself?

Thanks in advance.

1
  • May anyone help me?
    – Joncarre
    May 3 at 22:02
1

My question is: is it possible to pay the execution cost of a SC with the ether stored in the SC itself?

Yes.

However, this isn't a straightforward thing to do, and will require that the smart contract be written in such a way that miners can be paid directly rather than via the gas costs.

Someone with more experience of constructing such transactions would be better placed to answer, but what it boils down to is the following:

  • The transaction is submitted with a gas price of 0
  • The contract being executed can reward the miner by paying the block.coinbase address, which is the address of the miner that is set when the block is mined. Payment is therefore made from the contract to the miner.

There are APIs available from the FlashBots project that enable such transactions to be submitted to miners that run the relevant client implementation.

For a broader background in MEV (Miner-Extractable Value), see this previous answer:

For an equivalent mechanism in rewarding miners with tokens, see OpenZeppelin's Rewarding Miners.

1
  • I appreciate the info, i'm just starting with this hehe. I'll check it out!
    – Joncarre
    May 5 at 15:05

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.