View in #general on Slack
@eazone.bd: Greetings i had a question "where can i find bitcoin-cli not bitcoin-cli.sh i needed to connect external c lightning " ? Thanks
@aaron: @eazone.bd bitcoin-cli is the client for the bitcoind daemon and is from bitcoincore.org. You can download from https://bitcoincore.org/en/download/
Bitcoin Core: Download - Bitcoin
@eazone.bd: Thanks @aaron
Hi im on ubuntu server and it seems to not be working .maybe i cant use bitcoin-qt as a rpc client . I have installed btcpay (docker) with lnd support. i needed c lightning so installed it separately but c lightning isnt connecting to bitcoin-cli i needed bitcoin-cli for this reason
In btcpaydocker folder bitcoin-cli.sh seems to be working but i couldn’t find out the bitcoin-cli location
@aaron: @eazone.bd when you use the btcpay docker install the bitcoin, nbxplorer, lightning etc. are all running in a virtual container, too see what I mean use
sudo docker container ls.
The executables in the docker containers, such as bitcoin-cli, are not directly accessible from the host.
If you want to install c-lightning directly on your host you will have to also download and install the bitcoin software from the link I posted above.
You should be able to get c-lightning to connect to the bitcoind you have running in your docker container, otherwise it means running to bitcoind daemons, one in docker one on your OS, which will use up a lot of extra resources.
@eazone.bd: Thanks i understand know and what if i point both docker and exteralnal bitcoind blockchain at same location will this be a problem ?
@aaron: What do you mean by “point at same location”? You can’t have two different bitcoind daemons using the same directory.
You shouldn’t need to do that any way. Once you have bitcoin-cli available try and use it with your docker bitcoind.
bitcoin-cli is a client program used to connect to a daemon which can be on the same host or external and in your case in your docker container.
@eazone.bd: Thanks alot @aaron its much more clear for me now.
@eazone.bd: Hi sorry for bothering .can anyone help me to connect bitcoin-cli external to bitcoind docker ? I seem to having a error : coud not locate rpc credientials.no authentication cookie found and no rpc password is set . I cant modify butcoin.conf inside docker bitcoind folder cause after restart it resets. I have seen owner and group of the files are 999:docker
Bitcoin-cli and bitcoind docker are on the same server (ubuntu 16.04 using btcpaydocker)
Note : i have a .cookie file inside btcpay_bitcoind data folder
@aaron: First thing to do is
sudo docker inspect xxxx where you get xxxx from
sudo docker container ls and look for the Container ID of image
In the docker inspect output look for the Env section (Environment variables) and a line like
Then your command to talk to the bitcoind daemon on the docker container will be something like
./bitcoin-cli -rpcconnect=172.18.0.3 -rpcport=43782 getblockchaininfo but you’ll also need to add your cookie file path.
@eazone.bd: Thanks @aaron i have checked everything but when i use last command i get error: couldn’t connect tot ue server: unknown code -1 (make sure server is running and you are connecting to right rpc port) i have set conf= (bitcoin.conf) to /etc/bitcoin and i added rpccookiefile=/root/.bitcoin/blockchain/ (i have use this location for my btcpay bitcoind docker blockchain)
.cookie file seems to have permission 600
Owner/group : 999:docker
Ip address and ports are correct
@aaron: Can you telnet to the bitcoind rpc port? In my case
telnet 172.18.0.3 43782.
@eazone.bd: Im stuck at trying 172.18.0.3…
@aaron: When you did the docker inspect what was the IP address of your bitcoind container? It’s probably different to mine.
Here’s a command to get your bitcoind testnet cookie from your docker container to a local file:
sudo docker exec -it 0e01 cat /home/bitcoin/.bitcoin/testnet3/.cookie > testnetcookie
@aaron: Your container ID, the
0e01, bit will be different so you’ll need to get that from the
sudo docker container ls.
@eazone.bd your container’s IP address is 172.27.0.3. You need to use that where I have used 172.18.0.3.
Once you have the IP address, RPC port and cookie you use:
bitcoin-cli -rpcconnect=172.18.0.3 -rpcport=43782 -rpccookiefile=/home/ubuntu/testnetcookie getblockchaininfo
@eazone.bd: Hahahahaha thanks alot mate @aaron its working now