2

https://github.com/seegno/bitcoin-core After using npm to install, I get an auth error when I try to run it. The github repo isn't clear how to auth...

const Client = require('bitcoin-core');
const client = new Client({ network: 'mainnet' });

client.getInfo().then((help) => console.log(help));

I was able to auth using the older package: https://github.com/freewil/node-bitcoin

Using but with my own credentials:

var client = new bitcoin.Client({
  host: 'localhost',
  port: 8332,
  user: 'username',
  pass: 'password',
  timeout: 30000
});

Really lost how to do it on the newer one.

1 Answer 1

2

I tried the following, and it works:

const Client = require('bitcoin-core');

const client = new Client(
    {   
        username: 'yourUsernameHere',
        password: 'yourPasswordHere',
        port: '8332'
    }
);

client.getInfo().then((help) => console.log(help));
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.