-
Notifications
You must be signed in to change notification settings - Fork 40
ECIP-1042: GASPAY #89
base: master
Are you sure you want to change the base?
Conversation
I have a few initial thoughts:
|
I may have misunderstood this, is the micropayment of How does GASPAY provide easier micropayment over calling a contract function and sending a value with the call? |
Couldn't this be implemented in the contract itself, rather than at the EVM level? |
It can be implemented if a user would provide a value with transaction, but there is not incentive for a user to do that. It makes it complicated from code to pass value down to target contract that can accept tips. I mean, that's supposed to be used by a 3rd party contract, say an oracle that provides current exchange rate to usd, and when your contract reads that value it asks for extra gas as tips for usage. Need to mention that I agree that that idea is very controversial. I wrote it a long time ago, didn't publish because I was not sure about it. Almost forgot about it, but recalled and decided to publish after yesterday's ETH GasToken. Maybe we can find some use of it |
Would the following design work?
However, Now whether The other concern is does any of the remainder gas go to the contract operator? Contract programmers provide a lot of value to ETC so encouraging them as well as miners is definitely beneficial to us in the long term. Another thought, could we have a standard that doesn't require a new OPCODE? Sort of an opt-out that includes a small value transfer to the operator of a contract? So simply a way for a contract to tell a wallet that it wants to receive a payment. This of course comes with its own concerns (how do miners benefit, can this be misused and request large values, what's the protocol for when a value is requested but not sent, how do we ensure contract creators implement the standard correctly in their contracts). |
I like the idea in general. I agree that it's a bit controversial to put such thing in EVM, and because of amount of software that needs to be updated.
All levels of software needs update (from compilers, to EVM, to frontends like block-explorers) - this require attention from users and developers, but I think that it's not a big problem - clients needs to be updated anyways, because of hardforks, security issues, etc. I think this change (if accepted) should be piggybacked to other/bigger changes. |
I think there might be ways to do this "tipping" without protocol-level changes. What I think might also work is we make GASPAY work at ABI level, which results in the same end-user / contract-developer experience, and does not need a hard fork. The first thing I want to note is that smart contracts on the Ethereum network, if not provided with its ABI, would be nearly impossible to use due to the particular way functions are encoded. Given the mandatory role ABI plays in smart contract interaction, we can add an additional field in a function's signature, and supported wallets can automatically handles "gas tipping" by sending a really small amount of value, even when "payable" field is false. See https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI#json. We add an additional field called "tippable", which specifies an integer value in Wei. When a wallet detects that function signature, it sends the "tippable" value in transaction, but only shows it as "tipping" but not the transferred value. On the contract itself, we can require the value sent is of certain amount, otherwise it "throw". This GASPAY ABI gives the same experience at least for end-users compared with GASPAY EVM change. And unrelated to the above idea, @pyskell's |
|
||
# Specification | ||
Provide a new operation `GASPAY a` where `a` is amount of gas to consume, and `0x0 <= a <= 0x0fffff`. The payment for | ||
that gas goes to contract address. As a return it puts consumed value (Wei) into the stack. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest we be more specific on this.
- If a
DELEGATECALL
happened, does the payment goes to the parent contract (which has the address field set in context), or the delegated contract? - What is the case if we're in
CREATE
or a contract creation transaction?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- to delegated contract
- not sure what you mean
Provide a new operation `GASPAY a` where `a` is amount of gas to consume, and `0x0 <= a <= 0x0fffff`. The payment for | ||
that gas goes to contract address. As a return it puts consumed value (Wei) into the stack. | ||
|
||
The cost of the operation itself is equal to 1/4 of requested amount of Gas plus 5000 (`a/4 + 5000`). The payment for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this extra "gas" to contract paid a) at the end of the contract execution (like how miner gas works), or b) paid immediately at the GASPAY
opcode? If it is a), does it do anything with refunded gas as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you mean should it be paid if transaction has failed? no, only if succeeded. but "payment" should be registered at the moment of opcode
Would this mean that a function could be |
@pyskell It can be both. You just deduct the tippable amount when showing the transferred values. |
@sorpaas Great, I like this idea a lot then. |
I like the idea around having small sub-cent payments being the used to reward contracts for providing their service, but that could be maybe solved currently with a convention of |
Regarding ABI level. You can have multiple contracts A -> B -> C. If contract C wants some tip, you shouldn't really put it into your ABI for contract A. You can't even expect it will be same forever, contract C (or a developer of it) can change his mind and increase/decrease/remove/add tip at any moment |
Few moments to discuss: