Bitcoin Forum
July 04, 2024, 11:19:34 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Creating ERC20 Token for fun / knowledge growth - Changing POW Algo Question  (Read 123 times)
dilonious (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 0


View Profile
January 24, 2018, 09:35:08 PM
 #1

I'm creating an ERC20 token for fun and to get a better understanding of the basics.

I'd love to explore different POW algorithms as I believe in the true decentralization that GPU mining offers.

Can anyone help me with the code to implement something like equihash to an ERC20 token?

ceyceyki
Member
**
Offline Offline

Activity: 126
Merit: 10

Renewable Energy Cryptocurrency


View Profile
January 24, 2018, 09:37:17 PM
 #2

I also want to learn how to create a new coin and I am searching about it here. Yes I found many sources but I will follow this thread as well. Maybe some people will share their experience here.

dilonious (OP)
Newbie
*
Offline Offline

Activity: 9
Merit: 0


View Profile
January 24, 2018, 11:41:33 PM
 #3

I'm following this guide: https://www.ethereum.org/token

about POW here
Code:
   

 bytes32 public currentChallenge;                         // The coin starts with a challenge
    uint public timeOfLastProof;                             // Variable to keep track of when rewards were given
    uint public difficulty = 10**32;                         // Difficulty starts reasonably low

    function proofOfWork(uint nonce){
        bytes8 n = bytes8(sha3(nonce, currentChallenge));    // Generate a random hash based on input
        require(n >= bytes8(difficulty));                   // Check if it's under the difficulty

        uint timeSinceLastProof = (now - timeOfLastProof);  // Calculate time since last reward was given
        require(timeSinceLastProof >=  5 seconds);         // Rewards cannot be given too quickly
        balanceOf[msg.sender] += timeSinceLastProof / 60 seconds;  // The reward to the winner grows by the minute

        difficulty = difficulty * 10 minutes / timeSinceLastProof + 1;  // Adjusts the difficulty

        timeOfLastProof = now;                              // Reset the counter
        currentChallenge = sha3(nonce, currentChallenge, block.blockhash(block.number - 1));  // Save a hash that will be used as the next proof
    }
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!