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?
1 Answer
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
}