Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to deploy bitcoin-cash-node server using bitcore and bitcoin-abc??? who can help me #568

Open
zhousi666 opened this issue Jun 8, 2018 · 4 comments

Comments

@zhousi666
Copy link

Hi ,all:
my question:
I deploy bitcoin-cash-node server using bitcore and bitcoin-abc,and I have some question,I need some help.

//bitcore: [email protected]
//bitcoin-abc: https://download.bitcoinabc.org/0.17.2/linux/bitcoin-abc-0.17.2-i686-pc-linux-gnu.tar.gz

first, my deployment process as follows:

  1. my operating system is centos:centos7, I did the following preparations:
    yum install -y epel-release
    yum install -y zeromq-devel gcc gcc-c++ automake autoconf libtool make git wget
    wget https://nodejs.org/download/release/latest-v8.x/node-v8.11.2-linux-x64.tar.gz /root
    cd /root
    tar --strip-components 1 -xzvf node-v* -C /usr/local
  1. install bitcore and create bitcoin-cash-node
    npm i npm@latest -g
    npm install -g --unsafe-perm [email protected]
    bitcore create bitcoin-cash-node
    cd /root/bitcoin-cash-node
    bitcore install insight-api insight-ui
  1. download the bitcoin-abc, let the bitcoind point to bitcoin-abc/bin/bitcoind
    cd/usr/local/lib/node_modules/bitcore/node_modules/bitcore-node/bin
    wget https://download.bitcoinabc.org/0.17.2/linux/bitcoin-abc-0.17.2-x86_64-linux-gnu.tar.gz  ./
    tar -xzf bitcoin-abc-0.17.2-x86_64-linux-gnu.tar.gz
    ln -sf bitcoin-abc-0.17.2/bin/bitcoind bitcoind
  1. run the bitcore
    cd /root/bitcoin-cash-node
    bitcore start

bitcore-node.json:

    {
      "network": "livenet",
      "port": 3001,
      "services": [
        "bitcoind",
        "web"
      ],
      "servicesConfig": {
        "bitcoind": {
          "spawn": {
            "datadir": "/root/data/live.bitcoin.cash.node",
            "exec": "/usr/local/lib/node_modules/bitcore/node_modules/bitcore-node/bin/bitcoind"
          }
        }
      }
    }

debug.log

2018-06-08 07:30:51 Bitcoin ABC version v0.17.2.0-4fd0b1b
2018-06-08 07:30:51 InitParameterInteraction: parameter interaction: -whitelistforcerelay=1 -> setting -whitelistrelay=1
2018-06-08 07:30:51 Assuming ancestors of block 000000000000000000e45ad2fbcc5ff3e85f0868dd8f00ad4e92dffabe28f8d2 have valid signatures.
2018-06-08 07:30:51 Setting nMinimumChainWork=000000000000000000000000000000000000000000a0f3064330647e2f6c4828
2018-06-08 07:30:51 Using the 'sse4' SHA256 implementation
2018-06-08 07:30:51 Default data directory /root/.bitcoin
2018-06-08 07:30:51 Using data directory /root/data/live.bitcoin.cash.node
2018-06-08 07:30:51 Using config file /root/data/live.bitcoin.cash.node/bitcoin.conf
2018-06-08 07:30:51 Using at most 125 automatic connections (1048576 file descriptors available)
2018-06-08 07:30:51 Using 32 MiB out of 32 requested for signature cache, able to store 1048576 elements
2018-06-08 07:30:51 Using 32 MiB out of 32 requested for script execution cache, able to store 1048576 elements
2018-06-08 07:30:51 Using 12 threads for script verification
2018-06-08 07:30:51 scheduler thread start
2018-06-08 07:30:52 Binding RPC on address 0.0.0.0 port 8332 failed.
2018-06-08 07:30:52 HTTP: creating work queue of depth 16
2018-06-08 07:30:52 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.
2018-06-08 07:30:52 HTTP: starting 4 worker threads
2018-06-08 07:30:52 init message: Verifying wallet(s)...
2018-06-08 07:30:52 Using BerkeleyDB version Berkeley DB 5.3.28: (September  9, 2013)
2018-06-08 07:30:52 Using wallet wallet.dat
2018-06-08 07:30:52 CDBEnv::Open: LogDir=/root/data/live.bitcoin.cash.node/database ErrorFile=/root/data/live.bitcoin.cash.node/db.log
2018-06-08 07:30:52 Bound to [::]:8333
2018-06-08 07:30:52 Bound to 0.0.0.0:8333
2018-06-08 07:30:52 Cache configuration:
2018-06-08 07:30:52 * Using 56.2MiB for block index database
2018-06-08 07:30:52 * Using 8.0MiB for chain state database
2018-06-08 07:30:52 * Using 385.8MiB for in-memory UTXO set (plus up to 286.1MiB of unused mempool space)
2018-06-08 07:30:52 init message: Loading block index...
2018-06-08 07:30:52 Opening LevelDB in /root/data/live.bitcoin.cash.node/blocks/index
2018-06-08 07:30:52 Opened LevelDB successfully
2018-06-08 07:30:52 Using obfuscation key for /root/data/live.bitcoin.cash.node/blocks/index: 0000000000000000
2018-06-08 07:30:52 Opening LevelDB in /root/data/live.bitcoin.cash.node/chainstate
2018-06-08 07:30:52 Opened LevelDB successfully
2018-06-08 07:30:52 Using obfuscation key for /root/data/live.bitcoin.cash.node/chainstate: a6180703dbbc65c8
2018-06-08 07:30:52 Upgrading utxo-set database...
2018-06-08 07:30:52 [0%]...[10%]...[20%]...[30%]...[40%]...[50%]...[60%]...[70%]...[80%]...[90%]...[100%]...[DONE].
2018-06-08 07:31:17 LoadBlockIndexDB: last block file = 2
2018-06-08 07:31:17 LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=4752, size=112031878, heights=130618...136003, time=2011-06-13...2011-07-13)
2018-06-08 07:31:17 Checking all blk files are present...
2018-06-08 07:31:17 LoadBlockIndexDB: transaction index enabled
2018-06-08 07:31:17 Initializing databases...
2018-06-08 07:31:17 Loaded best chain: hashBestChain=00000000000006d50e5d70eb52febdb7cc8f832f0e679b662ba6e895c0d35240 height=135872 date=2011-07-12 07:42:11 progress=0.003795

second, my problem description as follows:

When I run the bitcore service, the synchronization of the service block is very normal, but when I request the transaction data of the block through the insight, the service will be wrong, but the service will restart automatically. I am puzzled, I do not know where is wrong, who can help me ? and gave me a deploy documents. thank you。

ERROR:

[2018-06-08T08:49:58.011Z] info: ::ffff:172.31.3.190 web socket subscribe: sync
[2018-06-08T08:49:58.012Z] info: ::ffff:172.31.3.190 "GET /insight-api/sync" 200 117 37.913 "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36" 
[2018-06-08T08:49:58.098Z] info: ::ffff:172.31.3.190 "GET /insight-api/status?q=getInfo" 200 207 90.614 "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36" 
[2018-06-08T08:49:59.680Z] info: ::ffff:172.31.3.190 "GET /insight-api/peer" 304 - 0.394 "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36" 
[2018-06-08T08:49:59.681Z] info: ::ffff:172.31.3.190 web socket subscribe: sync
[2018-06-08T08:49:59.993Z] info: ::ffff:172.31.3.190 "GET /insight-api/block/0000000000000000003b421398b983ff7b7cdb49f07b799dcf28e6026e118971" 304 - 407.354 "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36" 
[2018-06-08T08:50:00.319Z] error: uncaught exception: Error: Non-base58 character
    at Object.decode (/root/bitcore-cash-node/node_modules/bitcore-lib/node_modules/bs58/lib/bs58.js:51:37)
    at Function.Base58.decode (/root/bitcore-cash-node/node_modules/bitcore-lib/lib/encoding/base58.js:48:26)
    at Function.Base58Check.decode (/root/bitcore-cash-node/node_modules/bitcore-lib/lib/encoding/base58check.js:45:31)
    at Function.Address._transformString (/root/bitcore-cash-node/node_modules/bitcore-lib/lib/address.js:279:35)
    at Address._classifyArguments (/root/bitcore-cash-node/node_modules/bitcore-lib/lib/address.js:107:20)
    at new Address (/root/bitcore-cash-node/node_modules/bitcore-lib/lib/address.js:73:19)
    at Object.Address (/root/bitcore-cash-node/node_modules/bitcore-lib/lib/address.js:51:12)
    at TxController.transformOutput (/root/bitcore-cash-node/node_modules/insight-api/lib/transactions.js:153:27)
    at Array.map (<anonymous>)
    at TxController.transformTransaction (/root/bitcore-cash-node/node_modules/insight-api/lib/transactions.js:77:42)
[2018-06-08T08:50:00.324Z] error: Error: Non-base58 character
    at Object.decode (/root/bitcore-cash-node/node_modules/bitcore-lib/node_modules/bs58/lib/bs58.js:51:37)
    at Function.Base58.decode (/root/bitcore-cash-node/node_modules/bitcore-lib/lib/encoding/base58.js:48:26)
    at Function.Base58Check.decode (/root/bitcore-cash-node/node_modules/bitcore-lib/lib/encoding/base58check.js:45:31)
    at Function.Address._transformString (/root/bitcore-cash-node/node_modules/bitcore-lib/lib/address.js:279:35)
    at Address._classifyArguments (/root/bitcore-cash-node/node_modules/bitcore-lib/lib/address.js:107:20)
    at new Address (/root/bitcore-cash-node/node_modules/bitcore-lib/lib/address.js:73:19)
    at Object.Address (/root/bitcore-cash-node/node_modules/bitcore-lib/lib/address.js:51:12)
    at TxController.transformOutput (/root/bitcore-cash-node/node_modules/insight-api/lib/transactions.js:153:27)
    at Array.map (<anonymous>)
    at TxController.transformTransaction (/root/bitcore-cash-node/node_modules/insight-api/lib/transactions.js:77:42)
[2018-06-08T08:50:00.325Z] info: Beginning shutdown
[2018-06-08T08:50:00.329Z] info: Stopping insight-ui
[2018-06-08T08:50:00.330Z] info: Stopping insight-api
[2018-06-08T08:50:00.330Z] info: Stopping web
[2018-06-08T08:50:00.331Z] info: Stopping bitcoind
[2018-06-08T08:50:01.702Z] error: RPCError: Bitcoin JSON-RPC: Request Error: connect ECONNREFUSED 127.0.0.1:8332
    at Bitcoin._wrapRPCError (/root/bitcore-cash-node/node_modules/bitcore-node/lib/services/bitcoind.js:449:13)
    at /root/bitcore-cash-node/node_modules/bitcore-node/lib/services/bitcoind.js:1684:30
    at ClientRequest.<anonymous> (/root/bitcore-cash-node/node_modules/bitcoind-rpc/lib/index.js:116:7)
    at emitOne (events.js:116:13)
    at ClientRequest.emit (events.js:211:7)
    at Socket.socketErrorListener (_http_client.js:387:9)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at emitErrorNT (internal/streams/destroy.js:64:8)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
[2018-06-08T08:50:01.703Z] info: ::ffff:172.31.3.190 "GET /insight-api/block/00000000000000001785f8c5f4aab2a0dd286acc0a46e936af977e62862b4298" 503 68 26.284 "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36" 
[2018-06-08T08:50:01.704Z] info: ::ffff:172.31.3.190 "GET /insight-api/peer" 304 - 0.244 "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36" 
[2018-06-08T08:50:01.704Z] info: ::ffff:172.31.3.190 web socket subscribe: sync
[2018-06-08T08:50:01.716Z] info: ::ffff:172.31.3.190 web socket subscribe: inv
[2018-06-08T08:50:01.746Z] error: RPCError: Bitcoin JSON-RPC: Request Error: connect ECONNREFUSED 127.0.0.1:8332
    at Bitcoin._wrapRPCError (/root/bitcore-cash-node/node_modules/bitcore-node/lib/services/bitcoind.js:449:13)
    at /root/bitcore-cash-node/node_modules/bitcore-node/lib/services/bitcoind.js:1711:28
    at ClientRequest.<anonymous> (/root/bitcore-cash-node/node_modules/bitcoind-rpc/lib/index.js:116:7)
    at emitOne (events.js:116:13)
    at ClientRequest.emit (events.js:211:7)
    at Socket.socketErrorListener (_http_client.js:387:9)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at emitErrorNT (internal/streams/destroy.js:64:8)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
[2018-06-08T08:50:01.747Z] info: ::ffff:172.31.3.190 "GET /insight-api/blocks?limit=5" 503 68 0.948 "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36" 
[2018-06-08T08:50:01.766Z] info: ::ffff:172.31.3.190 "GET /insight-api/peer" 304 - 0.186 "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36" 
[2018-06-08T08:50:01.783Z] info: ::ffff:172.31.3.190 web socket subscribe: sync
[2018-06-08T08:50:08.839Z] warn: ZMQ disconnect: tcp://127.0.0.1:28332
[2018-06-08T08:50:08.840Z] warn: ZMQ connection delay: tcp://127.0.0.1:28332
[2018-06-08T08:50:08.840Z] warn: ZMQ connection delay: tcp://127.0.0.1:28332
@lianhongHou
Copy link

You should replace bitcore-lib with bitcore-lib-cash.

Even you have connected the ABC node, it will take much time to sync, almost never be finished! BTW, it cannot provide services if not sync fully.

Even it sync fully, it cannot cooperate with BWS, you should change source code.

After that, it works, but it react very, very slow.

@osagga
Copy link

osagga commented Jun 22, 2018

Yeah the Sync takes a lot of time! Check this fork (you can inspect the code edits, it's not much) that I made to work with bitcoin-abc. I haven't test it with a fully synced livenet (since it's taking forever), but it works with regtest.

@lianhongHou Which source code do you mean? The BWS or the node code?

@m24927605
Copy link

I have two solution you can check my github.
One is bitcore-node v5.x,it work but cannot support cashaddress you need to change it to legacy address.You need to find the bitcoin.conf and add "usecashaddr=0" in it.
https://github.com/m24927605/BCH_Bitcore_v5.x_InsightAPI

The other is the version v8.0.0 of bitcore-node,it work well and easy to start.It also support cashaddress.
https://github.com/m24927605/bitcore-node-v8-node

@osagga
Copy link

osagga commented Jun 28, 2018

@m24927605 Your second approach (v8.0.0) works, but it provides very limited API endpoints, it doesn't use the same end points that the insight-API is using. Also it's not that easy to switch between different networks (Regtest, Livenet and Testnet) given that you would need to manually change the peer port value. I recommend trying out this fork of bitcore-node that works fine with bitcoin-ABC and doesn't require any hacky steps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants