- vừa được xem lúc

Genesis hash finder và fork Qtum

0 0 8

Người đăng: Ba Thu Nguyen

Theo Viblo Asia

Fork Qtum tạo chain mới

https://www.youtube.com/watch?v=5rqiGruTe4E

Như bitcoin đã biết nó mã hóa chuẩn SHA256, Litecoin là SCRYPT hay Dash là X11.. thì ta đã có các công cụ tìm genesis hash

https://github.com/vuicash/node-genesis-block

GitHub - vuicash/node-genesis-block: Create Genesis Block for Bitcoin, Litcoin, Dash, X11, X13, X15, X17, Geek, Quark, Keccak, Qubit, NeoScrypt, Scrypt... Create Genesis Block for Bitcoin, Litcoin, Dash, X11, X13, X15, X17, Geek, Quark, Keccak, Qubit, NeoScrypt, Scrypt... - GitHub - vuicash/node-genesis-block: Create Genesis Block for Bitcoin, Litcoi... github.com

https://github.com/vuicash/GenesisH0

GitHub - vuicash/GenesisH0: SHA256/scrypt/X11/X13/X15 genesis blocks for virtual currencies SHA256/scrypt/X11/X13/X15 genesis blocks for virtual currencies - GitHub - vuicash/GenesisH0: SHA256/scrypt/X11/X13/X15 genesis blocks for virtual currencies github.com

https://github.com/vuicash/generate-genesis

GitHub - vuicash/generate-genesis: A Bitcoin-clone (altcoin) Genesis block generator. A Bitcoin-clone (altcoin) Genesis block generator. - GitHub - vuicash/generate-genesis: A Bitcoin-clone (altcoin) Genesis block generator. github.com

Nhưng một số coin nó không tiết lộ nên phải Debug Các bạn nên build từ bản cũ hơn của Qtum để tìm genesis hash cho nhanh Nó mất thời gian ở công đoạn chạy lệnh "make" mất tầm 30 phút Sau đó nâng cấp dần coin của bạn Qtum là một dự án khai thác trước Bạn sẽ tìm 5000 block đầu tiên rồi hãy tiến hành nâng cấp coin tạo checkpoint ở block thứ 5000 sau đó mới public

Cách Debug

https://github.com/boxaltcoin/vuicoin/blob/master/qtum.txt
############################### Change magic key make new chain ################################# git clone https://github.com/qtumproject/qtum --recursive consensus.nMinimumChainWork = uint256S("0x0000000000000000000000000000000000000000000000000000000000000000");// Start https://en.bitcoin.it/wiki/List_of_address_prefixes 48 L 70-71 V 132-133 v ############################## Make publickey ################################## openssl ecparam -genkey -name secp256k1 -out genesiscoinbase.pem openssl ec -in genesiscoinbase.pem -text > genesiscoinbase.hex ################################################################ date +%s ############################## Genesis hash Debug ################################## File src/chainparams.cpp Add before /** * Main network */
#######################
static void MineGenesis(CBlockHeader& genesisBlock, const uint256& powLimit, bool noProduction)
{ if(noProduction) genesisBlock.nTime = std::time(0); genesisBlock.nNonce = 0; LogPrintf("NOTE: Genesis nTime = %u \n", genesisBlock.nTime); LogPrintf("WARN: Genesis nNonce (BLANK!) = %u \n", genesisBlock.nNonce); arith_uint256 besthash; memset(&besthash,0xFF,32); arith_uint256 hashTarget = UintToArith256(powLimit); LogPrintf("Target: %s\n", hashTarget.GetHex().c_str()); arith_uint256 newhash = UintToArith256(genesisBlock.GetHash()); while (newhash > hashTarget) { genesisBlock.nNonce++; if (genesisBlock.nNonce == 0) { LogPrintf("NONCE WRAPPED, incrementing time\n"); ++genesisBlock.nTime; } // If nothing found after trying for a while, print status if ((genesisBlock.nNonce & 0xfff) == 0) LogPrintf("nonce %08X: hash = %s (target = %s)\n", genesisBlock.nNonce, newhash.ToString().c_str(), hashTarget.ToString().c_str()); if(newhash < besthash) { besthash = newhash; LogPrintf("New best: %s\n", newhash.GetHex().c_str()); } newhash = UintToArith256(genesisBlock.GetHash()); } LogPrintf("Genesis nTime = %u \n", genesisBlock.nTime); LogPrintf("Genesis nNonce = %u \n", genesisBlock.nNonce); LogPrintf("Genesis nBits: %08x\n", genesisBlock.nBits); LogPrintf("Genesis Hash = %s\n", newhash.ToString().c_str()); LogPrintf("Genesis hashStateRoot = %s\n", genesisBlock.hashStateRoot.ToString().c_str()); LogPrintf("Genesis Hash Merkle Root = %s\n", genesisBlock.hashMerkleRoot.ToString().c_str());
}
####################### ####################### 1. Mainnet ####################### Find and replace
####################### genesis = CreateGenesisBlock(1504695029, 8026361, 0x1f00ffff, 1, 50 * COIN); consensus.hashGenesisBlock = genesis.GetHash(); assert(consensus.hashGenesisBlock == uint256S("0x000075aef83cf2853580f8ae8ce6f8c3096cfa21d98334d6e3f95e5582ed986c")); assert(genesis.hashMerkleRoot == uint256S("0xed34050eb5909ee535fcb07af292ea55f3d2f291187617b44d3282231405b96d"));
#######################
with
#######################
//Debug Mainnet startNewChain = true; genesis = CreateGenesisBlock(1506211200, 0, 0x1f00ffff, 1, 50 * COIN);// Change time and set nonce =0 if (startNewChain) MineGenesis(genesis, consensus.powLimit, false); //genesis = CreateGenesisBlock(1504695029, 8026361, 0x1f00ffff, 1, 50 * COIN); consensus.hashGenesisBlock = genesis.GetHash(); //assert(consensus.hashGenesisBlock == uint256S("0x000075aef83cf2853580f8ae8ce6f8c3096cfa21d98334d6e3f95e5582ed986c")); //assert(genesis.hashMerkleRoot == uint256S("0xed34050eb5909ee535fcb07af292ea55f3d2f291187617b44d3282231405b96d")); LogPrintf("Main Genesis nTime = %u \n", genesis.nTime); LogPrintf("Main Genesis nNonce = %u \n", genesis.nNonce); LogPrintf("Main Genesis nBits: %08x\n", genesis.nBits); LogPrintf("Main Genesis Hash = %s\n", genesis.GetHash().ToString().c_str()); LogPrintf("Main Genesis hashStateRoot = %s\n", genesis.hashStateRoot.ToString().c_str()); LogPrintf("Main Genesis Hash Merkle Root = %s\n", genesis.hashMerkleRoot.ToString().c_str()); //End Debug Mainnet ####################### 2. Testnet ####################### Find and replace
####################### genesis = CreateGenesisBlock(1504695029, 7349697, 0x1f00ffff, 1, 50 * COIN); consensus.hashGenesisBlock = genesis.GetHash(); assert(consensus.hashGenesisBlock == uint256S("0x0000e803ee215c0684ca0d2f9220594d3f828617972aad66feb2ba51f5e14222")); assert(genesis.hashMerkleRoot == uint256S("0xed34050eb5909ee535fcb07af292ea55f3d2f291187617b44d3282231405b96d"));
#######################
with
#######################
//Debug Testnet startNewChain = true; genesis = CreateGenesisBlock(1645276728, 0, 0x1f00ffff, 1, 50 * COIN);// Change time and set nonce =0 if (startNewChain) MineGenesis(genesis, consensus.powLimit, false); //genesis = CreateGenesisBlock(1504695029, 7349697, 0x1f00ffff, 1, 50 * COIN); consensus.hashGenesisBlock = genesis.GetHash(); //assert(consensus.hashGenesisBlock == uint256S("0x0000e803ee215c0684ca0d2f9220594d3f828617972aad66feb2ba51f5e14222")); //assert(genesis.hashMerkleRoot == uint256S("0xed34050eb5909ee535fcb07af292ea55f3d2f291187617b44d3282231405b96d")); LogPrintf("Test Genesis nTime = %u \n", genesis.nTime); LogPrintf("Test Genesis nNonce = %u \n", genesis.nNonce); LogPrintf("Test Genesis nBits: %08x\n", genesis.nBits); LogPrintf("Test Genesis Hash = %s\n", genesis.GetHash().ToString().c_str()); LogPrintf("Test Genesis hashStateRoot = %s\n", genesis.hashStateRoot.ToString().c_str()); LogPrintf("Test Genesis Hash Merkle Root = %s\n", genesis.hashMerkleRoot.ToString().c_str());
//End Debug Testnet ####################### 3. Regtest ####################### Find and replace
####################### genesis = CreateGenesisBlock(1504695029, 17, 0x207fffff, 1, 50 * COIN); consensus.hashGenesisBlock = genesis.GetHash(); assert(consensus.hashGenesisBlock == uint256S("0x665ed5b402ac0b44efc37d8926332994363e8a7278b7ee9a58fb972efadae943")); assert(genesis.hashMerkleRoot == uint256S("0xed34050eb5909ee535fcb07af292ea55f3d2f291187617b44d3282231405b96d"));
#######################
with
#######################
//Debug Regtest startNewChain = true; genesis = CreateGenesisBlock(1506211200, 17, 0x207fffff, 1, 50 * COIN);// Change time and set nonce = any number if (startNewChain) MineGenesis(genesis, consensus.powLimit, false); //genesis = CreateGenesisBlock(1504695029, 17, 0x207fffff, 1, 50 * COIN); consensus.hashGenesisBlock = genesis.GetHash(); //assert(consensus.hashGenesisBlock == uint256S("0x665ed5b402ac0b44efc37d8926332994363e8a7278b7ee9a58fb972efadae943")); //assert(genesis.hashMerkleRoot == uint256S("0xed34050eb5909ee535fcb07af292ea55f3d2f291187617b44d3282231405b96d")); LogPrintf("Reg Genesis nTime = %u \n", genesis.nTime); LogPrintf("Reg Genesis nNonce = %u \n", genesis.nNonce); LogPrintf("Reg Genesis nBits: %08x\n", genesis.nBits); LogPrintf("Reg Genesis Hash = %s\n", genesis.GetHash().ToString().c_str()); LogPrintf("Reg Genesis hashStateRoot = %s\n", genesis.hashStateRoot.ToString().c_str()); LogPrintf("Reg Genesis Hash Merkle Root = %s\n", genesis.hashMerkleRoot.ToString().c_str()); //End Debug Regtest ##############################################
File src/chainparams.h Add below bool startNewChain; before CCheckpointData checkpointData; ############################### Build your debug chain ################################# sudo apt-get install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils git cmake libboost-all-dev libgmp3-dev sudo apt-get install software-properties-common sudo add-apt-repository ppa:bitcoin/bitcoin sudo apt-get update sudo apt-get install libdb4.8-dev libdb4.8++-dev sudo apt-get install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler qrencode ./autogen.sh ./configure make -j4 #### Take 20-30 min to complete #### cd src/qt ./qtum-qt qtum-qt: validation.cpp:1639: void InvalidChainFound(CBlockIndex*): Assertion `tip' failed.
Aborted (core dumped) ############################## Find genesis hash, nonce debug.log ################################## Ctr H View hidden file and folder ############## MainNet Find ############## 2022-02-19T14:16:06Z Main Genesis nTime = 1645278122 2022-02-19T14:16:06Z Main Genesis nNonce = 35110 2022-02-19T14:16:06Z Main Genesis nBits: 1f00ffff
2022-02-19T14:16:06Z Main Genesis Hash = 00007c13b508f80a556139c390a06ee51e59ecd9246e03bf00acac4299a508b0
2022-02-19T14:16:06Z Main Genesis hashStateRoot = 9514771014c9ae803d8cea2731b2063e83de44802b40dce2d06acd02d0ff65e9
2022-02-19T14:16:06Z Main Genesis Hash Merkle Root = 49e2dd855ad104b945cd2f6980d7d69d0470bc69646dbdb77a275b4196f7a55f ############## TestNet Find ############## 2022-02-19T14:16:06Z Test Genesis nTime = 1645278327 2022-02-19T14:16:06Z Test Genesis nNonce = 13721 2022-02-19T14:16:06Z Test Genesis nBits: 1f00ffff
2022-02-19T14:16:06Z Test Genesis Hash = 00008067af1d36cacf194d0f0508ee0f58371314b84e21cbf4ec3d60f1f4cc2c
2022-02-19T14:16:06Z Test Genesis hashStateRoot = 9514771014c9ae803d8cea2731b2063e83de44802b40dce2d06acd02d0ff65e9
2022-02-19T14:16:06Z Test Genesis Hash Merkle Root = 49e2dd855ad104b945cd2f6980d7d69d0470bc69646dbdb77a275b4196f7a55f ############## RegTest Find ############## 2022-02-19T14:16:06Z Reg Genesis nTime = 1645278420 2022-02-19T14:16:06Z Reg Genesis nNonce = 1 2022-02-19T14:16:06Z Reg Genesis nBits: 207fffff
2022-02-19T14:16:06Z Reg Genesis Hash = 71b2f068167ce06588cb167d10acbffc4e069ab6172fc5db6c24e3e83e10e1b9
2022-02-19T14:16:06Z Reg Genesis hashStateRoot = 9514771014c9ae803d8cea2731b2063e83de44802b40dce2d06acd02d0ff65e9
2022-02-19T14:16:06Z Reg Genesis Hash Merkle Root = 49e2dd855ad104b945cd2f6980d7d69d0470bc69646dbdb77a275b4196f7a55f ############################## Change back your chainparams.cpp with new info ################################## Remove //Debug Mainnet
Remove //Debug Testnet
Remove //Debug Regtest ############################## Change back your chainparams.h ################################## src/chainparams.h Remove bool startNewChain; ############################### Build your new chain ################################# cd ../.. make -j4 cd src/qt ./qtum-qt Now you completed fork Qtum for new chain Let check Have Fun
Good luck!

Bình luận

Bài viết tương tự

- vừa được xem lúc

Một số thủ thuật hay ho với Linux (1).

1. Ctrl + x + e. Giữ CTRL, nhấn phím x rồi nhấn phím e. Thao tác này sẽ mở ra editor mặc định (echo $EDITOR | $VISUAL để kiểm tra) chứa sẵn.

0 0 45

- vừa được xem lúc

How to deploy Amplication app to DigitalOcean

This article shows you the way to deploy an app generated by Amplication to DigitalOcean. Amplication provides the dockerfile to use containers for deployment, but this blog explains how to do it manu

0 0 53

- vừa được xem lúc

Có gì mới trong Laravel 9.0?

Laravel v9 là phiên bản LTS tiếp theo của Laravel và ra mắt vào tháng 2 năm 2022. Trong bài viết này, mình xin giới thiệu một vài tính năng mới trong Laravel trong Laravel 9.

0 0 78

- vừa được xem lúc

Xây dựng trang web tra cứu ảnh sử dụng phân cụm Spectral Clustering

1. Tổng quan tra cứu ảnh. 1.1.

0 0 45

- vừa được xem lúc

Scanning network 1 - quét mạng như một hacker

Chào mọi người mình là Tuntun. Một năm qua là một năm khá bận rộn nhỉ.

0 0 46

- vừa được xem lúc

Interpreter Design Pattern - Trợ thủ đắc lực của Developers

1. Giới thiệu. . Interpreter là một mẫu thiết kế thuộc nhóm hành vi (Behavioral Pattern).

0 0 43