How to make a pure Python code for Bitcoin address and private key without modules? For now I learn only how from decimal to get a hex. How from hex to private key WIF and than Bitcoin address?

bits = 115792089237316195423570985008687907852837564279074904382605163141518111494336
bits_hex = hex(bits)
private_key = bits_hex[2:]

With this code I get this fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8ccd3b50c0

I want to get this 5Km2kuu7vtFDPpxywn4u3NLpbr5jKpTB3jsuDU2KXjvkyQnjL4Q

and this 1FDV9PfvAnep8LEzNc7kqSjpxtWK3G3oj4

and compressed private key and address

L5oLkpV3aqBjhki6LmvChTCV6odsp4SXM6FfU2GpngUH5fdXyvH3 1HcYwYNpthRFqUCUhAtQfG3ZAX46uMSUux

Can someone to help me?

  • You will need to be able to do the following: SHA256 hashing & RIPEMD160 hashing (for the addresses and private key), Base58Check encoding (also for the addresses and private key), Elliptic curve point multiplication (for getting a public key from private key), and this post may help for uncompressing a public key if you use a library/solution for ECC that only gives compressed public keys.
    – Septem151
    Feb 16, 2020 at 23:39
  • You may choose to write your own implementations, but there are plenty of libraries available for you that already do these things. If you are trying to write all of it yourself, you are going to struggle with the Elliptic curve point multiplication step the most.
    – Septem151
    Feb 16, 2020 at 23:44

1 Answer 1


You definitely want to watch this YT video made by Shlomi Zeltsinger: https://youtu.be/tX-XokHf_nI It covers the topic of getting randomized entropy and using hashing and RIPEMD to get private/public key pair and corresponding address.


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.