Post
Topic
Board Bitcoin Discussion
Re: Bitcoin puzzle transaction ~32 BTC prize to who solves it
by
onepuzzle
on 30/06/2025, 20:37:15 UTC
How did you come to the conclusion that he used Python? Just because it's easier?


If you were a Puzzle BTC creator in 2015, you could have used Bitcoin Core, Electrum, or Armory. Electrum (written in Python) was already popular in 2015, and its wallet format is well-documented. Importing keys via the command line (electrum importprivkey) would be trivial with Python-generated WIFs.

Python’s random.seed() function ensures deterministic key generation, unlike C++’s std::rand(), which varies across implementations unless carefully controlled.

Python’s random uses a Mersenne Twister, while C++’s std::rand() depends on the compiler.

Since Electrum itself is written in Python, a Python script would integrate seamlessly.

The same code works unchanged from 2015 to 2025 (thanks to Python’s stability).You just need to know the seed.



1. Mnemonic → Seed (BIP-39)

A sequence of 12–24 words (the mnemonic) is fed into PBKDF2-SHA512 with 2,048 iterations and the salt "mnemonic" + optional passphrase to produce a 512-bit seed. This seed is the secret starting point for the entire wallet.

Code:
Seed = PBKDF2(passphrase=mnemonic, salt="mnemonic"+optional_passphrase, iterations=2048, HMAC-SHA512)

2. Master-Key + Chain-Code (BIP-32)

The 512-bit seed is processed with HMAC-SHA512 using the key "Bitcoin seed". The left 32 bytes of the output become the Master Private Key, the right 32 bytes the Master Chain Code. Together they form the root node for all subsequent key derivations.

Code:
I = HMAC-SHA512(key="Bitcoin seed", data=Seed) 
Master_PrivateKey = I_L (left 32 Bytes) 
Master_ChainCode  = I_R (right 32 Bytes) 

random.seed("some string") + random.randint() is deterministic, but not secure, standardized, or hierarchical. Real HD wallets use strictly defined KDFs (PBKDF2, HMAC-SHA512), chain codes, and mnemonics to ensure maximum security and interoperability.

https://media2.giphy.com/media/v1.Y2lkPTc5MGI3NjExamJmZXVuNGxybGszb2Qyand1dGpwNWF3dTY4c2hjdzcyd3Y1a3dqbiZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/15BuyagtKucHm/giphy.gif