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

BTC blockchain cannot get blockheight #398

Open
wahdatw opened this issue Feb 25, 2023 · 10 comments
Open

BTC blockchain cannot get blockheight #398

wahdatw opened this issue Feb 25, 2023 · 10 comments

Comments

@wahdatw
Copy link

wahdatw commented Feb 25, 2023

Hi guys,

I am trying to add BTC blockchain to the opendax v2.6.66 it fails to get blockheight. Must the btc node be fully synced?

This is how I set it up on the admin panel. Can you please help?
Screenshot_2

@behnammby
Copy link

Hi,
First check if the blockchain service is up and running.
docker ps | grep blockchain

If it is up and running check the logs
cd opendax && docker compose logs -f blockchian

If you couldn't find out what the problem is, you might send the blockchain logs here.

@wahdatw
Copy link
Author

wahdatw commented Feb 26, 2023

Thanks so much for the reply. The first command shows the docker is running.

root@vultr:/opendax# docker ps | grep blockchain
088a51b4b155 quay.io/openware/peatio:2.6.48 "bash -c 'bin/link_c…" 37 hours ago Up 37 hours 3000/tcp opendax_blockchain_1
root@vultr:/opendax#

But the second command returns in error:

root@vultr:/opendax# docker compose logs -f blockchian
no such service: blockchian

@wahdatw
Copy link
Author

wahdatw commented Feb 26, 2023

@behnammby when I run docker logs opendax_blockchain_1 I get this log. I see a reference to port 8545 but my bitcoin node is running on 8333 (default) and in the opendax admin pannel I did give http://ip:8333 as server. What do you recommend?

p/app/services/blockchain_service.rb:18:in latest_block_number'\n/home/app/app/workers/daemons/blockchain.rb:27:in block (2 levels) in start'\n/home/app/app/workers/daemons/blockchain.rb:22:in loop'\n/home/app/app/workers/daemons/blockchain.rb:22:in block in start'"}
{"level":"WARN","time":"2023-02-25 09:18:28","message":"Error: Failed to open TCP connection to parity:8545 (getaddrinfo: Temporary failure in name resolution). Sleeping for 10 seconds"}
{"level":"ERROR","time":"2023-02-25 09:18:38","message":"#<Peatio::Blockchain::ClientError: Failed to open TCP connection to parity:8545 (getaddrinfo: Temporary failure in name resolution)>"}
{"level":"ERROR","time":"2023-02-25 09:18:38","message":"/home/app/lib/peatio/ethereum/blockchain.rb:72:in rescue in latest_block_number'\n/home/app/lib/peatio/ethereum/blockchain.rb:69:in latest_block_number'\n/home/app/app/services/blockchain_service.rb:18:in latest_block_number'\n/home/app/app/workers/daemons/blockchain.rb:27:in block (2 levels) in start'\n/home/app/app/workers/daemons/blockchain.rb:22:in loop'\n/home/app/app/workers/daemons/blockchain.rb:22:in block in start'"}
{"level":"WARN","time":"2023-02-25 09:18:38","message":"Error: Failed to open TCP connection to parity:8545 (getaddrinfo: Temporary failure in name resolution). Sleeping for 10 seconds"}
{"level":"ERROR","time":"2023-02-25 09:18:48","message":"#<Peatio::Blockchain::ClientError: Failed to open TCP connection to parity:8545 (getaddrinfo: Temporary failure in name resolution)>"}
{"level":"ERROR","time":"2023-02-25 09:18:48","message":"/home/app/lib/peatio/ethereum/blockchain.rb:72:in rescue in latest_block_number'\n/home/app/lib/peatio/ethereum/blockchain.rb:69:in latest_block_number'\n/home/app/app/services/blockchain_service.rb:18:in latest_block_number'\n/home/app/app/workers/daemons/blockchain.rb:27:in block (2 levels) in start'\n/home/app/app/workers/daemons/blockchain.rb:22:in loop'\n/home/app/app/workers/daemons/blockchain.rb:22:in block in start'"}
{"level":"WARN","time":"2023-02-25 09:18:48","message":"Error: Failed to open TCP connection to parity:8545 (getaddrinfo: Temporary failure in name resolution). Sleeping for 10 seconds"}
{"level":"WARN","time":"2023-02-25 09:18:51","message":"The runner for eth-testnet is up to date (2023-02-25 01:06:25 >= 2023-02-25 01:06:25)"}
{"level":"ERROR","time":"2023-02-25 09:18:58","message":"#<Peatio::Blockchain::ClientError: Failed to open TCP connection to parity:8545 (getaddrinfo: Temporary failure in name resolution)>"}
{"level":"ERROR","time":"2023-02-25 09:18:58","message":"/home/app/lib/peatio/ethereum/blockchain.rb:72:in rescue in latest_block_number'\n/home/app/lib/peatio/ethereum/blockchain.rb:69:in latest_block_number'\n/home/app/app/services/blockchain_service.rb:18:in `latest_block_number'\n/home/app/app/work^C

@behnammby
Copy link

Thanks so much for the reply. The first command shows the docker is running.

root@vultr:/opendax# docker ps | grep blockchain 088a51b4b155 quay.io/openware/peatio:2.6.48 "bash -c 'bin/link_c…" 37 hours ago Up 37 hours 3000/tcp opendax_blockchain_1 root@vultr:/opendax#

But the second command returns in error:

root@vultr:/opendax# docker compose logs -f blockchian no such service: blockchian

Sorry it was a typo! blockchain is correct I wrote blockchian!! :-)

@behnammby
Copy link

@behnammby when I run docker logs opendax_blockchain_1 I get this log. I see a reference to port 8545 but my bitcoin node is running on 8333 (default) and in the opendax admin pannel I did give http://ip:8333 as server. What do you recommend?

p/app/services/blockchain_service.rb:18:in latest_block_number'\n/home/app/app/workers/daemons/blockchain.rb:27:in block (2 levels) in start'\n/home/app/app/workers/daemons/blockchain.rb:22:in loop'\n/home/app/app/workers/daemons/blockchain.rb:22:in block in start'"} {"level":"WARN","time":"2023-02-25 09:18:28","message":"Error: Failed to open TCP connection to parity:8545 (getaddrinfo: Temporary failure in name resolution). Sleeping for 10 seconds"} {"level":"ERROR","time":"2023-02-25 09:18:38","message":"#<Peatio::Blockchain::ClientError: Failed to open TCP connection to parity:8545 (getaddrinfo: Temporary failure in name resolution)>"} {"level":"ERROR","time":"2023-02-25 09:18:38","message":"/home/app/lib/peatio/ethereum/blockchain.rb:72:in rescue in latest_block_number'\n/home/app/lib/peatio/ethereum/blockchain.rb:69:in latest_block_number'\n/home/app/app/services/blockchain_service.rb:18:in latest_block_number'\n/home/app/app/workers/daemons/blockchain.rb:27:in block (2 levels) in start'\n/home/app/app/workers/daemons/blockchain.rb:22:in loop'\n/home/app/app/workers/daemons/blockchain.rb:22:in block in start'"} {"level":"WARN","time":"2023-02-25 09:18:38","message":"Error: Failed to open TCP connection to parity:8545 (getaddrinfo: Temporary failure in name resolution). Sleeping for 10 seconds"} {"level":"ERROR","time":"2023-02-25 09:18:48","message":"#<Peatio::Blockchain::ClientError: Failed to open TCP connection to parity:8545 (getaddrinfo: Temporary failure in name resolution)>"} {"level":"ERROR","time":"2023-02-25 09:18:48","message":"/home/app/lib/peatio/ethereum/blockchain.rb:72:in rescue in latest_block_number'\n/home/app/lib/peatio/ethereum/blockchain.rb:69:in latest_block_number'\n/home/app/app/services/blockchain_service.rb:18:in latest_block_number'\n/home/app/app/workers/daemons/blockchain.rb:27:in block (2 levels) in start'\n/home/app/app/workers/daemons/blockchain.rb:22:in loop'\n/home/app/app/workers/daemons/blockchain.rb:22:in block in start'"} {"level":"WARN","time":"2023-02-25 09:18:48","message":"Error: Failed to open TCP connection to parity:8545 (getaddrinfo: Temporary failure in name resolution). Sleeping for 10 seconds"} {"level":"WARN","time":"2023-02-25 09:18:51","message":"The runner for eth-testnet is up to date (2023-02-25 01:06:25 >= 2023-02-25 01:06:25)"} {"level":"ERROR","time":"2023-02-25 09:18:58","message":"#<Peatio::Blockchain::ClientError: Failed to open TCP connection to parity:8545 (getaddrinfo: Temporary failure in name resolution)>"} {"level":"ERROR","time":"2023-02-25 09:18:58","message":"/home/app/lib/peatio/ethereum/blockchain.rb:72:in rescue in latest_block_number'\n/home/app/lib/peatio/ethereum/blockchain.rb:69:in latest_block_number'\n/home/app/app/services/blockchain_service.rb:18:in `latest_block_number'\n/home/app/app/work^C

The blockchain service is for all blockchains i.e bitcoin, ethereum etc. From the log we can see the ethereum blockchain has an error too. You can see what errors are for what blockchains from this part:
home/app/lib/peatio/ethereum/blockchain.rb

To concentrate on one blockchain only, you can temporary turn off all blockchains but the blockchain you wanna trace by going to tower->settings->blockchains and then review the logs by command:
docker compose logs -f --tail=10 blockchain

@wahdatw
Copy link
Author

wahdatw commented Feb 27, 2023

@behnammby thanks for your time. My log shows this. My node is has open RPC and have added it to opendax.
Would appreciate a fix.

Here is the log:
{"level":"WARN","time":"2023-02-27 13:26:23","message":"The runner for btc-minnet is up to date (2023-02-27 00:47:16 >= 2023-02-27 00:47:16)"}
{"level":"ERROR","time":"2023-02-27 13:26:42","message":"#<Peatio::Blockchain::ClientError: execution expired>"}
{"level":"ERROR","time":"2023-02-27 13:26:42","message":"/home/app/lib/peatio/bitcoin/blockchain.rb:35:in rescue in latest_block_number'\n/home/app/lib/peatio/bitcoin/blockchain.rb:32:in latest_block_number'\n/home/app/app/services/blockchain_service.rb:18:in latest_block_number'\n/home/app/app/workers/daemons/blockchain.rb:27:in block (2 levels) in start'\n/home/app/app/workers/daemons/blockchain.rb:22:in loop'\n/home/app/app/workers/daemons/blockchain.rb:22:in block in start'"}
{"level":"WARN","time":"2023-02-27 13:26:42","message":"Error: execution expired. Sleeping for 10 seconds"}
{"level":"WARN","time":"2023-02-27 13:26:53","message":"The runner for btc-minnet is up to date (2023-02-27 00:47:16 >= 2023-02-27 00:47:16)"}
{"level":"WARN","time":"2023-02-27 13:27:23","message":"The runner for btc-minnet is up to date (2023-02-27 00:47:16 >= 2023-02-27 00:47:16)"}
{"level":"ERROR","time":"2023-02-27 13:27:52","message":"#<Peatio::Blockchain::ClientError: execution expired>"}
{"level":"ERROR","time":"2023-02-27 13:27:52","message":"/home/app/lib/peatio/bitcoin/blockchain.rb:35:in rescue in latest_block_number'\n/home/app/lib/peatio/bitcoin/blockchain.rb:32:in latest_block_number'\n/home/app/app/services/blockchain_service.rb:18:in latest_block_number'\n/home/app/app/workers/daemons/blockchain.rb:27:in block (2 levels) in start'\n/home/app/app/workers/daemons/blockchain.rb:22:in loop'\n/home/app/app/workers/daemons/blockchain.rb:22:in block in start'"}

@behnammby
Copy link

behnammby commented Feb 27, 2023

@wahdatw Apparently It seems you are having some trouble with your bitcoin node. A clienterror execution timeout means that your request took too long to complete and was terminated by the server. This could happen for various reasons, such as network issues, heavy load, slow queries, etc.
1- check whether or not the server is under pressure.
2- check if you can communicate with your node outside of the peatio. For example You can simply run a rpc call using curl or similar tools.

@behnammby
Copy link

behnammby commented Feb 28, 2023

@wahdatw I checked your running instance of node using the following command:
curl --data-binary '{"jsonrpc": "1.0", "id": "curltest", "method": "getblockchaininfo", "params": []}' -H 'content-type: text/plain;' http://173.230.131.103:8332/

An I got:
curl: (7) Failed to connect to 173.230.131.103 port 8332 after 112 ms: Connection refused

So certainly your bitcoin node has a problem. Maybe it isn't configured correctly. Have you opened the port 8332?

@wahdatw
Copy link
Author

wahdatw commented Mar 6, 2023

@behnammby Hey boss thanks for taking the time. I am still struggling with bitcoin node. Please check this. I setup my bitcoin.conf like this.

rpcuser=wadi4u
rpcpassword=wadi4u
server=1
rpcallowip=77.68.110.54
rpcallowip=127.0.0.1
rpcbind=0.0.0.0
whitelist=127.0.0.1
whitelist=77.68.110.54
rpcport=8332
datadir=/root/bitcoin-data

And I can curl from the server where I have setup my opendax.
root@ubuntu:/# curl --user wadi4u:wadi4u --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockcount", "params": []}' -H 'content-type: text/plain;' http://45.79.215.10:8332
{"result":182174,"error":null,"id":"curltest"}

So with curl I can get blockheight but my opendax is not able to get blockheight.
Is the problem with my bictoin.conf ?

image

@behnammby
Copy link

@wahdatw could you check the blockchain log now and send me the error?
Feel free to contact me on Telegram if it is more convenient for you.
http://t.me/behnammby

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

No branches or pull requests

2 participants