bitpay / bitcore-node

Extensible full node using Bitcore
https://bitcore.io/
Other
352 stars 644 forks source link

can't run insight-api with latest bitcore-node #518

Open antonio-fr opened 7 years ago

antonio-fr commented 7 years ago

Using package in npm cloud is working well because it uses old version, using bitcoin 0.12. Can lead to issue when parsing lastest blocks.

insight-api can't run properly on bitcore-node latest version, commit 7c34a160a941a40ea89a7d3fbffe90a9476610f6.

npm v 5.3.0 node v 8.4.0

git clone git@github.com:bitpay/bitcore-node.git
cd bitcore-node
npm install
node bin/bitcore-node create mynode
cd mynode
node ../bin/bitcore-node install insight-api
node ../bin/bitcore-node start

I got the following :

error: Error: More than one instance of bitcore-lib found. Please make sure to require bitcore-lib and check that submodules do not also include their own bitcore-lib dependency.
info: Checked the current working directory for service: node_modules/insight-api
info: Checked the built-in path: lib/services, for service: insight-api
info: Checked the module's package.json for service: insight-api
workingdir/bitcore-node/mynode/node_modules/bitcore-node/lib/scaffold/start.js:149
    throw new Error('Attempted to load the ' + service.name + ' service from: ' +
    ^

Error: Attempted to load the insight-api service from: the requirePath in the services' config, then "workingdir/bitcore-node/mynode" then from: "workingdir/bitcore-node/mynode/node_modules/bitcore-node/lib/scaffold/../lib/services" finally from: "workingdir/bitcore-node/mynode/package.json" - bitcoreNode field. All paths failed to find valid nodeJS code.
    at loadModule (workingdir/bitcore-node/mynode/node_modules/bitcore-node/lib/scaffold/start.js:149:11)
    at Function.setupServices (workingdir/bitcore-node/mynode/node_modules/bitcore-node/lib/scaffold/start.js:188:7)
    at start (workingdir/bitcore-node/mynode/node_modules/bitcore-node/lib/scaffold/start.js:25:31)
    at Command.<anonymous> (workingdir/bitcore-node/mynode/node_modules/bitcore-node/lib/cli/main.js:66:7)
    at Command.listener (workingdir/bitcore-node/mynode/node_modules/commander/index.js:300:8)
    at emitTwo (events.js:125:13)
    at Command.emit (events.js:213:7)
    at Command.parseArgs (workingdir/bitcore-node/mynode/node_modules/commander/index.js:635:12)
    at Command.parse (workingdir/bitcore-node/mynode/node_modules/commander/index.js:457:21)
    at Object.main (workingdir/bitcore-node/mynode/node_modules/bitcore-node/lib/cli/main.js:143:11)
antonio-fr commented 7 years ago

I succeed to make it work. The issue is that bitcore-node install is pulling from npm repo and get an old version of insight api. It's also needs to be installed from git (latest commit on github).

I did that in mynode dir and it works like a charm.

cd node_modules
rm -Rf insight-api
git clone git@github.com:bitpay/insight-api.git
cd insight-api
npm install
cd ../..
node ../bin/bitcore-node start

So you need to update all documentation and readme to NOT use bitcore-node install anymore. Or you alternatively, you can update bitcore-node install function to get from latest master repo commit on github.

pmosse commented 7 years ago

Hi Antonio, how are you doing? I am trying to replicate the same but using the testnet and I am having some troubles. Do you have a bitcore-node.json configuration file in the bitcore-node directory? Or just one inside the my-node subdirectory? Could you share them? I can't see Insight in the port 3001. Thanks! Patricio

mdraja786786 commented 7 years ago

Is it possible to configure bitcore node in such a manner to sync with my own coin, so that i can integrate it with insight UI. Please reply. I am stuck here, whenever i hit bitcore-node start command , it starts bitcoind and sync with bitcoin block chain

winteraz commented 6 years ago

Any idea if the data indexed is compatible ? I've just found out that the version of my insight API is 0.4.3and bitcore node3.1.3` . I've used the documentation and installed insight API through bitcore start node and now I've found out that this process installed an old version. It took me several weeks to index the data so this really sucks BIG TIME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Is there any good btc node api out there that's maintained and is working "by default"?

m24927605 commented 6 years ago

Here is my install steps,you can check it. https://github.com/m24927605/bitcore-node-v8-node.git

ww8912188 commented 6 years ago

@m24927605 I followed exactly your steps with no luck...

osagga commented 6 years ago

@ww8912188 Just use the bitpay/bitcore v8.0.0 branch (here), it should work out of the box, let me know if you can't make it work!

ww8912188 commented 6 years ago

@osagga Thanks for the quick response.

The issue is I want to config a BCH full node plus insight API. So I followed Micheal's steps. It still complained the requirePath Error which mentioned above:

Error: Attempted to load the insight-api service from: the requirePath in the services' config, then "workingdir/bitcore-node/mynode" then from: "workingdir/bitcore-node/mynode/node_modules/bitcore-node/lib/scaffold/../lib/services" finally from: "workingdir/bitcore-node/mynode/package.json" - bitcoreNode field. All paths failed to find valid nodeJS code.

I notice the the npm packages which bitcore-node used in his steps:

"dependencies": { "bcoin": "bitpay/bcoin#v1.0.0-beta.14+cash", "bitcoind-rpc": "^0.6.0", "bitcore-lib": "5.0.0-beta.1", "bitcore-p2p": "5.0.0-beta.1", "insight-api": "5.0.0-beta.44", }

There are several beta packages. Not sure they are the root cause of this requirePath issue.

osagga commented 6 years ago

@ww8912188 yeah I used to have all kinds of problems when installing the bitcore-node v5, but they seem to have fixed most of them in the new version (v8.0.0) that I linked above. It can natively run both BTC and BCH, give it a try.

m24927605 commented 6 years ago

@ww8912188 @osagga is right,bitcore-node version 8 is more better than version 5. I also remember @osagga has his solution on version 5(or version 3) and I have tried it several month ago,it worked .Maybe you can try his solution.

osagga commented 6 years ago

@m24927605 @ww8912188 Yes, if you really want to stick with v5 (since the API is slightly different between v5 and v8), I have this repo here that has a version of v5 that works with BCH. But as I said before, I highly suggest moving to v8 since it's the one currently supported.

ww8912188 commented 6 years ago

@osagga bitcore-node v8 + bitcoin ABC works smoothly on my side now. I can get access to the blockchain data through the port which bitcore-node exposed.

Is it possible to build insight-API upon bitcore-node v8? Since our team are all inclining to insight-API for legacy issue. I looked all over and it seems only old version bitcore-node could call install insight-api directly.

Thanks in advance for your advice.