How to Install Bcoin module for Node.js in Windows 10

Hi,

After struggling for a day, I managed to complete the “Creating Keys” example. For clarification I am not a developer myself, but I am learning. So bear with me if I misnomer something.

Through what I learned today, it seems that in order to run the Bcoin module in Node.js, you need some software on your computer installed.

STEP 1
I suggest you start by downloading and installing all the following software:
As a remark I am noting versions I downloaded at the time of this post; which were the latest available. I also want to state that I am using Windows 10.

Python 3.7 (downloaded from Python website)
Node.js v12.19.0 (downloaded from Node.js website)
NPM v6.14.8 (included in Node.js)
git version 2.28.0.windows.1 (downloaded from this site https://git-scm.com/ )
Microsoft Visual Studio Community 2019 Version 16.7.6, installed with the Desktop C++ “workload”

Restart your computer after all this software installation.

STEP 2
I found through trial and error that the module that helps you install the Bcoin module, need NPM to know how to access to the python software. Therefore you have to configure it. I found this information here: https://github.com/nodejs/node-gyp, if you would like to reference yourself.
Using the Powershell you will configure your NPM to the python program executable with the command below:

npm config set python “C:\locationinyourcomputer\Python 3.7 (64-bit).lnk”

In Windows 10 you can find the python executable location just by typing “Python” and right-click open file location…

STEP 3
Follow Filip’s steps to create the folder directory “multisigproject” and run the “npm init” code from powershell in that directory.

STEP 4
Being in the “multisigproject” directory, in powershell run the command:

npm install bcoin

The powershell is going to think for a while and it is very likely you will get an error at the end. However, this expected, and what is important is that it would have created a new directory called “node-modules”

STEP 5
Move into the new “node-modules” directory, and now you will install Bcoin, but instead of using NPM call, you will use git. I found this procedure in this link: https://github.com/bcoin-org/bcoin/blob/master/docs/getting-started.md) In fact, in there you can read the following statement: “Bcoin is meant to be installed via Git for security purposes, as there are security issues when installing via npm.” The command will be as follows:

git clone git://github.com/bcoin-org/bcoin.git

Once powershell has finished whatever it downloaded, a new folder will appear inside “node-modules”. This new folder is the “bcoin” module. You will have to now go into the new “bcoin” directory.

cd bcoin

Once Inside that directory, in the powershell run the following command:

npm rebuild

STEP 6
At this point I think ‘bcoin’ module is properly installed. You can then proceed to create the “address.js” as instructed by Filip and move on with the class.

Please like and let me know if you tried this and it helped. I am not sure if I missed steps, remember I spent almost an entire day digging this and I am not a developer.

1 Like