0

This question already has an answer here:

I have been following tutorials for making ERC20 tokens. All of the tutorials create a pre-mined token with a set supply, and the creator gets of those coins their wallet immediately upon creation (to be sent out to others in an airdrop I suppose). There is never any mention of how to make the coins mineable. Is this possible and how do I go about it?

marked as duplicate by Richard Horrocks, Ismael, Roman Frolov, atomh33ls, Nicolas Massart Jan 13 '18 at 15:33

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0

Take a look at this article: https://lightrains.com/blogs/how-to-create-mineable-erc20-tokens

Block Rewards

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

Proof of Work (PoW)

uint currentChallenge = 1; // Can you figure out the cubic root of this number?

function rewardMathGeniuses(uint answerToCurrentReward, uint nextChallenge) {
    require(answerToCurrentReward**3 == currentChallenge); // If answer is wrong do not continue
    balanceOf[msg.sender] += 1; // Reward the player
    currentChallenge = nextChallenge; // Set the next challenge
}

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