1

Is it possible to pay the miner who mines the block that executes a certain function? As in, it would coded into the function itself? If so, can it be done from Solidity or just byte code?

Bitcoin has a similar functionality when the output values are less than the input values.

It might sound strange to want to do, but I am considering a Dapp where I need incentive compatibility against miners who might not want to include certain functions in their block.

0

As with bitcoin, fees are normally set by the user sending the transaction and paid to the miner who mines it. The only difference is that it's set as a multiplier of the gas price rather than an absolute sum or a per-kilobyte amount, so if you want to send them an absolute sum, you need to estimate how much gas your transaction will use and divide by that.

If you want to actually send funds to the miner from within your contract rather than relying on the user sending the transaction, you can program your contract to read the miner's coinbase address at block.coinbase and send funds to that. However, unlike the normal gas fee, miners won't normally know to look for this, so you'll need a way to communicate it to them, and also presumably you'll need to be sending sufficiently high-rolling fees to their coinbase to be worth their trouble to treat your contract calls differently.

  • Thanks! block.coinbase.send() is exactly what I'm looking for. – megane Apr 4 '17 at 1:03

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.