Electrum network protocol documentation can be found here: http://docs.electrum.org/en/latest/protocol.html
- Add the Plugin to your Cordova project:
cordova plugin add https://github.com/getbitpocket/electrum-network-plugin
- Depending on the Promise support of your target environment (http://caniuse.com/#feat=promises), the es6-shim javascript library might be included
var networkDiscovery = new electrum.NetworkDiscovery();
networkDiscovery.init();
networkDiscovery.on('peers:discovered', function() {
networkDiscovery.sendRandomRequest({ "id": 1, "method":"blockchain.address.get_balance", "params":["1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L"] });
networkDiscovery.on('peers:response', function(response) {
console.log(response);
});
});
var peer = new electrum.Peer('some.electrum.server.com', 50002);
peer.connect();
peer.on('connected', function() {
peer.sendRequest({ "id": 1, "method":"blockchain.address.get_balance", "params":["1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L"] });
peer.on('response', function(response) {
console.log(response);
});
});
npm install
npm run build
npm install
npm test
npm install
npm run integration -- run android
ornpm run integration -- run ios
for testing on real devicesnpm run integration -- emulate android
ornpm run integration -- emulate ios
for testing on emulator
- This plugin should also work with altcoins, which support electrum
- Observable (rx.js) rather of Promise for Requests