I am a newbie Bitcoin evangelist and I have a recommendation to see all the code responsible for computing yourPublicKey from yourPrivateKey, especially for big deal addresses. The easiest way to allow Bitcoin users to see the code is to write it in Javascript to let them run it on console, because any PC user has a browser and almost nobody has Python or any other interpreter. I saw a step-by-step manual in this answer to How can I generate a bitcoin address? but I still have some obstructions to produce one single sheet of code ready for running in console. Please help me to write that code to make my recommendation easy to follow.

2 Answers 2


If JavaScript is your language of choice you might be interested in bcoin - the bitcoin full node implementation and modular library written in JS. It's designed for use in nodejs environments but can be compiled for the browser as well.

This guide in particular walks you through the process: https://bcoin.io/guides/webapp.html

Please note that web browsers are insecure environments for cryptography and especially cryptocurrency, this guide is based around public keys and testnet addresses to avoid any real risk. If you try to manage private keys in a browser's JS environment you need to be extremely careful (use an offline computer if possible, no "chrome extensions" etc)


You need to learn to use Browserify to pack your javascript libraries, so that you can call it from a browser with require(). The instructions for the library used by the answer can be found here (you don't need step 5). Once you do that you should create a folder with an html page and the script you created. Add to the html page <script src="bitcoinjs.js"></script>. Open the html file in your browser, then you should be able to run your script.

  • As far as I understood, you have provided me instructions how to write my own clone of bitaddress.org website. I do not want an HTML page because it may contain a lot more than I need. All I want is a function publicAdressFromPrivateKey(yourPrivateKey){...console.log(publicAddress)} to be able to see that nothing is happening with my precious private key except some mathematical transformations.
    – rcfanboi
    Apr 21, 2020 at 10:30

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.