Author

Topic: Creating a Genesis block for Yescrypt altcoin (Read 67 times)

member
Activity: 322
Merit: 54
Consensus is Constitution
February 01, 2018, 09:19:23 PM
#4
Maybe you should look at the source code of Yenten or Bitzeny? Look at their github.

I have I am working with it.
full member
Activity: 798
Merit: 103
February 01, 2018, 02:03:01 PM
#3
Maybe you should look at the source code of Yenten or Bitzeny? Look at their github.
member
Activity: 322
Merit: 54
Consensus is Constitution
February 01, 2018, 01: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.
member
Activity: 322
Merit: 54
Consensus is Constitution
February 01, 2018, 12: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://bitcointalksearch.org/topic/ann-genesis-block-generator-181981

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;
                        }
                }
        }
Jump to: