Closed ghost closed 7 years ago
what am i missing ? and why is that port says 18332 , where can i specify my port and username and password ?
thanks
You can check the documentation for the arguments available for the Client
constructor.
By default, the regtest
network runs on port 18332 when using bitcoind. This is similar to the behaviour of bitcoin-cli
when running in regtest mode.
[root@localhost deploy]# node rpc.js
Unhandled rejection Error: connect ECONNREFUSED 127.0.0.1:18332 at Object.exports._errnoException (util.js:1018:11) at exports._exceptionWithHostPort (util.js:1041:20) at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1086:14)
i have latest bitcoin core on linux machine., and latest node.js with latest bitcoin-core
`const Client = require('bitcoin-core'); const client = new Client({ network: 'regtest' });
client.getBlockByHash('0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206', { extension: 'json' }); `