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.


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


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.


  • 1
    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. Aug 19, 2018 at 18:41

2 Answers 2


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
  • bitcoin-address-from-public-key.py
  • bitcoin-get-address-balance.py

The bitcoin developper pages show the steps in all details for type 1 addresses.

For the type 1 addresses, there is a good link here to test results.

Then there is HD wallets, Segwit, and many other extensions...

Maybe it is good to start for type 1 addresses, and extend with your ideas of "under the hood crypto". I stick to Nate's comment though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.