Post
Topic
Board Bitcoin Discussion
Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it
by
POD5
on 28/03/2025, 12:43:14 UTC
This is like you talking to me about deciphering Egyptian writing.  Grin

Just makeup it... just makeup it...   Grin

Code:
// Precomputed constants (do this once at initialization)
Int beta;    // secp256k1 endomorphism beta value
Int lambda;  // secp256k1 endomorphism lambda value
Int lambda2; // lambda^2 mod N
Int beta2;   // beta^2 mod P

// Initialize these during setup:
// beta2.ModMulK1(&beta, &beta);
// lambda2.ModMulK1(&lambda, &lambda);

Point endoPoints[3];
endoPoints[0] = startPoint;

// (λ)
endoPoints[1].x.ModMulK1(&startPoint.x, &beta);
endoPoints[1].y.Set(&startPoint.y);  // Y remains same

// (λ²)
endoPoints[2].x.ModMulK1(&startPoint.x, &beta2);
endoPoints[2].y.Set(&startPoint.y);  // Y remains same

// 6 total - 3 points × 2 parity
uint8_t pubKeyVariants[6][33];
for (int i = 0; i < 3; i++) {
    // Positive Y
    pointToCompressedBin(&endoPoints[i], pubKeyVariants[i*2]);
   
    // Negative Y
    pubKeyVariants[i*2+1][0] = pubKeyVariants[i*2][0] ^ 0x01;
    memcpy(pubKeyVariants[i*2+1]+1, pubKeyVariants[i*2]+1, 32);
}

computeHash160BatchBinSingle(10, pubKeyVariants, hashResults);

for (int i = 0; i < 6; i++) {
    if (memcmp(hashResults[i], targetHash160.data(), g_prefixLength) == 0) {
        // Handle match
        Int foundKey;
        if (i < 2) {
            // Original point (i=0: positive Y, i=1: negative Y)
            foundKey.Set(&currentBatchKey);
        } else if (i < 4) {
            // λ point
            foundKey.ModMulK1(&currentBatchKey, &lambda);
        } else {
            // λ² point
            foundKey.ModMulK1(&currentBatchKey, &lambda2);
        }
       
        // Handle Y parity (odd Y needs negation)
        if (i % 2 == 1) {
            foundKey.Neg();
            foundKey.Add(&order);  // Ensure positive
        }
       
        return foundKey;
    }
}