Bitcore v4.0.0


(Armen Chakhalyan) #1

Hi All, I have update bitcoin v4.0.0 and when I have call getInfo or bitcoind functions does does not work, and printed following error.

var client = self.nodes[self.nodesIndex].client;
                                              ^
TypeError: Cannot read property 'client' of undefined
    at Bitcoin.Object.defineProperty.get [as client] (/root/myNode/node_modules/bitcore-node/lib/services/bitcoind.js:138:47)
    at Bitcoin.getInfo (/root/myNode/node_modules/bitcore-node/lib/services/bitcoind.js:2005:7)
    at /root/myNode/app.js:40:28
    at /root/myNode/node_modules/bitcore-node/lib/node.js:252:16
    at /root/myNode/node_modules/bitcore-node/node_modules/async/lib/async.js:52:16
    at /root/myNode/node_modules/bitcore-node/node_modules/async/lib/async.js:264:21
    at /root/myNode/node_modules/bitcore-node/node_modules/async/lib/async.js:44:16
    at /root/myNode/node_modules/bitcore-node/lib/node.js:198:14
    at /root/myNode/node_modules/bitcore-node/lib/services/bitcoind.js:969:14
    at /root/myNode/node_modules/bitcore-node/node_modules/async/lib/async.js:726:13

what’s a problem?


(Braydon Fuller) #2

You likely have not started the node, please see discussion in: How to get balance of a address using bitcore api


(Armen Chakhalyan) #3

thanks Braydon, I have not added ZMQ configuration.
My custom node is working now, but when I get information about that node it include following warning.
errors: 'Warning: This version is obsolete; upgrade required!',
Except that when I get transaction via bitcoin service or insight-api, there are many null values of input and output properties.
for example
vin: [
{
txid: “a3317440b19c2397227babc3a0952cffffbb35d59d1862082fe1c5f322f28aba”,
vout: 1,
scriptSig: {
asm: “3045022100960df051b9253ad120081f3a5c57397df60fbfd3703efa106f1c3413accd139e02207b1904644fadff512857c75fb286896013b2055cb9ba7fc7fb690e7704e9ec83[ALL] 031f1e581ad8a25b7df6661756c257068d84b8a1498d3e0bc046559a89b60d866b”,
hex: “483045022100960df051b9253ad120081f3a5c57397df60fbfd3703efa106f1c3413accd139e02207b1904644fadff512857c75fb286896013b2055cb9ba7fc7fb690e7704e9ec830121031f1e581ad8a25b7df6661756c257068d84b8a1498d3e0bc046559a89b60d866b”
},
sequence: 4294967295,
n: 0,
addr: null,
valueSat: null,
value: 0,
doubleSpentTxID: null
}
],
vout: [
{
value: “0.00255999”,
n: 0,
scriptPubKey: {
hex: “76a91448e3dce870b9cdc7ce9bf8feb5c5a89b85fb69e188ac”,
asm: “OP_DUP OP_HASH160 48e3dce870b9cdc7ce9bf8feb5c5a89b85fb69e1 OP_EQUALVERIFY OP_CHECKSIG”,
addresses: [
“17eQd1JL1nNYgiibdhEH9fxe3yCzLK8gkf”
],
type: “pubkeyhash”
},
spentTxId: null,
spentIndex: null,
spentHeight: null
}
],


(Braydon Fuller) #4

The first warning is about the upgrade to 0.12.1 bitcoin release that includes a soft fork for BIP68/112/113, and will be activating soon. We have rebased our changes on 0.12.1 already and can be expected in the next release.

The null values on spentTxId are expected, and will only be set in it’s spent.


(Armen Chakhalyan) #5

Hi Braydon,

Thank you so much for the answer. The first warning problem was fixed as a result of updating (from 3.0.0 to 3.0.1).

Could you please answer to the following question as well:
I get different values in case of different bitcore-node versions (v 1.0.1 & v3.0.1).
In case of 3.0.1 I get null values but in case of 1.0.1, the picture is different (see below for the particular fields). Please take into the consideration that for both cases the transaction hash is the same.

Case 1 (3.0.1)
addr: null,
valueSat: null,
value: 0

Case 2(1.0.1)
addr: “1BoFajaVNQ5Z8a3E7ZQvt8sWyTCGrxRtS9”,
valueSat: 1210066,
value: 0.01210066,

Hash: “313b59832f3ae74a9ebe38b824a3c5ddb5a8df0f067043aeae0e8d19783529a2”

Do you have any idea what is going on in the mentioned cases?

Thank you.


(Braydon Fuller) #6

I’m getting those values filled from querying locally. Please make sure that you’re running the correct version of bitcoind (https://bitcore.io/bitcoin) and that you have bitcoin.conf configured properly, please see: https://github.com/bitpay/bitcore-node/blob/master/docs/upgrade.md


(Armen Chakhalyan) #7

Hi ! Thank you for your advice. The point is that I tried the recommended way already. Do you have another recommendation?


(Braydon Fuller) #8

What versions are you running? And what indexes are enabled in bitcoin.conf and have you reindexed?


(Armen Chakhalyan) #9

Hi,
I have run bitcore v4.0.0 and my bitcoin.conf is it`

server=1
whitelist=127.0.0.1
txindex=1
addressindex=1
timestampindex=1
spentindex=1
zmqpubrawtx=tcp://127.0.0.1:28332
zmqpubhashblock=tcp://127.0.0.1:28332
rpcallowip=127.0.0.1
rpcuser=username
rpcpassword=password
uacomment=bitcore

(Braydon Fuller) #10

Which version of bitcoind is the bitcore-node.json pointing to? And have you reindexed bitcoind? You’re taking the upgrade path, correct?


(Armen Chakhalyan) #11

I thing yes, becouse blockchain db in my node updated. my bitcore-node.config is it.
{
“network”: “livenet”,
“port”: 3001,
“services”: [
“bitcoind”,
“insight-api”,
“insight-ui”,
“web”
],
“servicesConfig”: {
“bitcoind”: {
“spawn”: {
“datadir”: “/home/.bitcore/”,
“exec”: “/root/.nvm/versions/v0.12.10/lib/node_modules/bitcore/node_modules/bitcore-node/bin/bitcoind”
}
}
}
}


(Braydon Fuller) #12
  1. Did everything install properly? Typically there will be permission issues when installing globally with a user with root permissions. Specifically the preinstall script run at install to download bitcoind.

  2. Typically the datadir will be /home/<user>/.bitcore/data or /home/<user>/.bitcoin/. The .bitcore directory is the default directory for bitcore-node.json and related files and not overlapped with the bitcoin datadir itself, did you specify this manually?

  3. Is there a reason you’re using Node.js v0.12.10 instead of Node.js v4 LTS?

And finally, I would try running commands against bitcoind directly, with:

cd /<path-to-nvm-here>/.nvm/versions/<your-node-version-here>/lib/node_modules/bitcore/node_modules/bitcore-node/bin/bitcoin-0.12.0/bin/
./bitcoin-cli --datadir=<your-datadir-here> getinfo
./bitcoin-cli --datadir=<your-datadir-here> getaddressbalance '{"addresses": ["12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX"]}'

Edit: BTW, a quick way to find the location of bitcore is to run this command in a terminal: which bitcore, and that will give the location of the directory to cd into in the above script.


(Armen Chakhalyan) #13

thanks Braydon.

  1. everything have installed success, when I have used bitcore v3.0.0 our node was works successful.
  2. point 2 is a same. in my server also has default directory and they content bitcore-node.json and data directory.
  3. Yes, I have use Node.js module which works only Node.js v0.12.10.

(Braydon Fuller) #14

Please also make sure that you can run and call bitcoind and bitcoin-cli with the above details.