Join 54,872 users and earn money for participation

electrum-cash: getting started

3 152 exc boost
Avatar for JonathanSilverblood
Written by   221
7 months ago (Last updated: 4 months ago)

Introduction

Electrum-cash is a javascript/typescript library for communicating with electrum servers.

This example demonstrates how to install the library with npm and how to include it in your NodeJS-based project.

It is possible to use the library in a browser and on other platforms by transpiling with tools like babel, webpack and similar, but that is outside the scope of this article.

Requirements

Before you get started, make sure that you have reasonable modern versions of nodejs and npm installed by opening a terminal prompt and requesting version information:

$ node -v
v14.4.0
$ npm -v
6.14.5

Installing the library

To install the electrum-cash library, navigate to your project's root folder and use npm:

$ cd MyProject/
$ npm install electrum-cash

Import the library into your project

The library supports both CommonJS and ES2015, and comes with bindings for TypeScript.

This example includes the full library but you can also include just the parts you need.

// Include the electrum-cash library using CommonJS.
const ElectrumCash = require('electrum-cash');
// Include the electrum-cash library as an ES2015 module.
import * as ElectrumCash from 'electrum-cash';

Conclusion

As long as you have a modern version of NodeJS you should be able to add electrum-cash to your project in just a few minutes.

38
$ 1.39
$ 0.50 from @emergent_reasons
$ 0.29 from @TheRandomRewarder
$ 0.25 from @rosco
+ 2
Avatar for JonathanSilverblood
Written by   221
7 months ago (Last updated: 4 months ago)
Enjoyed this article?  Earn Bitcoin Cash by sharing it! Explain
...and you will also help the author collect more tips.

Comments

brilliant

$ 0.00
5 months ago

Nice article I Love Thet..

$ 0.00
5 months ago