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.

J. Andrew
  • 23
  • 5

1 Answers1

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));
Paul
  • 36
  • 2