bitpay / bitcore-node

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

Using Bitcoin core data for bitcore-node #469

Open elichai opened 8 years ago

elichai commented 8 years ago

Hi, Is it possible to use Bitcoin core data for bitcore-node? (I tried just setting up a link and I got this error:) (I have txindex on in my Bitcoin Core)

[2016-07-12T14:35:06.223Z] error: Invalid state: "txindex" option is required in order to use transaction query features of bitcore-node. Please add "txindex=1" to your configuration and reindex an existing database if necessary with reindex=1
Error
    at Error.NodeError (/home/elichai2/mynode/node_modules/bitcore-lib/lib/errors/index.js:20:41)
    at Object.module.exports.checkState (/home/elichai2/mynode/node_modules/bitcore-lib/lib/util/preconditions.js:9:13)
    at Bitcoin._checkConfigIndexes (/home/elichai2/mynode/node_modules/bitcore-node/lib/services/bitcoind.js:375:5)
    at Bitcoin._loadSpawnConfiguration (/home/elichai2/mynode/node_modules/bitcore-node/lib/services/bitcoind.js:370:8)
    at Bitcoin._spawnChildProcess (/home/elichai2/mynode/node_modules/bitcore-node/lib/services/bitcoind.js:842:10)
    at /home/elichai2/mynode/node_modules/bitcore-node/lib/services/bitcoind.js:972:14
    at /home/elichai2/mynode/node_modules/async/lib/async.js:718:13
    at iterate (/home/elichai2/mynode/node_modules/async/lib/async.js:262:13)
    at async.forEachOfSeries.async.eachOfSeries (/home/elichai2/mynode/node_modules/async/lib/async.js:281:9)
    at _parallel (/home/elichai2/mynode/node_modules/async/lib/async.js:717:9)
braydonf commented 8 years ago

Yes, you can use the existing blocks however you'll need to reindex after updating bitcoin.conf to enable addressindex, spentindex and timestampindex, plus enable zmq. It's generally a good idea to keep the datadir separate from the default bitcoin location so that there isn't confusion if you have both versions.

elichai commented 8 years ago

How can I do all that?

braydonf commented 8 years ago

There is a guide that goes over the options here:

elichai commented 8 years ago

Hi, I did it and now I get this Error:

elichai2@Lenovo-G510:~/mynode$ bitcore-node start
/home/elichai2/mynode/node_modules/bindings/bindings.js:83
        throw e
              ^
Error: Module version mismatch. Expected 14, got 48.
    at Error (native)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at bindings (/home/elichai2/mynode/node_modules/bindings/bindings.js:76:44)
    at Object.<anonymous> (/home/elichai2/mynode/node_modules/zmq/lib/index.js:6:30)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32
STRML commented 8 years ago

@elichai That's simply a nodejs error with native modules - you'll want to reinstall bitcore-node, or go into the containing directory (/home/elichai2/mynode) and npm rebuild.

elichai commented 8 years ago

This fixed it. Now it works fine except the blocks section (insight is "waiting for blocks" endlessly)

hawthornetr commented 7 years ago

Did you ever figure that out? The waiting for blocks thing? I have this issue.