I would like to create a contract that can be used without ether.

Is it possible to create a function in a contract that pays for its own gas?

I am aware that this leaves the door open to abuse and that a troll will probably call the function until there is no ETH left.

But for the sake of argument: is it technically possible?

up vote 1 down vote accepted

Currently this isn't possible. The nearest to this you can get is a contract that refunds the cost of the transaction.

Should be part of the Metropolis release according to this post of Vitalik (last sentence)

EIP 86 (account security abstraction) – move the logic for verifying signatures and nonces into contracts, allowing developers to experiment with new signature schemes, privacy-preserving technologies and modifications to parts of the protocol without requiring further hard forks or support at the protocol level. Also allows contracts to pay for gas.

Not possible, today, but I have seen indications that it's contemplated for the future.

What you asked is going to be the part of the SERENITY. Currently, Ethereum is HOMESTEAD, then there shall be METROPOLIS, & later SERENITY. so at least a year, you should consider.

Please check this video: https://www.youtube.com/watch?v=OQtRzhgHEBg

In this video, Hudson is talking about self-paying contracts @10:18, exactly your requirement as I see.

Hope this helps.

Thanks.

AFAIR it's not possible. The one who calls contract method (unless it's constant) pays price of the gas that was used during the transaction.

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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