GithubHelp home page GithubHelp logo

bluewallet / rn-electrum-client Goto Github PK

View Code? Open in Web Editor NEW

This project forked from you21979/node-electrum-client

17.0 6.0 26.0 53 KB

Electrum Client for React Native

Home Page: https://bluewallet.io

License: MIT License

JavaScript 100.00%
react-native electrumx bitcoin

rn-electrum-client's Introduction

rn-electrum-client

Electrum Protocol Client for React Native

based on

features

  • persistence (ping strategy and reconnection)
  • batch requests
  • works in RN and nodejs
  • both clearnet TCP and TLS
  • zero dependencies

protocol spec

usage

For Nodejs you can just provide standard modules net & tls to constructor explicitly, this library won't do require('net').

  const net = require('net');

and then

  const client = new ElectrumClient(net, false, 50001, 'electrum1.bluewallet.io', 'tcp');
  const ver = await client.initElectrum({ client: 'bluewallet', version: '1.4' });
  const balance = await client.blockchainScripthash_getBalance('716decbe1660861c3d93906cb1d98ee68b154fd4d23aed9783859c1271b52a9c');

For React Native luckily we have react-native-tcp-socket which mimics net & tls pretty closely, one of the ways to shim it is via package.json:

    "react-native": {
      "net": "react-native-tcp-socket",
      "tls": "react-native-tcp-socket"
    }

license

MIT

rn-electrum-client's People

Contributors

colatkinson avatar flotwig avatar limpbrains avatar overtorment avatar uran1980 avatar you21979 avatar zero-1729 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

rn-electrum-client's Issues

Timeout support

Does this library support timeout? I tried passing it through the options object, but it doesn't seem to work. Do you plan on supporting this in the near future?

Add getBalanceHistory(batch)

Hello,

Please add a feature that gets the address balance including the tx history, as it's quit intensive to fetch an addresses history and calculate the total received/total seend values it requires calls to getBalanceBatch, getHitoryBatch and TransactionBatch (txBatch requests are needed for each tx from getTransactionBatch) plus addresses need conversion to a scripthash that needs to be compared to an address and the bitcoinjs library needs to convert the address to an output script too that's quit a lot of code. Would be nice if some electrum client supports just it be design.

Error close connect with tls connection

I tried connecting to blockstream.info:465 using tls connection, I did the necessary polyfills of net and tls and I tried also with the method that you are using here
It seems that I'm connected for a short time but then the connection closes and starts trying to reconnect, as the result I obtain a bunch of errors Error: close connect.
I tried the same thing with tcp on blockstream.info:195 and it works properly, the problem is that i need to connect to this one blockstream.info:465using tls

Screenshot 2022-12-01 at 17 22 34

Screenshot 2022-12-01 at 17 23 29

Am I missing something?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.