bitcore icon indicating copy to clipboard operation
bitcore copied to clipboard

Not connected to peer: 127.0.0.1:8332 | Chain: BTC | Network: regtest

Open WesNz opened this issue 7 years ago • 32 comments

Currently i'm using the bitcore.config.json test file in the bitcore root. (below) Below is the bitcoin.conf info.

txindex=1 server=1 listen=1 irc=1 upnp=1 port=8332 rpcport=8333 dbcache=4096 rpcallowip=127.0.0.1 rpcuser=test rpcpassword=supersecretpassword


{ "bitcoreNode": { "services": { "api": { "wallets": { "allowCreationBeforeCompleteSync": true } } }, "chains": { "BTC": { "regtest": { "chainSource": "p2p", "trustedPeers": [ { "host": "127.0.0.1", "port": 8332 } ], "rpc": { "host": "127.0.0.1", "port": 8333, "username": "test", "password": "supersecretpassword" } } } } } }


info: Starting Event Service info: Starting P2P Manager warn: 2019-05-22 11:47:20.743 GMT+12 | Not connected to peer: 127.0.0.1:8332 | Chain: BTC | Network: regtest info: Starting Event Service info: Starting API Service on port 3000 info: Starting Socket Service info: Starting Event Service info: Starting API Service on port 3000 info: Starting Socket Service

WesNz avatar May 21 '19 23:05 WesNz

+1 same problem...wondering if the bitcoin.conf is not supposed to go in the root bitcore directory

ApolloMuses avatar May 22 '19 09:05 ApolloMuses

Starting bitcoind and then Running node worked

WesNz avatar May 22 '19 09:05 WesNz

did you have to install bitcoind separately?

ApolloMuses avatar May 22 '19 09:05 ApolloMuses

Already had it installed and blockchain downloaded. Just figured it needed to connect to the bitcoind/bitcoin core wallet rpc/port

WesNz avatar May 22 '19 09:05 WesNz

I'm running into this same problem. Can you expand on this @WesNz:

Starting bitcoind and then Running node worked

I've got bitcoind running in a Docker container and I can successfully make RPC calls to it. But I'm getting the same error you reported in this Issue.

How did you fix it? Your comment leads me to believe that you didn't have bitcoind running and that's why you got the error? And you fixed it by running bitcoind?

christroutner avatar May 22 '19 18:05 christroutner

@christroutner do you have the p2p ports exposed on your docker container?

Bitcore-node talks to the bitcoin node over p2p, so those ports need to be exposed, and also the bitcoin node doesn't respond to getBlock p2p messages until after the bitcoin node has fully synced.

micahriggan avatar May 22 '19 18:05 micahriggan

Thanks for the fast response! I just opened issue #2198. To answer your questions:

  • I can communicate with the node via the RPC on port 8332. I assume that's what you mean by p2p?

  • The node is fully synced.

christroutner avatar May 22 '19 18:05 christroutner

So does this mean the v8 node requires a separate installation of the full node? Where as v4 did not?

On Wed, May 22, 2019 at 11:40 AM Chris Troutner [email protected] wrote:

Thanks for the fast response! I just opened issue #2198 https://github.com/bitpay/bitcore/issues/2198. To answer your questions:

I can communicate with the node via the RPC on port 8332. I assume that's what you mean by p2p?

The node is fully synced.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bitpay/bitcore/issues/2197?email_source=notifications&email_token=AAZ6SSOSME32XJAPB2DFVHLPWWHSRA5CNFSM4HOPSFG2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODV75JEI#issuecomment-494916753, or mute the thread https://github.com/notifications/unsubscribe-auth/AAZ6SSI2UW5CBX2VAZ55XRTPWWHSRANCNFSM4HOPSFGQ .

ApolloMuses avatar May 22 '19 19:05 ApolloMuses

Correct! Bitcore talks to a full node. The patched full node version was hard to maintain and didn't scale like we needed.

micahriggan avatar May 22 '19 19:05 micahriggan

Ahh okay that clarifies a lot of confusion. Another quick question, for BCH, would v8 just need the BCH ABC full node to full or will it need the reference BTC node too?

ApolloMuses avatar May 22 '19 20:05 ApolloMuses

Correct! Bitcore talks to a full node. The patched full node version was hard to maintain and didn't scale like we needed.

WesNz avatar May 22 '19 20:05 WesNz

@christroutner do you have the p2p ports exposed on your docker container?

Bitcore-node talks to the bitcoin node over p2p, so those ports need to be exposed, and also the bitcoin node doesn't respond to getBlock p2p messages until after the bitcoin node has fully synced.

Trusted P2P Peer - I see this on the requirements, Is that an app?

WesNz avatar May 22 '19 20:05 WesNz

@ApolloMuses Just the BCH full node. @WesNz Trusted P2P peer would be your BTC or BCH node, or someone else's who you trust

micahriggan avatar May 22 '19 20:05 micahriggan

Ah okay so then in the bitcore.config.json then it should only have the BCH configurations then?

e.g.


{
  "bitcoreNode": {
    "chains": {
      "BCH": {
        "mainnet": {
          "parentChain": "p2p",
          "trustedPeers": [
            {
              "host": "127.0.0.1",
              "port": 30008
            }
          ],
          "rpc": {
            "host": "127.0.0.1",
            "port": 30009,
            "username": "username",
            "password": "password"
          }
        }
      }
    }
  }
}

or would it require the BTC config too?

ApolloMuses avatar May 22 '19 20:05 ApolloMuses

Just BCH in the config :)

If you wanted it to sync both BTC and BCH, then you'd have them both in chains

micahriggan avatar May 22 '19 20:05 micahriggan

Ahh thanks for clearing that up! This has been driving me nuts for the last week xD. Will test this now and if its successful, I'll draft up some documentation

ApolloMuses avatar May 22 '19 20:05 ApolloMuses

For instance, my config looks like this

    "chains": {
      "BTC": {
        "mainnet": {
          "chainSource": "p2p",
          "trustedPeers": [
            {
              "host": "127.0.0.1",
              "port": 20000
            }
          ],
          "rpc": {
            "host": "127.0.0.1",
            "port": 20001,
            "username": "bitpaytest",
            "password": "local321"
          }
        },
        "regtest": {
          "chainSource": "p2p",
          "trustedPeers": [
            {
              "host": "127.0.0.1",
              "port": 20004
            }
          ],
          "rpc": {
            "host": "127.0.0.1",
            "port": 20005,
            "username": "bitpaytest",
            "password": "local321"
          }
        }
      },
      "BCH": {
        "mainnet": {
          "parentChain": "BTC",
          "forkHeight": 478558,
          "trustedPeers": [
            {
              "host": "127.0.0.1",
              "port": 30000
            }
          ],
          "rpc": {
            "host": "127.0.0.1",
            "port": 30001,
            "username": "username",
            "password": "password"
          }
        },
        "regtest": {
          "chainSource": "p2p",
          "trustedPeers": [
            {
              "host": "127.0.0.1",
              "port": 30004
            }
          ],
          "rpc": {
            "host": "127.0.0.1",
            "port": 30005,
            "username": "username",
            "password": "password"
          }
        }
      }
    }

But I have synced BTC already, so by setting forkHeight I can prune out some data for BCH that wasn't relevant at the time of fork*

micahriggan avatar May 22 '19 20:05 micahriggan

Testing this now with a bch abc node syncing. Another quick question, the old insight-ui was using port 3001, I can't seem to find the relevant info in v8? Care to shed some light?

ApolloMuses avatar May 22 '19 21:05 ApolloMuses

If you're wanting to run insight I think you can do

npm run insight-previous

That should launch the UI and the ui should talk to your local bitcore-node

micahriggan avatar May 22 '19 22:05 micahriggan

I tried that previous but only saw errors. Just to confirm the ui is served on port 8200?

Here's the error log:

> @bitpay/[email protected] start /home/ubuntu/bitcore/packages/insight-previous
> npm run ionic:serve


> @bitpay/[email protected] ionic:serve /home/ubuntu/bitcore/packages/insight-previous
> ionic-app-scripts serve --port 8200

[22:12:42]  ionic-app-scripts 3.2.3
[22:12:42]  watch started ...
[22:12:42]  build dev started ...
[22:12:42]  Proxy added:/api => http://localhost:3000/api
[22:12:42]  clean started ...
[22:12:42]  clean finished in 6 ms
[22:12:42]  copy started ...
[22:12:42]  deeplinks started ...
[22:12:42]  deeplinks finished in 353 ms
[22:12:42]  transpile started ...
[22:12:53]  typescript: home/ubuntu/bitcore/node_modules/@types/mocha/index.d.ts, line: 2680
            Duplicate identifier 'beforeEach'.

    L2680:  * @see https://mochajs.org/api/global.html#afterEach

[22:12:53]  typescript: home/ubuntu/bitcore/node_modules/@types/mocha/index.d.ts, line: 2698
            Duplicate identifier 'afterEach'.

    L2698:  declare var describe: Mocha.SuiteFunction;

[22:12:53]  typescript: home/ubuntu/bitcore/node_modules/@types/mocha/index.d.ts, line: 2714
            Duplicate identifier 'describe'.

    L2715:   * Pending suite.

[22:12:53]  typescript: home/ubuntu/bitcore/node_modules/@types/mocha/index.d.ts, line: 2735
            Duplicate identifier 'xdescribe'.

    L2736:   * Describes a test case.

[22:12:53]  typescript: home/ubuntu/bitcore/node_modules/@types/mocha/index.d.ts, line: 2749
            Duplicate identifier 'it'.

    L2750:   * Describes a pending test case.

[22:12:53]  typescript: home/ubuntu/bitcore/node_modules/@types/mocha/index.d.ts, line: 2770
            Duplicate identifier 'xit'.

    L2769:  // NOTE: Mocha *must not* have a direct dependency on DOM types.
    L2770:  // tslint:disable-next-line no-empty-interface
    L2771:  interface HTMLLIElement { }

[22:12:53]  typescript: node_modules/@types/jasmine/index.d.ts, line: 9
            Duplicate identifier 'describe'.

       L9:  /** If you call the function pending anywhere in the spec body, no matter the expectations, the spec will be
      L10:  declare function pending(reason?: string): void;

[22:12:53]  typescript: node_modules/@types/jasmine/index.d.ts, line: 11
            Duplicate identifier 'xdescribe'.

      L10:  declare function pending(reason?: string): void;
      L12:  declare function beforeEach(action: (done: DoneFn) => void, timeout?: number): void;

[22:12:53]  typescript: node_modules/@types/jasmine/index.d.ts, line: 13
            Duplicate identifier 'it'.

      L12:  declare function beforeEach(action: (done: DoneFn) => void, timeout?: number): void;
      L13:  declare function afterEach(action: (done: DoneFn) => void, timeout?: number): void;

[22:12:53]  typescript: node_modules/@types/jasmine/index.d.ts, line: 15
            Duplicate identifier 'xit'.

      L15:  declare function beforeAll(action: (done: DoneFn) => void, timeout?: number): void;
      L16:  declare function afterAll(action: (done: DoneFn) => void, timeout?: number): void;

[22:12:53]  typescript: node_modules/@types/jasmine/index.d.ts, line: 20
            Duplicate identifier 'beforeEach'.

      L19:  declare function expect(actual: any): jasmine.Matchers;
      L21:  declare function fail(e?: any): void;

[22:12:53]  typescript: node_modules/@types/jasmine/index.d.ts, line: 21
            Duplicate identifier 'afterEach'.

      L21:  declare function fail(e?: any): void;
      L22:  /** Action method that should be called when the async work is complete */

[22:12:53]  dev server running: http://localhost:8200/

[22:12:53]  Failed to open the browser: Command failed: xdg-open "http://localhost:8200" /bin/sh: 1: xdg-open: not found
[22:12:53]  copy finished in 11.53 s
(node:30782) UnhandledPromiseRejectionWarning: Error: A watch configured to watch the following paths failed to start. It likely that a file referenced does not exist: /home/ubuntu/bitcore/packages/insight-previous/src/assets/**/*, /home/ubuntu/bitcore/packages/insight-previous/src/index.html, /home/ubuntu/bitcore/packages/insight-previous/src/manifest.json, /home/ubuntu/bitcore/packages/insight-previous/src/service-worker.js, /home/ubuntu/bitcore/packages/insight-previous/node_modules/ionicons/dist/fonts/**/*, /home/ubuntu/bitcore/packages/insight-previous/node_modules/ionic-angular/fonts/**/*, /home/ubuntu/bitcore/packages/insight-previous/node_modules/ionic-angular/polyfills/polyfills.js, /home/ubuntu/bitcore/packages/insight-previous/node_modules/sw-toolbox/sw-toolbox.js
    at new BuildError (/home/ubuntu/bitcore/packages/insight-previous/node_modules/@ionic/app-scripts/dist/util/errors.js:16:28)
    at Timeout._onTimeout (/home/ubuntu/bitcore/packages/insight-previous/node_modules/@ionic/app-scripts/dist/watch.js:71:20)
    at ontimeout (timers.js:498:11)
    at tryOnTimeout (timers.js:323:5)
    at Timer.listOnTimeout (timers.js:290:5)
(node:30782) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:30782) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. 

ApolloMuses avatar May 22 '19 22:05 ApolloMuses