JavaScript Examples

The code examples require a working NodeJS environment that can be installed from

To setup a NodeJS project, create a new project directory and execute npm init from there.

NodeJS scripts should be started with npm start or npm run SCRIPT-NAME.

Custom scripts can be defined inside "scripts" from package.json.

For example:

  "name": "bitcoinjs-lib-examples",
  "version": "1.0.0",
  "description": "bitcoinjs-lib examples",
  "main": "app.js",
  "scripts": {
    "start": "node ./app.js",
    "multisig": "node ./app_multisig.js",
    "segwit_legacy": "node ./app_segwit_legacy.js",
    "import_wif": "node ./app_import_wif.js"
  "keywords": [
  "author": "Harris Brakmić",
  "license": "MIT",
  "dependencies": {
    "bitcoinjs-lib": "^5.1.4"

Table of contents