Installing Copay in Microsoft Windows

Pure javascript Node.js modules are a charm to install with Node Package Manager (npm). However, you may occasionally have to install a module with Node.js native bindings. The installation is painless if you use Linux but if you are using Windows you will not forget the experience! Below is a step by step guide to installing the multi-signature wallet application Copay or any other application or module that requires the bignum package in Windows.

Prerequisites

  1. Node.js with npm: http://nodejs.org/download/
  2. Python 2.6 (yes, 2.6): https://www.python.org/downloads/windows/
  3. Visual Studio. I used Visual Studio 2012 but it should work with Visual Studio 2010+.
  4. Add Node.js, npm, and Python to your path

Basics

  1. Install the latest OpenSSL Windows binary distribution (Win32 OpenSSL v1.0.1j when this post was written). Use the default path since the bignum modules looks at this path.
  2. Follow the Copay installation instructions and stop before npm start.

Fix

The bignum module referenced by Bitcore inside Copay has a critical bug. It uses the free function to release memory allocated from the OpenSSL library instead of using OPENSSL_free. Follow these steps to fix it:

  1. Edit copay\node_modules\bitcore\package.json
  2. Change the dependencies to point to the latest bignum release (0.9.0 when this post was written)
  3. Go to copay\node_modules\bitcore
  4. Run npm update bignum

You can then run npm start. Don’t forget to start testing with the testnet instead of using real bitcoins!

BitPay Insight API

The BitPay Insight API has the same issue.

Forcing a Specific Visual Studio Version

This is a contribution from Mauro Leggieri: to configure a specific visual studio version you must set the preferred version using SET GYP_MSVS_VERSION=2012

Resources