Im made
new modification 011.
https://github.com/alek76-2/VanitySearch/tree/main/mod/011Added functions:
- BIP32 Derivation Path m/0
- Normal Child extended private key
- Serialization Extended Private Key
Vector Test is successful.
SECP256K1.cpp - Output data keys string switch to lowercase.
Enable OpenSSL - Generate Random Seed.
Option: -verbose 4 Enable all info.
Option: -verbose 0 Disable all info.
Rekey multiply by 1000.
Run cmd: VanitySearch.exe -stop -verbose 4 -bip39 12 -level 1 -t 1 -bits 28 -r 10000 12jbtzBb54r97TCwW3G1gCFoumpckRAPdY
[ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ]
[ ]
[===========================================================]
[ Changes by Alek76 modify 0.11 ]
[===========================================================]
[ Tips: 1NULY7DhzuNvSDtPkFzNo6oRTZQWBqXNE9 ]
[===========================================================]
[ Options added argv [-start] [-bits] and disable SSE ]
[===========================================================]
[ Options added argv [-bip39] [-level] [-brainwallet] ]
[===========================================================]
[ ]
[ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ]
[i] Uses OpenSSL for random seed
[i] Use BIP-39 nb Word: 12
[i] Use PBKDF2 2048 Rounds of Seed for Expansion to 512 bits
[i] Verbose level info: 4 Option: -verbose 1 (use 0-4)
Search: 12jbtzBb54r97TCwW3G1gCFoumpckRAPdY [Compressed]
[i] First Seed: slot almost promote quantum say like copy focus anchor book indoor tattoo
[i] BIP32 Extended Private Key index: 0 Serialized:
xprv9s21ZrQH143K3AobdVoCZE3994h4WUcPtNkQ7zNZhBDBD5ZH9SYAMAwFhrpPn77pGPWDuGQYUHJFRtA3mfoxsMjRCDx4ZFkzLvHDrwn6b8G Length: 164
[i] BIP32 Extended Private Key index: 0 Serialized:
xprv9ua3Un4XBSp5TxXso3YWzM8FpnEM6C3zNrcF2wfGiHtX47UWHkHsAySs1aM3RzDiic9muwJ3NmrSmSwAoguDDAaEcGQZfwr2Pfh5gkvREqJ Length: 164
Start Sat Nov 18 17:27:57 2023
Base Key: Randomly changed every 10000 Kkeys
Number of CPU thread: 1
[i] First Seed: long speak broccoli panel vital thumb wedding member rebuild dentist image survey
[i] BIP32 Extended Private Key index: 0 Serialized:
xprv9s21ZrQH143K4CEVbkjazggoWBkBu5wiZfoW9Bjt1ychZyuws6f3xBVgnSPBp4vxAx7yEvdh9badAXe2H2CEDJ65gfZxwXGRN1wrbk2Q5eY Length: 164
[i] BIP32 Extended Private Key index: 0 Serialized:
xprv9udHcaDVg7rQeELQdY8AMEyENhkhu2DccsAPminDg9AjrwhsuwaoGYpGX8bpyfXF2eno5jMWqKprDMV6eMnbS3JLP6Diez8PVGW5dsck2aM Length: 164
[i] Seed: b3fff4545ac167fdc34d52f0834b21ecfa14f2c42e3f0476607c637a4afb67b01245d859d3f7b6287f4ab0f12ddd36e954c000b50943515f50b81ddf840f76dd
Bit 28 CPU Base Key thId 0: d661f3b
[0.00 Mkey/s][GPU 0.00 Mkey/s][Total 2^21.44][Found 0]
Addr : 12jbtzBb54r97TCwW3G1gCFoumpckRAPdY
Check: 12jbtzBb54r97TCwW3G1gCFoumpckRAPdY
!!! Result.txt Found key: d916ce8
!!! Result.txt Found key: d916ce8
!!! Result.txt Found key: d916ce8
!!! Result.txt Found key: d916ce8
!!! Result.txt Found key: d916ce8
New function drvKey() -
Key derivation. Added Extended_flag.
void VanitySearch::drvKey(std::string &InData, std::string &InKey, std::string &outMaster, std::string &outChain, bool master_key_fl, uint32_t key_ind, uint8_t depth_ind, std::string &extended_key, Int &outIL, Int &outIR, std::string &pubkey) {
string seed = InData;// seed 64 bytes
string salt = InKey;// salt
unsigned char hseed[64];
Int parentMasterKey;
parentMasterKey.SetInt32(0);// clr
parentMasterKey.Set(&outIL);// Set parent of master key IL
Int parentChainKey;
parentChainKey.SetInt32(0);// clr
parentChainKey.Set(&outIR);// Set parent of chain key IR
//printf("\n Parent Master Key: %s\n", parentMasterKey.GetBase16().c_str());// check
//printf("\n Parent Chain Key: %s\n", parentChainKey.GetBase16().c_str());
//printf("\ndrvKey len: %d seed: %s", (int)seed.length(), seed.c_str());
//printf("\ndrvKey len: %d salt: %s\n", (int)salt.length(), salt.c_str());
// Get index
uint32_t index_u32;
string index_str = "";
uint32_t Normal_Child_index_start = 0;// Use an index between 0 and 2147483647.
// Indexes in this range are designated for normal child extended keys.
// Put data and key through HMAC.
// data = public key + index (concatenated)
// key = chain code
// Indexes in this range are designated for hardened child extended keys.
uint32_t Hardened_Child_index_start = 2147483648;// Use an index between 2147483648 and 4294967295.
if (Hardened_Child_flag) {
index_u32 = Hardened_Child_index_start + key_ind;
} else {
index_u32 = Normal_Child_index_start + key_ind;
}
char itmp[16];
sprintf(itmp, "%08x", index_u32);
index_str = "";
index_str.append(itmp);
//printf("\n[i] index_str: %s ", index_str.c_str());// check index_str
string in_data = "";
// Set index
if (Hardened_Child_flag) {
in_data = "00" + outMaster + index_str;// in_data = outMaster + index_str;
} else {
in_data = pubkey + index_str;
}
//printf("\n[i] !! in_data: %s ", in_data.c_str());// check
// end Get index
// Set input data
if (!master_key_fl) {
seed = in_data;
}
InData = in_data;// update
// Bug fix!!! We hash the data, not the string.
// Get hex of input data
int len_in_data = (int)seed.length() / 2;
if ((seed.length() & 1) == 1 ) len_in_data += 1;// if the data length is not even
unsigned char *hex_buff_in_data = new unsigned char[len_in_data];
for (int j = 0; j < len_in_data; j++) {
unsigned char my1ch_data = 0;
sscanf(&seed[2 * j], "%02hhx", &my1ch_data);
hex_buff_in_data[j] = my1ch_data;// 1 byte
}
// Get hex of input key
int len_in_key = (int)salt.length() / 2;
if ((salt.length() & 1) == 1 ) len_in_key += 1;// if the key length is not even
unsigned char *hex_buff_in_key = new unsigned char[len_in_key];
for (int j = 0; j < len_in_key; j++) {
unsigned char my1ch_key = 0;
sscanf(&salt[2 * j], "%02hhx", &my1ch_key);
hex_buff_in_key[j] = my1ch_key;// 1 byte
}
// Hash function
if (master_key_fl) {
// HMAC sha512
hmac_sha512((unsigned char *)salt.c_str(), (int)salt.length(), (unsigned char *)hex_buff_in_data, len_in_data, hseed);
// the salt "Bitcoin seed" no converting in hex
} else {
// HMAC sha512
hmac_sha512((unsigned char *)hex_buff_in_key, len_in_key, (unsigned char *)hex_buff_in_data, len_in_data, hseed);
// the salt converting in hex!
}
// Reverse bytes
unsigned char hseed_r[64];
int b = 0;
for (b = 0; b < 64; b++) hseed_r[63 - b] = hseed[b];
// Split IL and IR
Int IL;
Int IR;
unsigned long long *vTmp_IL = (unsigned long long *)&hseed_r[32];// IL as master secret key
unsigned long long *vTmp_IR = (unsigned long long *)&hseed_r;// IR as master chain code
IL.SetInt32(0);
IL.bits64[0] = vTmp_IL[0];
IL.bits64[1] = vTmp_IL[1];
IL.bits64[2] = vTmp_IL[2];
IL.bits64[3] = vTmp_IL[3];
IL.bits64[4] = 0;
//
IR.SetInt32(0);
IR.bits64[0] = vTmp_IR[0];
IR.bits64[1] = vTmp_IR[1];
IR.bits64[2] = vTmp_IR[2];
IR.bits64[3] = vTmp_IR[3];
IR.bits64[4] = 0;
// end Split
// Childing Master Key
// MasterKey = (parentMasterKey + MasterKey) % Order _O
if (!master_key_fl) {
IL.ModAddK1order(&parentMasterKey);
}
outIL.Set(&IL);
outIR.Set(&IR);
// debug printf
//printf("\n[i] Output Master Key IL: %s ", IL.GetBase16().c_str());
//printf("\n[i] Output Chain Key IR: %s \n", IR.GetBase16().c_str());
// Use IL as master secret key, and IR as master chain code.
string masterSecretKey = "";
string masterChainKey = "";
string extended_private_key = "";
string masterSecretKey_tmp = IL.GetBase16().c_str();// 32 bytes
string masterChainKey_tmp = IR.GetBase16().c_str();// The chain code is just an extra 32 bytes that we couple with the private key to create what we call an extended key.
// Output and Normalize lengh 64
string ret1 = "";
string s0 = "0";
for (int i = 0; i < 64 - (int)masterSecretKey_tmp.length(); i++) ret1.append(s0);
masterSecretKey.append(ret1);
masterSecretKey.append(masterSecretKey_tmp);
string ret2 = "";
for (int b = 0; b < 64 - (int)masterChainKey_tmp.length(); b++) ret2.append(s0);
masterChainKey.append(ret2);
masterChainKey.append(masterChainKey_tmp);
// Set output
outMaster = masterSecretKey;
outChain = masterChainKey;
// We use these 64 bytes to create our master extended private key.
// Get Parent Public Key for get check sum
Point pp;
Int pk;
pk.SetInt32(0);
if (master_key_fl) {
pk.Set(&IL);
} else {
pk.Set(&parentMasterKey);
}
pp = secp->ComputePublicKey(&pk);
// The publick key to output for create new input msg HMAC-SHA512
pubkey = secp->GetPublicKeyHex(true, pp);// SECP256K1.cpp changes string uppercase to lowercase !!
// Parrent address for check
string parrent_addr = secp->GetAddress(0, 1, pp);
//printf("\n[i] Parrent Pub key: %s ", pubkey.c_str());
//printf("\n[i] Parrent address: %s \n", parrent_addr.c_str());
if (Extended_flag) {// test extended ?
// Public key
Point child_Point;
Int child_Key;
child_Key.SetInt32(0);// clr
child_Key.Set(&IL);
child_Point = secp->ComputePublicKey(&child_Key);
// Address
string child_pub_key = secp->GetPublicKeyHex(true, child_Point);
string child_addr = secp->GetAddress(0, 1, child_Point);
//printf("\n[i] Child Pub key: %s ", child_pub_key.c_str());
//printf("\n[i] Child address: %s \n", child_addr.c_str());
pubkey = child_pub_key;// Use as extended
}
// BIP32 Extended Private Key Serialize:
// Places “xprv” 0488ade4 or “xpub” 0488b21e at the start.
string version = "0488ade4";// 0488ade4 Bitcoin Mainnet private key.
string depth = "00";// How many derivations deep this extended key is from the master key.
string parent_fingerprint = "00000000";// The first 4 bytes of the hash160 of the parent’s public key. This helps to identify the parent later.
string child_index = "00000000";// The index number of this child from the parent.
string chain_code = masterChainKey;// The extra 32 byte secret. This prevents others from deriving child keys without it.
string prepend = "00";
string key = "";// 33 bytes - The private key (prepend 0x00) or public key.
key = prepend + masterSecretKey;
if (!master_key_fl){
child_index = index_str;
}
// Set depth
depth = "";
char dep[8];//char dep[1];
sprintf(dep, "%02x", depth_ind);
depth.append(dep);
// Get hash160
unsigned char hash160_buf[20];
unsigned char first4_buf[4];
secp->GetHash160(P2PKH, true, pp, hash160_buf);
memcpy(first4_buf, hash160_buf, 4);
// unsigned char to string
string my4str = "";
char tmp0[8];
for (int s = 0; s < 4; s++ ) {
sprintf(tmp0, "%02x", first4_buf[s]);
my4str.append(tmp0);
}
// Set parent fingerprint
if (!master_key_fl){
parent_fingerprint = my4str;
}
// check
//printf("\n depth: %s \n", depth.c_str());
//printf("\n parent_fingerprint: %s \n", parent_fingerprint.c_str());
//printf("\n child_index: %s \n", child_index.c_str());
// Get check check sum
string in_checksum = version + depth + parent_fingerprint + child_index + chain_code + key;
string checksum = "";// First 4 bytes of 32
// Get check sum
unsigned char key_buff[32];
unsigned char key_buff_ret[32];
// Get hex input data 78 bytes to check sum 4 bytes
unsigned char hex_buff_in[78];
for (int j = 0; j < 78; j++) {
unsigned char my1ch_chk = 0;
sscanf(&in_checksum[2 * j], "%02hhx", &my1ch_chk);
hex_buff_in[j] = my1ch_chk;// 1 byte
}
// Double sha256()
sha256(hex_buff_in, 78, (unsigned char *)key_buff);
sha256((unsigned char *)key_buff, 32, (unsigned char *)key_buff_ret);
char tmp[8];
string ret = "";
for (int s = 0; s < 4; s++ ) {
sprintf(tmp, "%02x", key_buff_ret[s]);
ret.append(tmp);
}
checksum.append(ret);
// end check sum
extended_private_key = in_checksum + checksum;
// Extended private key - num bytes
// 4 + 1 + 4 + 4 + 32 + 1 + 32 + 4 = 82
// 78 bytes data and 4 bytes check sum
// Finally converting everything to Base58
string extended_private_key_base58 = "";// Output data Extended Private Key Serialized.
// Get hex all data 82 bytes
unsigned char hex_buff_ex_priv_key[82];
for (int j = 0; j < 82; j++) {
unsigned char my1ch = 0;
sscanf(&extended_private_key[2 * j], "%02hhx", &my1ch);
hex_buff_ex_priv_key[j] = my1ch;// 1 byte
}
//printf("\n[i] extended_private_key: %s ", extended_private_key.c_str());// check
// Encode Base58
extended_private_key_base58 = EncodeBase58((const unsigned char *)hex_buff_ex_priv_key, (const unsigned char *)hex_buff_ex_priv_key + 82);
// Output data
extended_key = extended_private_key_base58;
if (verbose_fl >= 4) {
int len = (int)extended_private_key.length();
printf("\n[i] BIP32 Extended Private Key index: %u Serialized: \n%s Length: %d \n", key_ind, extended_private_key_base58.c_str(), len);
}
// memory leak ?
delete [] hex_buff_in_data;
delete [] hex_buff_in_key;
}
No one was waiting? I'm back for a while
I finally have 2^30.75+ (1,806,000,000) wild kangaroo points stored (offsets of #130s public key). Now it's time to release the tame kangaroos. Hopefully within 2-3 months, I'll have a tame land on a wild trap.
I imagine I am behind the group that found #120 & #125, but maybe luck will be on my side.
Long journey ahead, let's go.
Imagine this situation.
Two kangaroos collided - tame and wild. What will they do next? They will jump with the same jumps and constantly collide. Next, the selected points (DP modulo) are saved several times.
Now the question. What's better? Should you regularly save the path traveled and P points (for each kangaroo in a separate line - in a 243 MB file) or save tens of Gigabytes of selected points?
When you restart the program, startup keys are not created. They load them from the Work_Kangaroos.txt file they saved earlier.
So what would be better, do you need old saved points?
Well, if only one video card is used