# Print all states of getting from a random 256 bit private key to a corresponding encoded BTC address

I wonder if it is possible to print what's going on under the hood regarding the process of getting from a random binary number to a BTC address.

It will look something like this:

Input: `a random 256 binary number`

Output: `print()`

Printing all possible sequential states from that number to a BTC address.

PRIVATE KEY STATES

``````binary privKey [k] -> decimal privKey -> hexadecimal privKey -> WIF privKey
``````

PUBLIC KEY STATES

``````decimal pubKey print(x,y) -> print K where [K=(x,y)] -> hexadecimal PubKey (A) -> print A=RIPEMD160(SHA2569(K))
``````

It will help a lot of people interested in the details of creating BTC addresses, from the elliptic curve private to public key process (K=k*G) to the other encoding steps until the final address.

On GitHub and other places, `.js` or `.py` libraries just print the WIF key and the address, and sometimes the hexadecimal public key as well.

Thanks.

• If you really want this, I think your best bet is to take some existing code and add print statements wherever you like, or single-step it with a debugger. I doubt you'll find code where this has already been done, mainly because I don't think it will actually be as informative as you guess. The individual arithmetical computations aren't very informative one by one; it's better to understand the mathematical constructions that they express collectively. – Nate Eldredge Aug 19 '18 at 18:41

Maybe my code `bitcoin-in-tiny-pieces` can serve to follow all the steps: each script is devoted to just a step of the process and has the minimal code to fulfil it.

Python is easy to follow if you're not a programmer, and there are comments that point to the documentation sources, though for example going from private to public key is all maths.

Each script is self-explanatory:

• bitcoin-public-from-private.py
• bitcoin-wif-from-private-key.py