ethereumproject / ECIPs

The Ethereum Classic Improvement Proposal
55 stars 47 forks source link

ECIP-1042: GASPAY #89

Open splix opened 6 years ago

splix commented 6 years ago

Few moments to discuss:

pyskell commented 6 years ago

I have a few initial thoughts:

pyskell commented 6 years ago

I may have misunderstood this, is the micropayment of a/4 + 5000 going to the miner and the rest going to the contract? The intent here being to incentivize miners to adopt while also allowing for a micropayment to a contract?

How does GASPAY provide easier micropayment over calling a contract function and sending a value with the call?

elaineo commented 6 years ago

Couldn't this be implemented in the contract itself, rather than at the EVM level?

splix commented 6 years ago

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

pyskell commented 6 years ago

Would the following design work?

GASPAY itself is opt-in at the contract level and the contract contains some sort of flag or variable that indicates it uses GASPAY (either at the contract level or specific function level)

However, GASPAY is opt-out at the wallet level a user goes to use a wallet like Emerald Wallet or MEW, the wallet detects that GASPAY exists, and opts-in (but provides the user the ability to opt-out if they deselect a check box or other toggle switch).

Now whether GASPAY works as an opcode in this kind of design is another question entirely, perhaps GASPAY could have a single boolean argument that is set at runtime. But this is really a more technical question for others.

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).

tzdybal commented 6 years ago

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. For me, biggest advantages are:

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.

sorpaas commented 6 years ago

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 opt-in at the contract level idea is related to ECIP-1040 (https://github.com/ethereumproject/ECIPs/pull/86), which we may also want to take a look, if we decide to go with that path.

pyskell commented 6 years ago

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.

Would this mean that a function could be payable or tippable but not both?

sorpaas commented 6 years ago

@pyskell It can be both. You just deduct the tippable amount when showing the transferred values.

pyskell commented 6 years ago

@sorpaas Great, I like this idea a lot then.

shanejonas commented 6 years ago

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 payable and assert(msg.value == tx.gasprice * someFairConstant)

splix commented 6 years ago

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