node.jsbitcoinbitcoindbitcorebitcoin-abc

Bitcore with bitcoin-abc(bitcoin cash) node error: "Waiting until BTC syncs before BCH mainnet"


System Environment

OS: Ubuntu Server 16.04

MongoDB Server: v3.4.22

Node.js: v10.16.3


What I did

I'm running a bitcoin-abc(bitcoin cash) node.

And I'm running a bitcore node to connect to the bitcoin-abc node.

The bitcoin-abc node is fully synchronized with the all blocks. It's got all the latest blocks.
and I checked that the rpc server is working fine.


Problems

But when I query to the bitcore api server(e.g. http://localhost:3000/api/BCH/mainnet/tx?blockHash=000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f),
it returns an empty array([]).

And on the bitcore terminal, it keeps printing this message below:
{"message":"Waiting until BTC syncs before BCH mainnet","level":"info"}
{"message":"Waiting until BTC syncs before BCH mainnet","level":"info"}
{"message":"Waiting until BTC syncs before BCH mainnet","level":"info"}


What I want


Logs and Configs

  1. these are logs from the bitcoin-abc node.
2020-03-02T03:59:38Z Bitcoin ABC version v0.21.1-d5771bf (release build)
2020-03-02T03:59:38Z InitParameterInteraction: parameter interaction: -whitelistforcerelay=1 -> setting -whitelistrelay=1
2020-03-02T03:59:38Z Checkpoints will be verified.
2020-03-02T03:59:38Z Assuming ancestors of block 0000000000000000016cd04fd29ee905f1581f553a67530d373ba2fc662b882e have valid signatures.
2020-03-02T03:59:38Z Setting nMinimumChainWork=0000000000000000000000000000000000000000011f9d9a6b2558233caf4bf2
2020-03-02T03:59:38Z Using the 'sse4(1way),sse41(4way),avx2(8way)' SHA256 implementation
2020-03-02T03:59:38Z Using RdSeed as additional entropy source
2020-03-02T03:59:38Z Using RdRand as an additional entropy source
2020-03-02T03:59:38Z Default data directory /home/ubuntu/.bitcoin
2020-03-02T03:59:38Z Using data directory /home/ubuntu/.bitcoin
2020-03-02T03:59:38Z Using config file /home/ubuntu/.bitcoin/bitcoin.conf
2020-03-02T03:59:38Z Using at most 125 automatic connections (1024 file descriptors available)
2020-03-02T03:59:38Z Using 32 MiB out of 32 requested for signature cache, able to store 1048576 elements
2020-03-02T03:59:38Z Using 32 MiB out of 32 requested for script execution cache, able to store 1048576 elements
2020-03-02T03:59:38Z Using 0 threads for script verification
2020-03-02T03:59:38Z No wallet support compiled in!
2020-03-02T03:59:38Z Binding RPC on address 0.0.0.0 port 51801 failed.
2020-03-02T03:59:38Z HTTP: creating work queue of depth 16
2020-03-02T03:59:38Z Config options rpcuser and rpcpassword will soon be deprecated. Locally-run instances may remove rpcuser to use cookie-based auth, or may be replaced with rpcauth. Please see share/rpcuser for rpcauth auth generation.
2020-03-02T03:59:38Z HTTP: starting 4 worker threads
2020-03-02T03:59:38Z init message: Loading banlist...
2020-03-02T03:59:38Z Cache configuration:
2020-03-02T03:59:38Z * Using 2.0MiB for block index database
2020-03-02T03:59:38Z * Using 56.0MiB for transaction index database
2020-03-02T03:59:38Z * Using 8.0MiB for chain state database
2020-03-02T03:59:38Z * Using 384.0MiB for in-memory UTXO set (plus up to 286.1MiB of unused mempool space)
2020-03-02T03:59:38Z init message: Loading block index...
2020-03-02T03:59:38Z Opening LevelDB in /home/ubuntu/.bitcoin/blocks/index
2020-03-02T03:59:38Z scheduler thread start
2020-03-02T03:59:38Z Opened LevelDB successfully
2020-03-02T03:59:38Z Using obfuscation key for /home/ubuntu/.bitcoin/blocks/index: 0000000000000000
2020-03-02T03:59:49Z LoadBlockIndexDB: last block file = 1092
2020-03-02T03:59:49Z LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=223, size=20808132, heights=624400...624622, time=2020-02-29T13:06:03Z...2020-03-02T03:57:28Z)
2020-03-02T03:59:49Z Checking all blk files are present...
2020-03-02T03:59:49Z Opening LevelDB in /home/ubuntu/.bitcoin/chainstate
2020-03-02T03:59:49Z Opened LevelDB successfully
2020-03-02T03:59:49Z Using obfuscation key for /home/ubuntu/.bitcoin/chainstate: 31f1b71842bca3d4
2020-03-02T03:59:50Z Loaded best chain: hashBestChain=000000000000000001ba55e15f85c23e03812441cf394df68f8aabcfad77e9d2 height=624622 date=2020-03-02T03:57:28Z progress=0.999998
2020-03-02T03:59:50Z init message: Verifying blocks...
2020-03-02T03:59:50Z Verifying last 6 blocks at level 3
2020-03-02T03:59:50Z [0%]...[16%]...[33%]...[50%]...[66%]...[83%]...[99%]...[DONE].
2020-03-02T03:59:50Z No coin database inconsistencies in last 6 blocks (1345 transactions)
2020-03-02T03:59:50Z  block index           12103ms
2020-03-02T03:59:50Z Opening LevelDB in /home/ubuntu/.bitcoin/indexes/txindex
2020-03-02T03:59:50Z Opened LevelDB successfully
2020-03-02T03:59:50Z Using obfuscation key for /home/ubuntu/.bitcoin/indexes/txindex: 0000000000000000
2020-03-02T03:59:50Z mapBlockIndex.size() = 624623
2020-03-02T03:59:50Z nBestHeight = 624622
2020-03-02T03:59:50Z Bound to [::]:51800
2020-03-02T03:59:50Z Bound to 0.0.0.0:51800
2020-03-02T03:59:50Z init message: Loading P2P addresses...
2020-03-02T03:59:50Z torcontrol thread start
2020-03-02T03:59:50Z txindex thread start
2020-03-02T03:59:50Z Syncing txindex with block chain from height 0
2020-03-02T03:59:50Z Imported mempool transactions from disk: 25 succeeded, 0 failed, 0 expired, 0 already there
2020-03-02T03:59:51Z Loaded 34472 addresses from peers.dat  596ms
2020-03-02T03:59:51Z init message: Starting network threads...
2020-03-02T03:59:51Z init message: Done loading
2020-03-02T03:59:51Z msghand thread start
2020-03-02T03:59:51Z opencon thread start
2020-03-02T03:59:51Z addcon thread start
2020-03-02T03:59:51Z dnsseed thread start
2020-03-02T03:59:51Z net thread start
2020-03-02T04:00:02Z Loading addresses from DNS seeds (could take a while)
2020-03-02T04:00:05Z 26 addresses found from DNS seeds
2020-03-02T04:00:05Z dnsseed thread exit
2020-03-02T04:00:09Z Leaving InitialBlockDownload (latching to false)
2020-03-02T04:00:09Z New outbound peer connected: version: 70015, blocks=624418, peer=0
2020-03-02T04:00:15Z ERROR: ContextualCheckBlockHeader: rejected by checkpoint lock-in at 556767
2020-03-02T04:00:15Z ERROR: AcceptBlockHeader: Consensus::ContextualCheckBlockHeader: 000000000000000001d956714215d96ffc00e0afda4cd0a96c96f8d802b1662b, checkpoint mismatch (code 67)
2020-03-02T04:00:15Z Misbehaving: 120.25.224.24:8333 peer=0 (0 -> 100) reason: checkpoint mismatch BAN THRESHOLD EXCEEDED
2020-03-02T04:00:15Z ERROR: invalid header received
2020-03-02T04:00:21Z Syncing txindex with block chain from height 137566
2020-03-02T04:00:27Z New outbound peer connected: version: 70015, blocks=624623, peer=8
2020-03-02T04:00:28Z UpdateTip: new best=0000000000000000004bd007c26cc4bf1ca30ccd0b73c2a21fad96364163bf77 height=624623 version=0x20000000 log2_work=88.183469 tx=285673057 date='2020-03-02T04:00:02Z' progress=1.000000 cache=0.0MiB(198txo)
2020-03-02T04:00:33Z New outbound peer connected: version: 80003, blocks=624623, peer=9
2020-03-02T04:00:52Z Syncing txindex with block chain from height 156318
2020-03-02T04:00:56Z New outbound peer connected: version: 70015, blocks=624623, peer=10
2020-03-02T04:00:57Z New outbound peer connected: version: 80003, blocks=624623, peer=11
2020-03-02T04:01:17Z New outbound peer connected: version: 80003, blocks=624623, peer=13
2020-03-02T04:01:23Z Syncing txindex with block chain from height 173617
2020-03-02T04:01:46Z New outbound peer connected: version: 70015, blocks=624623, peer=16
2020-03-02T04:01:47Z New outbound peer connected: version: 70015, blocks=620540, peer=17
2020-03-02T04:01:50Z New outbound peer connected: version: 70015, blocks=624623, peer=19
2020-03-02T04:01:52Z ERROR: ContextualCheckBlockHeader: rejected by checkpoint lock-in at 556767
2020-03-02T04:01:52Z ERROR: AcceptBlockHeader: Consensus::ContextualCheckBlockHeader: 000000000000000001d956714215d96ffc00e0afda4cd0a96c96f8d802b1662b, checkpoint mismatch (code 67)
2020-03-02T04:01:52Z Misbehaving: 52.83.43.1:8333 peer=17 (0 -> 100) reason: checkpoint mismatch BAN THRESHOLD EXCEEDED
2020-03-02T04:01:52Z ERROR: invalid header received
2020-03-02T04:01:52Z New outbound peer connected: version: 80003, blocks=624623, peer=20
2020-03-02T04:01:54Z Syncing txindex with block chain from height 180217
2020-03-02T04:02:25Z Syncing txindex with block chain from height 182851
2020-03-02T04:02:56Z Syncing txindex with block chain from height 185080
2020-03-02T04:03:27Z Syncing txindex with block chain from height 187316
2020-03-02T04:03:58Z Syncing txindex with block chain from height 190070
2020-03-02T04:04:29Z Syncing txindex with block chain from height 192529
2020-03-02T04:05:00Z Syncing txindex with block chain from height 194717
2020-03-02T04:05:31Z Syncing txindex with block chain from height 197928
2020-03-02T04:06:02Z Syncing txindex with block chain from height 201447
2020-03-02T04:06:33Z Syncing txindex with block chain from height 203922
2020-03-02T04:07:04Z Syncing txindex with block chain from height 205934
2020-03-02T04:07:35Z Syncing txindex with block chain from height 209010
2020-03-02T04:08:06Z Syncing txindex with block chain from height 211439
2020-03-02T04:08:37Z Syncing txindex with block chain from height 213373
2020-03-02T04:09:08Z Syncing txindex with block chain from height 216105
2020-03-02T04:09:39Z Syncing txindex with block chain from height 218601
2020-03-02T04:10:10Z Syncing txindex with block chain from height 221580
2020-03-02T04:10:41Z Syncing txindex with block chain from height 223821
2020-03-02T04:11:12Z Syncing txindex with block chain from height 225291
2020-03-02T04:11:43Z Syncing txindex with block chain from height 227651
2020-03-02T04:12:14Z Syncing txindex with block chain from height 229389
2020-03-02T04:12:45Z Syncing txindex with block chain from height 230966
2020-03-02T04:13:16Z Syncing txindex with block chain from height 232016
2020-03-02T04:13:47Z Syncing txindex with block chain from height 233675
2020-03-02T04:14:18Z Syncing txindex with block chain from height 235264
2020-03-02T04:14:49Z Syncing txindex with block chain from height 236604
2020-03-02T04:14:54Z UpdateTip: new best=0000000000000000006a37c379ae451146aaf2638d0005f1e24cb2b2f2d31d95 height=624624 version=0x20000000 log2_work=88.183478 tx=285673371 date='2020-03-02T04:14:05Z' progress=0.999999 cache=0.1MiB(1027txo)


  1. these are the log from the bitcore node.
{"message":"Starting Event Service","level":"info"}
{"message":"Starting P2P Manager","level":"info"}
{"message":"Starting BCH p2p worker","level":"info"}
(node:4034) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
{"message":"2020-03-02 13:02:34.575 GMT+9 | Connected to peer: 127.0.0.1:51800 | Chain: BCH | Network: mainnet","level":"info"}
{"message":"This worker is now the syncing node for BCH mainnet","level":"info"}
{"message":"Waiting until BTC syncs before BCH mainnet","level":"info"}
{"message":"Waiting until BTC syncs before BCH mainnet","level":"info"}
{"message":"Waiting until BTC syncs before BCH mainnet","level":"info"}
{"message":"Waiting until BTC syncs before BCH mainnet","level":"info"}
{"message":"Waiting until BTC syncs before BCH mainnet","level":"info"}
{"message":"Starting Event Service","level":"info"}
{"message":"Starting API Service on port 3000","level":"info"}
{"message":"Starting Socket Service","level":"info"}
{"message":"Started Socket Service","level":"info"}
{"message":"Waiting until BTC syncs before BCH mainnet","level":"info"}
{"message":"Waiting until BTC syncs before BCH mainnet","level":"info"}
{"message":"Waiting until BTC syncs before BCH mainnet","level":"info"}
{"message":"Waiting until BTC syncs before BCH mainnet","level":"info"}
{"message":"Waiting until BTC syncs before BCH mainnet","level":"info"}
{"message":"Waiting until BTC syncs before BCH mainnet","level":"info"}
{"message":"Waiting until BTC syncs before BCH mainnet","level":"info"}
{"message":"Waiting until BTC syncs before BCH mainnet","level":"info"}
{"message":"Waiting until BTC syncs before BCH mainnet","level":"info"}
{"message":"Waiting until BTC syncs before BCH mainnet","level":"info"}
{"message":"Waiting until BTC syncs before BCH mainnet","level":"info"}
{"message":"Waiting until BTC syncs before BCH mainnet","level":"info"}


  1. this is the bitcoin.conf file.
whitelist=127.0.0.1
txindex=1
listen=1
server=1
upnp=1

port=51800
rpcport=51801
rpcallowip=127.0.0.1

rpcuser=nuejason
rpcpassword=thisisthebchnode


  1. And the rpc server works fine.
ubuntu@ubuntu:~$ ./bitcoin-cli -rpcuser=nuejason -rpcpassword=thisisthebchnode -rpcport=51801 getblockchaininfo
{
  "chain": "main",
  "blocks": 624623,
  "headers": 624623,
  "bestblockhash": "0000000000000000004bd007c26cc4bf1ca30ccd0b73c2a21fad96364163bf77",
  "difficulty": 537438239526.6805,
  "mediantime": 1583118870,
  "verificationprogress": 0.9999913748297671,
  "initialblockdownload": false,
  "chainwork": "00000000000000000000000000000000000000000122b766cc1e475b372a9678",
  "size_on_disk": 165964133991,
  "pruned": false,
  "softforks": {
    "minerfund": {
      "type": "bip9",
      "bip9": {
        "status": "started",
        "bit": 0,
        "start_time": 1573819200,
        "timeout": 1589544000,
        "since": 610848,
        "statistics": {
          "period": 2016,
          "threshold": 1344,
          "elapsed": 1680,
          "count": 3,
          "possible": false
        }
      },
      "active": false
    },
    "minerfundabc": {
      "type": "bip9",
      "bip9": {
        "status": "started",
        "bit": 1,
        "start_time": 1573819200,
        "timeout": 1589544000,
        "since": 610848,
        "statistics": {
          "period": 2016,
          "threshold": 1344,
          "elapsed": 1680,
          "count": 3,
          "possible": false
        }
      },
      "active": false
    },
    "minerfundbchd": {
      "type": "bip9",
      "bip9": {
        "status": "started",
        "bit": 2,
        "start_time": 1573819200,
        "timeout": 1589544000,
        "since": 610848,
        "statistics": {
          "period": 2016,
          "threshold": 1344,
          "elapsed": 1680,
          "count": 3,
          "possible": false
        }
      },
      "active": false
    },
    "minerfundelectroncash": {
      "type": "bip9",
      "bip9": {
        "status": "started",
        "bit": 3,
        "start_time": 1573819200,
        "timeout": 1589544000,
        "since": 610848,
        "statistics": {
          "period": 2016,
          "threshold": 1344,
          "elapsed": 1680,
          "count": 3,
          "possible": false
        }
      },
      "active": false
    }
  },
  "warnings": "This is a pre-release test build - use at your own risk - do not use for mining or merchant applications"
}


  1. This is my MongoDB state. Is it normal to have 0 documents in the blocks collection?

MongdoDB screenshot


Solution

  • I found out what was wrong in my configuration.

    In bitcore.config.json I removed parentChain and forkHeight. And it works perfectly now. I didn't know exactly what those properties were for. I referred to this example template(bitcore.config.json). That's why I put those properties in it.

    Anyone who runs only bitcoin-abc node should Not include parentChain and forkHeight properties in bitcore.config.json.

    You can find the related answer here (https://github.com/bitpay/bitcore/issues/2742).