Bitcoin Forum
October 20, 2024, 11:02:23 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Creating a Genesis block for Yescrypt altcoin  (Read 67 times)
ir.hn (OP)
Member
**
Offline Offline

Activity: 322
Merit: 54

Consensus is Constitution


View Profile
February 01, 2018, 04:47:52 AM
 #1

I'm working on a coin using yescrypt algorithm along the lines of Bitzeny or Yenten.  I found this post:

https://bitcointalk.org/index.php?topic=181981.0

Which gives a program for generating a genesis block.  However it appears that it only works for sha256 coins.  What code would I need to change to make this work for my yescrypt coin?

Or would there be a better way?

The debug.log method doesn't work, that only worked with bitcoin code prior to 2014.

Here may be some relevant code in the genesis creator program:

//if(generateBlock)
        {
                printf("Generating block...\n");
                if(!unixtime)
                {
                        unixtime = time(NULL);
                }
               
                unsigned char block_header[80], block_hash1[32], block_hash2[32];
                uint32_t blockversion = 1;
                memcpy(block_header, &blockversion, 4);
                memset(block_header+4, 0, 32);
                byteswap(transaction->merkleHash, 32); // We swapped it before, so do it again now.
                memcpy(block_header+36, transaction->merkleHash, 32);
                memcpy(block_header+68, &unixtime, 4);
                memcpy(block_header+72, &nBits, 4);
                memcpy(block_header+76, &startNonce, 4);
               
                uint32_t *pNonce = (uint32_t *)(block_header + 76);
                uint32_t *pUnixtime = (uint32_t *)(block_header + 68);
                unsigned int counter, start = time(NULL);
                while(1)
                {
                        SHA256(block_header, 80, block_hash1);
                        SHA256(block_hash1, 32, block_hash2);
                       
                        unsigned int check = *((uint32_t *)(block_hash2 + 28)); // The hash is in little-endian, so we check the last 4 bytes.
                        if(check == 0) // \x00\x00\x00\x00
                        {
                                byteswap(block_hash2, 32);
                                char *blockHash = bin2hex(block_hash2, 32);
                                printf("\nBlock found!\nHash: %s\nNonce: %u\nUnix time: %u", blockHash, startNonce, unixtime);
                                free(blockHash);
                                break;
                        }
                       
                        startNonce++;
                        counter+=1;
                        if(time(NULL)-start >= 1)
                        {
                                printf("\r%d Hashes/s, Nonce %u\r", counter, startNonce);
                                counter = 0;
                                start = time(NULL);
                        }
                        *pNonce = startNonce;
                        if(startNonce > 4294967294LL)
                        {
                                //printf("\nBlock found!\nHash: %s\nNonce: %u\nUnix time: %u", blockHash, startNonce, unixtime);
                                unixtime++;
                                *pUnixtime = unixtime;
                                startNonce = 0;
                        }
                }
        }

ir.hn (OP)
Member
**
Offline Offline

Activity: 322
Merit: 54

Consensus is Constitution


View Profile
February 01, 2018, 05:56:37 PM
 #2

There will be a premine on this coin so if anyone is interested in helping on a cpu only coin you can get some as bounty.

xenomorphe1
Full Member
***
Offline Offline

Activity: 798
Merit: 103



View Profile
February 01, 2018, 06:03:01 PM
 #3

Maybe you should look at the source code of Yenten or Bitzeny? Look at their github.
ir.hn (OP)
Member
**
Offline Offline

Activity: 322
Merit: 54

Consensus is Constitution


View Profile
February 02, 2018, 01:19:23 AM
 #4

Maybe you should look at the source code of Yenten or Bitzeny? Look at their github.

I have I am working with it.

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!