ruimarinho / bitcoin-core

A modern Bitcoin Core REST and RPC client.
480 stars 188 forks source link

litecoin? #32

Closed Ollemesh closed 6 years ago

Ollemesh commented 7 years ago

Hello, Thank You for this useful module!

A simple question: Can I use it for working with litecoin wallet, which have a similar rpc api? And if I can, how I should configure this?

pedrobranco commented 7 years ago

Hello there,

You can point the bitcoin-core client to your litecoind (litecoin ip / port).

const Client = require('bitcoin-core');
const client = new Client({ 
  host: '<your litecoind ip>', 
  password: '<your rpc username password>',
  port: <your litecoind port>, 
  username: '<your rpc username>'
});

Care to check if the RPC methods that you need in litecoind are available in here.

Cheers.

Ollemesh commented 6 years ago

Hello, Thanks for your answer, but I still have a trouble: Error screen shot

My litecoin.conf:

server=1
daemon=1
gen=0
testnet=1
rpcallowip=127.0.0.1
rpcallowip=192.168.42.82
rpcuser=user
rpcpassword=password

(Bitcoin core works fine having the same settings in the same mashine)

My JS file:

const client = new Client({
    host: '192.168.128.20',
    port: '19335',
    username: 'user',
    password: 'password'
})

client.getInfo()
    .then(info => console.log(info))
    .catch(error => console.log(error))

19335 is being listened: netstat

litecoind is alive: 2017-09-11 12 57 38

RPS method, which i used is getInfo().

I must apologize for troubling you, thank You for the module, and if You need I can try to help You with it (if my skills is enough)

Ollemesh commented 6 years ago

stable litecoind version did not help

Ollemesh commented 6 years ago

Done! I start to read all listening ports list and find some another port 19332/litecoin I tried to set it in options and everything have started to work.

2017-09-11 16 17 29