v8: version & configuration of bitcoin core
I'm going to run bitcore from git, branch v8.0.0.
From #1787, I see v8.0.0 is compatible with normal bitcoin core nodes, and doesn't need a forked version anymore.
-
Is it expected to be compatible with bitcoin core
0.17.1? I see in #1699 that0.16.3is referenced, but I'm not sure if that's because0.17.xwasn't out yet, or if I shouldn't upgrade yet past0.16.3. -
What, if any, bitcoin core configuration changes need to be made? When running bitcore
v4, https://github.com/bitpay/bitcore-node/blob/master/docs/upgrade.md gave abitcoin.conffor0.12.1of the following. Is this still what is needed for running a current (0.16.3or0.17.1) and separate bitcoin core? (Most importantly thetxindex,addressindex,timestampindex, andspentindexoptions.) Are some of these no longer needed? Does bitcore use theZeroMQoptions, or are those no longer needed? Are any new options needed?
server=1
whitelist=127.0.0.1
txindex=1
addressindex=1
timestampindex=1
spentindex=1
zmqpubrawtx=tcp://127.0.0.1:<port>
zmqpubhashblock=tcp://127.0.0.1:<port>
rpcallowip=127.0.0.1
rpcuser=<user>
rpcpassword=<password>
It should work with the newest bitcoin-core. No specific version is required as far as I know.
My bitcoin-core bitcoin.conf looks like
whitelist=127.0.0.1
txindex=0
listen=1
server=1
irc=1
upnp=1
# listen on different ports than default testnet
port=20008
rpcport=20009
rpcallowip=127.0.0.1
rpcuser=rpcuser
rpcpassword=rpcpass
and my bitcore.config.json looks like this
(you will likely only want the BTC mainnet entry)
{
"bitcoreNode": {
"chains": {
"BTC": {
"mainnet": {
"chainSource": "p2p",
"trustedPeers": [
{
"host": "127.0.0.1",
"port": 20008
}
],
"rpc": {
"host": "127.0.0.1",
"port": 20009,
"username": "rpcuser",
"password": "rpcpass"
}
},
"testnet": {
"chainSource": "p2p",
"trustedPeers": [
{
"host": "127.0.0.1",
"port": 20000
}
],
"rpc": {
"host": "127.0.0.1",
"port": 20001,
"username": "rpcuser",
"password": "rpcpass"
}
},
"regtest": {
"chainSource": "p2p",
"trustedPeers": [
{
"host": "127.0.0.1",
"port": 20020
}
],
"rpc": {
"host": "127.0.0.1",
"port": 20021,
"username": "rpcuser",
"password": "rpcpass"
}
}
},
"BCH": {
"mainnet": {
"parentChain": "BTC",
"forkHeight": 478558,
"trustedPeers": [
{
"host": "127.0.0.1",
"port": 30008
}
],
"rpc": {
"host": "127.0.0.1",
"port": 30009,
"username": "rpcuser",
"password": "rpcpass"
}
},
"testnet": {
"parentChain": "BTC",
"trustedPeers": [
{
"host": "127.0.0.1",
"port": 30000
}
],
"rpc": {
"host": "127.0.0.1",
"port": 30001,
"username": "rpcuser",
"password": "rpcpass"
}
},
"regtest": {
"parentChain": "BTC",
"trustedPeers": [
{
"host": "127.0.0.1",
"port": 30020
}
],
"rpc": {
"host": "127.0.0.1",
"port": 30021,
"username": "rpcuser",
"password": "rpcpass"
}
}
}
}
}
}
Pardon the noob question, but where are the addressindex=1, timestampindex=1, spentindex=1 parameters in your bitcore config? If I understand correctly, Bitcore will start an independent process and connect to the bitcoind daemon over RPC - download blocks, index them, etc.
@nadahalli v8 doesn't use rpc, instead it connects to the nodes over p2p. So you have to have synced nodes that you point v8 to in the config
I just moved from bitcore v5 to b8 (https://github.com/bitpay/bitcore/tree/v8.0.0) to run bch, but I can't view the balance through insight now, if I need bitcore.config.json to do it. Configuration? If so, which path is he in, is there a template for reference?
Either way, I cannot get it to work. This is what I did:
$git clone [email protected]:bitpay/bitcore.git
$cd bitcore
$sudo npm install -g --unsafe-perm=true bitcore-node
$bitcore-node --version
undefined _<-- hmmmm_
$cat .bitcore/bitcore-node.json
{
"bitcoreNode": {
"chains": {
"BTC": {
"mainnet": {
"chainSource": "p2p",
"trustedPeers": [
{
"host": "127.0.0.1",
"port": 8333
}
]
}
}
}
}
}
$bitcore-node start
/usr/local/lib/node_modules/bitcore-node/lib/scaffold/start.js:19
var addressDefined = (fullConfig.services.indexOf('address') >= 0);
^
TypeError: Cannot read property 'indexOf' of undefined
at checkConfigVersion2 (/usr/local/lib/node_modules/bitcore-node/lib/scaffold/start.js:19:45)
It seems that the version is older, and it's looking for the earlier config file format, and not the p2p version.
@nadahalli just do npm install inside the folder you cloned from the master branch of this repo. Feel free to use the -g option to install it globally, although that's not required.
To run the node, simply do npm run node from within the folder you installed the node in. As for the config file, it should be called bitcore.config.json, not bitcore-node.json.
For more info on the config file, check this sample https://github.com/bitpay/bitcore/issues/1801#issuecomment-449112811
@osagga I had used the "--unsafe-perm=true" parameter because lerna goes into an infinite loop installing the 14 packages. I can ctrl-C the process, and it ends with "lerna success Bootstrapped 14 packages". After that, I did "npm run node" and got this:
test/benchmark/wallet-benchmark.ts:2:24 - error TS2307: Cannot find module 'bitcore-client'.
2 import { Wallet } from 'bitcore-client';
@nadahalli hmm, that's weird, installing takes sometime, what do you mean by infinite loop? How long did it take? It should terminate on its own. Also try to do it without sudo or -g, just simply clone the repo, then cd into the folder and do npm install
@osagga The infinite loop looks like this:
npm install
npm WARN deprecated [email protected]: CircularJSON is in maintenance only, flatted is its successor.
npm WARN prefer global [email protected] should be installed with -g
> [email protected] postinstall /home/tejaswin/bitcore/node_modules/spawn-sync
> node postinstall
> @8.0.0 postinstall /home/tejaswin/bitcore
> npm run bootstrap && npm run compile
> @8.0.0 bootstrap /home/tejaswin/bitcore
> lerna bootstrap
lerna notice cli v3.10.1
lerna info Bootstrapping 14 packages
lerna info Installing external dependencies
lerna info Symlinking packages and binaries
lerna info lifecycle @bitpay/[email protected]~postinstall: @bitpay/[email protected]
> @bitpay/[email protected] postinstall /home/tejaswin/bitcore/packages/insight-previous
> ./node_modules/.bin/webdriver-manager update --gecko false
[11:58:03] I/file_manager - creating folder /home/tejaswin/bitcore/packages/insight-previous/node_modules/webdriver-manager/selenium
[11:58:03] I/config_source - curl -o/home/tejaswin/bitcore/packages/insight-previous/node_modules/webdriver-manager/selenium/standalone-response.xml https://selenium-release.storage.googleapis.com/
[11:58:03] I/config_source - curl -o/home/tejaswin/bitcore/packages/insight-previous/node_modules/webdriver-manager/selenium/chrome-response.xml https://chromedriver.storage.googleapis.com/
[11:58:04] I/downloader - curl -o/home/tejaswin/bitcore/packages/insight-previous/node_modules/webdriver-manager/selenium/chromedriver_2.45.zip https://chromedriver.storage.googleapis.com/2.45/chromedriver_linux64.zip
[11:58:04] I/update - chromedriver: unzipping chromedriver_2.45.zip
[11:58:04] I/update - chromedriver: setting permissions to 0755 for /home/tejaswin/bitcore/packages/insight-previous/node_modules/webdriver-manager/selenium/chromedriver_2.45
[11:58:04] I/downloader - curl -o/home/tejaswin/bitcore/packages/insight-previous/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.141.59.jar https://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar
lerna info lifecycle [email protected]~postinstall: [email protected]
> [email protected] postinstall /home/tejaswin/bitcore
> npm run bootstrap && npm run compile
> @8.0.0 bootstrap /home/tejaswin/bitcore
> lerna bootstrap
lerna notice cli v3.10.1
lerna info Bootstrapping 14 packages
lerna info Installing external dependencies
lerna info Symlinking packages and binaries
lerna info lifecycle @bitpay/[email protected]~postinstall: @bitpay/[email protected]
> @bitpay/[email protected] postinstall /home/tejaswin/bitcore/packages/insight-previous
> ./node_modules/.bin/webdriver-manager update --gecko false
[11:58:15] I/update - chromedriver: file exists /home/tejaswin/bitcore/packages/insight-previous/node_modules/webdriver-manager/selenium/chromedriver_2.45.zip
[11:58:15] I/update - chromedriver: unzipping chromedriver_2.45.zip
[11:58:15] I/update - chromedriver: setting permissions to 0755 for /home/tejaswin/bitcore/packages/insight-previous/node_modules/webdriver-manager/selenium/chromedriver_2.45
[11:58:15] I/update - chromedriver: chromedriver_2.45 up to date
[11:58:15] I/update - selenium standalone: file exists /home/tejaswin/bitcore/packages/insight-previous/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.141.59.jar
[11:58:15] I/update - selenium standalone: selenium-server-standalone-3.141.59.jar up to date
lerna info lifecycle [email protected]~postinstall: [email protected]
> [email protected] postinstall /home/tejaswin/bitcore
> npm run bootstrap && npm run compile
> @8.0.0 bootstrap /home/tejaswin/bitcore
> lerna bootstrap
lerna notice cli v3.10.1
lerna info Bootstrapping 14 packages
lerna info Installing external dependencies
lerna info Symlinking packages and binaries
lerna info lifecycle @bitpay/[email protected]~postinstall: @bitpay/[email protected]
> @bitpay/[email protected] postinstall /home/tejaswin/bitcore/packages/insight-previous
> ./node_modules/.bin/webdriver-manager update --gecko false
[11:58:25] I/update - chromedriver: file exists /home/tejaswin/bitcore/packages/insight-previous/node_modules/webdriver-manager/selenium/chromedriver_2.45.zip
[11:58:25] I/update - chromedriver: unzipping chromedriver_2.45.zip
[11:58:25] I/update - chromedriver: setting permissions to 0755 for /home/tejaswin/bitcore/packages/insight-previous/node_modules/webdriver-manager/selenium/chromedriver_2.45
[11:58:25] I/update - chromedriver: chromedriver_2.45 up to date
[11:58:26] I/update - selenium standalone: file exists /home/tejaswin/bitcore/packages/insight-previous/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.141.59.jar
[11:58:26] I/update - selenium standalone: selenium-server-standalone-3.141.59.jar up to date
lerna info lifecycle [email protected]~postinstall: [email protected]
> [email protected] postinstall /home/tejaswin/bitcore
> npm run bootstrap && npm run compile
> @8.0.0 bootstrap /home/tejaswin/bitcore
> lerna bootstrap
lerna notice cli v3.10.1
lerna info Bootstrapping 14 packages
lerna info Installing external dependencies
lerna info Symlinking packages and binaries
lerna info lifecycle @bitpay/[email protected]~postinstall: @bitpay/[email protected]
> @bitpay/[email protected] postinstall /home/tejaswin/bitcore/packages/insight-previous
> ./node_modules/.bin/webdriver-manager update --gecko false
[11:58:35] I/update - chromedriver: file exists /home/tejaswin/bitcore/packages/insight-previous/node_modules/webdriver-manager/selenium/chromedriver_2.45.zip
[11:58:35] I/update - chromedriver: unzipping chromedriver_2.45.zip
[11:58:35] I/update - chromedriver: setting permissions to 0755 for /home/tejaswin/bitcore/packages/insight-previous/node_modules/webdriver-manager/selenium/chromedriver_2.45
[11:58:35] I/update - chromedriver: chromedriver_2.45 up to date
[11:58:35] I/update - selenium standalone: file exists /home/tejaswin/bitcore/packages/insight-previous/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.141.59.jar
[11:58:35] I/update - selenium standalone: selenium-server-standalone-3.141.59.jar up to date
lerna info lifecycle [email protected]~postinstall: [email protected]
> [email protected] postinstall /home/tejaswin/bitcore
> npm run bootstrap && npm run compile
> @8.0.0 bootstrap /home/tejaswin/bitcore
> lerna bootstrap
lerna notice cli v3.10.1
lerna info Bootstrapping 14 packages
lerna info Installing external dependencies
lerna info Symlinking packages and binaries
lerna info lifecycle @bitpay/[email protected]~postinstall: @bitpay/[email protected]
> @bitpay/[email protected] postinstall /home/tejaswin/bitcore/packages/insight-previous
> ./node_modules/.bin/webdriver-manager update --gecko false
[11:58:46] I/update - chromedriver: file exists /home/tejaswin/bitcore/packages/insight-previous/node_modules/webdriver-manager/selenium/chromedriver_2.45.zip
[11:58:46] I/update - chromedriver: unzipping chromedriver_2.45.zip
[11:58:46] I/update - chromedriver: setting permissions to 0755 for /home/tejaswin/bitcore/packages/insight-previous/node_modules/webdriver-manager/selenium/chromedriver_2.45
[11:58:46] I/update - chromedriver: chromedriver_2.45 up to date
[11:58:46] I/update - selenium standalone: file exists /home/tejaswin/bitcore/packages/insight-previous/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.141.59.jar
[11:58:46] I/update - selenium standalone: selenium-server-standalone-3.141.59.jar up to date
lerna info lifecycle [email protected]~postinstall: [email protected]
> [email protected] postinstall /home/tejaswin/bitcore
> npm run bootstrap && npm run compile
> @8.0.0 bootstrap /home/tejaswin/bitcore
> lerna bootstrap
I did clone the repo, cd into the folder and then did the npm install.
@nadahalli that's weird, what OS are you installing it on? What's the node, npm versions you have?
I was able to install on Ubuntu 18 with the following:
~$ node --version
v9.0.0
~$ npm --version
5.5.1
~$ nvm --version
0.33.11
cat /etc/issue
Ubuntu 18.04.1 LTS \n \l
node --version
v8.10.0
npm --version
3.5.2
I don't have nvm installed. I will upgrade the other two and try again.
If you're getting an infinite loop with lerna that would mean theres some sort of circular symlink thing happening.
When you did this
sudo npm install -g --unsafe-perm=true bitcore-node
This probably has created a symlink for bitcore-node: ^8.0.0 back to the bitcore folder.
Try deleting the global install of bitcore-node and just keeping the repo
npm uninstall -g bitcore-node
cd bitcore
npm install
If you get requested to do
--unsafe-perm=true
that's because it's trying to prevent a lerna bootstrap after the npm install, because you are running npm as sudo. If you're having to do
sudo npm install -g <package_name>
for every global dependency you might want to make sure your user own's the global node_module directory.
@micahriggan Thanks for the detailed explanation of the symlink driven infinite loop. That might have been it, but I am not sure now. See below. @osagga Upgrading node and npm seems to have helped. Needed to install mongodb, and start the db server. That's totally fine. My entire point was to have an address index.