I have a rinkeby token, and I wanted to add "merged mining" when someone mines a block, they get awarded 0.25 of that token.

function issueBlockReward() {
balanceOf[block.coinbase] += 0.25;

The code above (I am missing the bottom closing tag) Awards the miner of an ethereum block 0.25 token. How can I make this run every 15 seconds? My pragma version is v0.4.21+commit.dfe3193c Thanks!


You basically already did it. As long as block reward will worth it, miners will include invocation of your function into every block they mine.

However, I see minor problem with your code. As long as all token balances and transfer amounts have to be integer, your block reward has to be integer as well.

|improve this answer|||||
  • Thanks! I have a slight problem though. It is returning an error! No matching declaration found after variable lookup. balanceOf[block.coinbase] += 1; – ETHguy Feb 12 at 23:40
  • Could you show the whole smart contract? – Mikhail Vladimirov Feb 13 at 6:19

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.