Create your own digital currency Part 2
Video Tutorial Address:
http://v.youku.com/v_show/id_XMzM5ODcyODkxNg==.html?spm=a2h3j.8428770.3416059.1
http://v.youku.com/v_show/id_XMzM5ODg0MDc5Mg==.html?spm=a2h3j.8428770.3416059.1
http://v.youku.com/v_show/id_XMzM5ODk1MzU1Ng==.html?spm=a2h3j.8428770.3416059.1
http://v.youku.com/v_show/id_XMzQwMTU1MjMzMg==.html?spm=a2h3j.8428770.3416059.1
Next we will make critical changes to the code, including Main.cpp checkpoints.cpp main.cpp: Genesis block, Ntime, Nnonce
Find the above two code in main.cpp, delete the check value after uint256, leave only 0x, then adjust the 4 values of Pchmessagestart, for example:
Locate the following code and make changes to the red box selection, for example, the first 5 bits are changed to 12345. Other numbers can be changed, as long as the quantity is the same
Then replace the phrase "NY times 05/oct ..." in the picture above with any one of your favorite words, like "I like It"
Baidu current epoch time to get the value of the moment, I am now 1515922950
Next, the following figure in the two nnonce modified to 0, two ntime changed to just Baidu to get the value
Delete Block.hashmerkleroot = = uint256 ("0x97d....ed9") intermediate 97d to Ed9 of this string, leaving only 0x
Modify the time setting, I changed it here to Ntargettimespan = 10 * 30 and ntargetspacing = 1* 30
checkpoints.cpp: Delete checkpoints
Leave only the first line of map_list_of, the other lines are all deleted, the first line of content modified to (0, uint256 ("0x"))
and find the location below.
Comment out 1410516073,4896865, 7000.0, 1365458829, 547, 576 this 6 lines (Add//At the beginning of the line)
Will 545, uint256 ("0xa0fea. e602 ")) modified to 0, uint256 (" 0x ")) net.cpp Modify Dnsseeds
The Strmainnetdnsseed has 6 rows of data, delete the middle 4 lines, change the first line to {"learncointools.com", "192.168.1.122"}, where 192.168.1.122 is replaced by your own Ubuntu IP modify Bitcoin-qt.pro to generate code for Maxcoin-qt.pro to join the Genesis block
Add the following code on line No. 2810 of main.cpp:
if (true && block.
Gethash ()! = Hashgenesisblock) {printf ("Searching for Genesis block...\n"); This would figure out a valid hash and the Nonce if you ' re//creating a different Genesis Block:ui nt256 hashtarget = Cbignum ().
Setcompact (block.nbits). getuint256 ();
uint256 Thash;
Char Scratchpad[scrypt_scratchpad_size];
loop {scrypt_1024_1_1_256_sp (Begin (Block.nversion), Begin (Thash), scratchpad);
if (Thash <= hashtarget) break; if ((Block.nnonce & 0xFFF) = = 0) {printf ("Nonce%08x:hash =%s (target =%s) \ n", Block.nnonce, Thash.
ToString (). C_STR (), hashtarget.tostring (). C_STR ());
} ++block.nnonce;
if (block.nnonce = = 0) {printf ("NONCE wrapped, incrementing time\n");++block.ntime;
}} printf ("block.ntime =%u \ n", block.ntime);
printf ("block.nnonce =%u \ n", block.nnonce); printf ("Block. Gethash =%s\n ", block. Gethash ().
ToString (). C_STR ()); }
The added position is in the assert (Block.hashmerkleroot = = uint256 ("0x")), and this is where we just modified
Save a clean code
This is important , and the code needs to be uploaded to GitHub for the first compilation
Perform make-f Makefile.unix use_upnp=- First run in src directory
Run Maxcoind, normally crush. At this point back to the user root directory, there will be a. Maxcoin hidden folder, open the Debug.log file, its last line is the Merkle value
Put this value into the main.cpp.
Put it behind 0x, this is where we modified it. Second compilation run
Execute make-f makefile.unix use_upnp=-in src directory
Run Maxcoind again, at this point it will recalculate the Genesis block and Nnone, after a while it will crash again, I use the IBM3250 server, it may take more than 10 minutes
Follow-up if you need to have relevant videos, problems or exchanges can be in the group 425499445 discussion, only knowledge sharing can promote the prosperity of Bitcoin.