### PubHunt Example Execution Source: https://github.com/btc-hub-group/pubhunt/blob/main/README.md Provides an example of how to run PubHunt with specific GPU and gridsize parameters, and shows the expected output format including performance metrics. ```bash PubHunt.exe -gi 0 -gx 8192,1024 hashP64.txt PubHunt v1.00 DEVICE : GPU GPU IDS : 0 GPU GRIDSIZE : 8192x1024 NUM HASH160 : 1 OUTPUT FILE : Found.txt GPU : GPU #0 GeForce GTX 1650 (14x64 cores) Grid(8192x1024) [00:01:43] [GPU: 533.23 MH/s] [T: 54,475,620,352 (36 bit)] [F: 0] ``` -------------------------------- ### Integrate PubHunt for Full Workflow Execution Source: https://context7.com/btc-hub-group/pubhunt/llms.txt An example demonstrating the complete workflow of the PubHunt tool, from cryptographic parameter initialization and signal handling to file parsing, GPU configuration, and executing the search. It includes setting up elliptic curve parameters, parsing input hash160 values from a file, configuring GPU devices and grid sizes, and initiating the search process. The example also shows how to handle graceful exit via signal handling and provides a sample compilation command. ```cpp #include "PubHunt.h" #include "Utils.h" #include "Timer.h" #include "Int.h" #include #include #include bool should_exit = false; void signal_handler(int signum) { should_exit = true; } int main(int argc, char* argv[]) { // Initialize cryptographic parameters Timer::Init(); rseed(Timer::getSeed32()); Int P, order; P.SetBase16("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F"); order.SetBase16("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141"); Int::InitK1(&order); Int::SetupField(&P); // Setup signal handling for graceful exit signal(SIGINT, signal_handler); // Parse input file std::vector> inputHashes; parseFile("hash160.txt", inputHashes); if (inputHashes.empty()) { printf("No valid hash160 values found in input file\n"); return 1; } // Configure GPUs std::vector gpuId = {0}; std::vector gridSize = {-1, 128}; // -1 = auto-detect optimal X dimension printf("PubHunt v1.00\n"); printf("DEVICE : GPU\n"); printf("GPU IDS : 0\n"); printf("GPU GRIDSIZE : auto x 128\n"); printf("NUM HASH160 : %zu\n", inputHashes.size()); printf("OUTPUT FILE : Found.txt\n\n"); // Execute search PubHunt* hunter = new PubHunt(inputHashes, "Found.txt"); hunter->Search(gpuId, gridSize, should_exit); // Cleanup delete hunter; printf("\nSearch completed\n"); return 0; } // Compile and run: // g++ -DWITHGPU -m64 -O2 -I. -I/usr/local/cuda-11.0/include \ // Main.cpp PubHunt.cpp Utils.cpp Int.cpp IntMod.cpp IntGroup.cpp \ // Random.cpp Timer.cpp obj/GPU/GPUEngine.o \ // -lpthread -L/usr/local/cuda-11.0/lib64 -lcudart -lcurand \ // -o PubHunt // ./PubHunt -gi 0 -gx 8192,1024 hash160.txt ``` -------------------------------- ### Run PubHunt from Command Line Source: https://context7.com/btc-hub-group/pubhunt/llms.txt Execute PubHunt from the terminal with various options for GPU configuration, output files, and device listing. Supports single and multi-GPU setups, and basic validation checks. ```bash # Search for public keys matching hash160 values in hashP64.txt PubHunt.exe -gi 0 -gx 8192,1024 hashP64.txt # Expected output: # PubHunt v1.00 # # DEVICE : GPU # GPU IDS : 0 # GPU GRIDSIZE : 8192x1024 # NUM HASH160 : 1 # OUTPUT FILE : Found.txt # GPU : GPU #0 GeForce GTX 1650 (14x64 cores) Grid(8192x1024) # # [00:01:43] [GPU: 533.23 MH/s] [T: 54,475,620,352 (36 bit)] [F: 0] # Multi-GPU configuration with custom output file PubHunt.exe -gi 0,1,2 -gx 8192,1024,8192,1024,8192,1024 -o results.txt hash160.txt # List available CUDA devices PubHunt.exe -l # Check integer calculations for validation PubHunt.exe -check ``` -------------------------------- ### PubHunt C++ API for Search Operation Source: https://context7.com/btc-hub-group/pubhunt/llms.txt Demonstrates how to initialize and execute the PubHunt search operation using its C++ API. It includes parsing input hashes, configuring GPUs, starting the search, and cleanup. The output format for found public keys is also shown. ```cpp #include "PubHunt.h" #include "Utils.h" #include #include // Parse hash160 values from file std::vector> inputHashes; parseFile("hash160.txt", inputHashes); // Configure GPU parameters std::vector gpuId = {0, 1}; // Use GPU 0 and GPU 1 std::vector gridSize = {8192, 1024, 8192, 1024}; // Grid dimensions for each GPU // Initialize PubHunt with target hashes and output file std::string outputFile = "Found.txt"; PubHunt* hunter = new PubHunt(inputHashes, outputFile); // Execute search (blocks until completion or Ctrl+C) bool should_exit = false; hunter->Search(gpuId, gridSize, should_exit); // Cleanup delete hunter; // Output format in Found.txt when match is found: // PubKey : 02e0b8a2baee1b77fc703455f39d51477451fc8cfc... // Hash160: e0b8a2baee1b77fc703455f39d51477451fc8cfc // ================================================================================= ``` -------------------------------- ### PubHunt Command-Line Usage Source: https://github.com/btc-hub-group/pubhunt/blob/main/README.md Demonstrates the command-line interface for the PubHunt executable, detailing available flags for GPU selection, grid size, output file, and input file. ```bash PubHunt.exe -h PubHunt [-check] [-h] [-v] [-gi GPU ids: 0,1...] [-gx gridsize: g0x,g0y,g1x,g1y, ...] [-o outputfile] [inputFile] -v : Print version -gi gpuId1,gpuId2,... : List of GPU(s) to use, default is 0 -gx g1x,g1y,g2x,g2y, ... : Specify GPU(s) kernel gridsize, default is 8*(MP number),128 -o outputfile : Output results to the specified file -l : List cuda enabled devices -check : Check Int calculations inputFile : List of the hash160, one per line in hex format (text mode) ``` -------------------------------- ### Manage and Execute GPU Kernels with GPUEngine Class Source: https://context7.com/btc-hub-group/pubhunt/llms.txt The GPUEngine class provides low-level management and execution of GPU kernels. It handles initialization with specified grid sizes and device IDs, retrieves GPU information, executes search steps, and processes found results. Dependencies include the GPUEngine.h header and standard C++ libraries. Input typically involves target hash160 values, and output includes found public keys and their associated hash160 values. ```cpp #include "GPU/GPUEngine.h" #include // Prepare target hash160 values (must be uint32_t array format) const uint32_t hash160[5] = {0x3EE4133D, 0x991F52FD, 0xF6A25C98, 0x34E0745A, 0xC74248A4}; int numHash160 = 1; // Initialize GPU engine // gridSizeX=8192, gridSizeY=1024, gpuId=0, maxFound=65536 GPUEngine* engine = new GPUEngine(8192, 1024, 0, 65536, hash160, numHash160); // Get GPU information int nbThreads = engine->GetNbThread(); std::string deviceName = engine->deviceName; // deviceName example: "GPU #0 GeForce GTX 1650 (14x64 cores) Grid(8192x1024)" // Execute search step std::vector found; bool ok = engine->Step(found, false); // spinWait=false for non-blocking // Process results for (int i = 0; i < found.size(); i++) { ITEM item = found[i]; // item.pubKey: 36-byte compressed public key // item.hash160: 20-byte hash160 value // item.thId: thread ID that found the match printf("Found match in thread %u\n", item.thId); printf("PubKey: "); for (int j = 0; j < 36; j++) { printf("%02x", item.pubKey[j]); } printf("\n"); } // Cleanup delete engine; // Static method to list CUDA devices GPUEngine::PrintCudaInfo(); ``` -------------------------------- ### PubHunt Build Configuration (Linux Makefile) Source: https://github.com/btc-hub-group/pubhunt/blob/main/README.md Illustrates the necessary configurations within the makefile for building PubHunt on Linux, specifically setting CUDA paths and GPU compute capability. ```makefile CUDA = /usr/local/cuda-11.0 CXXCUDA = /usr/bin/g++ # To build with CUDA: pass CCAP value according to your GPU compute capability $ make CCAP=35 all ``` -------------------------------- ### Compile PubHunt on Linux and Windows Source: https://context7.com/btc-hub-group/pubhunt/llms.txt Instructions for building the PubHunt project from source on Linux and Windows. On Linux, compilation involves using 'make' with options for CUDA compute capability and custom CUDA paths. For Windows, Visual Studio 2019 and the CUDA 10.0 SDK are required, with compilation performed through the IDE. Dependencies include a C++ compiler, make utility (Linux), and specific CUDA toolkit versions. ```bash # Linux with CUDA 11.0 and compute capability 3.5 make CCAP=35 all # Linux with custom CUDA paths make CUDA=/usr/local/cuda-11.0 CXXCUDA=/usr/bin/g++ CCAP=75 all # Clean build artifacts make clean # Windows (Visual Studio 2019 required) # Open PubHunt.sln in Visual Studio Community 2019 # Ensure CUDA 10.0 SDK is installed # Build -> Build Solution (Ctrl+Shift+B) # Compute capability values for common GPUs: # GTX 1000 series: CCAP=61 # RTX 2000 series: CCAP=75 # RTX 3000 series: CCAP=86 # RTX 4000 series: CCAP=89 ``` -------------------------------- ### PubHunt Utility Functions in C++ Source: https://context7.com/btc-hub-group/pubhunt/llms.txt Showcases utility functions for data conversion and parsing within the PubHunt project. Includes converting hex strings to byte vectors, parsing comma-separated integers, and reading hash160 files. Basic error handling for file parsing is also demonstrated. ```cpp #include "Utils.h" #include #include // Convert hex string to byte vector std::string hex = "3EE4133D991F52FDF6A25C9834E0745AC74248A4"; std::vector bytes = hex2bytes(hex); // bytes.size() == 20 for valid hash160 // Parse comma-separated integers std::vector tokens; getInts("gpuId", tokens, "0,1,2", ','); // tokens = {0, 1, 2} // Parse hash160 file std::vector> inputHashes; parseFile("hash160.txt", inputHashes); // inputHashes contains one vector per valid line // Each inner vector has 20 bytes (hash160 size) // Error handling example try { parseFile("nonexistent.txt", inputHashes); } catch (...) { // Prints: "Error: Cannot open nonexistent.txt [error message]" // Empty vector returned if file cannot be opened } ``` -------------------------------- ### PubHunt Input File Format for Hash160 Source: https://context7.com/btc-hub-group/pubhunt/llms.txt Specifies the format for input files containing hash160 values. Each hash160 should be on a new line in hexadecimal format (40 characters). ```bash # hash160.txt - One hash160 value per line in hex format (40 characters) 3EE4133D991F52FDF6A25C9834E0745AC74248A4 20D45A6A762535700CE9E0B216E31994335DB8A5 739437BB3DD6D1983E66629C5F08C70E52769371 E0B8A2BAEE1B77FC703455F39D51477451FC8CFC 61EB8A50C86B0584BB727DD65BED8D2400D6D5AA # hashP64.txt - Single target for puzzle 64 3EE4133D991F52FDF6A25C9834E0745AC74248A4 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.