I'm new to Bitcoin development and I'm currently having difficulties trying to make RPC calls to a Bitcoin-Core daemon running in a SSH server. I suppose that the problem is with Firewall or closed ports, but I also do not know much about Network settings.

I'm using nbobtc/bitcoind-php package to make the RPC calls with HTTP requests, and it is running in a Docker container. I'm sure this is working and is not the problem.

So here's what happening: when I run bitcoind in a normal user in my SSH server, and using nbobtc package to make the RPC calls, the connection always get refused in port 18332 (that is conffirmed when I try to telnet that port in SSH's ip address):

Failed to connect to 192.168.xx.xxx port 18332: Connection refused

However, when I run bitcoind in super user (root), the RPC calls works just perfectly. But as I did not want to run bitcoind in root user, I'd like to find out what may be blocking me from making RPC calls to a normal user - or if is it even possible.

I've tried to open ports with 'sudo ufw allow 18332' and also with IPTABLES (but actually I'm not sure which one is being used by the SSH - it wasn't me who configured it). I'm not sure if they have worked as with nc and telnet commands connection is still being refused.

Here's what my bitcoin.conf looks like (I want to use testnet in here):


# I've already tried allowing the IP these 3 ways:
# rpcallowip=192.168.xx.xx  # My machine's IP
# rpcallowip=172.19.x.x/xx  # Docker's NBOBTC container IP
# rpcallowip=      # Allowing all IP


PS: I'm using Bitcoin-Core "subversion": "Satoshi:0.17.1"

Here's what appears in debug.log right after I run Bitcoind:

2019-05-06T14:43:10Z Bitcoin Core version v0.17.1 (release build)
2019-05-06T14:43:10Z InitParameterInteraction: parameter interaction: -whitelistforcerelay=1 -> setting -whitelistrelay=1
2019-05-06T14:43:10Z Assuming ancestors of block 0000000000000037a8cd3e06cd5edbfe9dd1dbcc5dacab279376ef7cfc2b4c75 have valid signatures.
2019-05-06T14:43:10Z Setting nMinimumChainWork=00000000000000000000000000000000000000000000007dbe94253893cbd463
2019-05-06T14:43:10Z Using the 'sse4(1way),sse41(4way)' SHA256 implementation
2019-05-06T14:43:10Z Default data directory /root/.bitcoin
2019-05-06T14:43:10Z Using data directory /home/bitcoin-dev/.bitcoin/testnet3
2019-05-06T14:43:10Z Using config file /home/bitcoin-dev/.bitcoin/bitcoin.conf
2019-05-06T14:43:10Z Using at most 125 automatic connections (1024 file descriptors available)
2019-05-06T14:43:10Z Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
2019-05-06T14:43:10Z Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
2019-05-06T14:43:10Z Using 4 threads for script verification
2019-05-06T14:43:10Z scheduler thread start
2019-05-06T14:43:10Z Binding RPC on address port 18332 failed.
2019-05-06T14:43:10Z HTTP: creating work queue of depth 16
2019-05-06T14:43:10Z 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/rpcauth for rpcauth auth generation.
2019-05-06T14:43:10Z HTTP: starting 4 worker threads
2019-05-06T14:43:10Z Using wallet directory /home/bitcoin-dev/.bitcoin/testnet3/wallets
2019-05-06T14:43:10Z init message: Verifying wallet(s)...
2019-05-06T14:43:10Z Using BerkeleyDB version Berkeley DB 4.8.30: (April  9, 2010)
2019-05-06T14:43:10Z Using wallet wallet.dat
2019-05-06T14:43:10Z BerkeleyEnvironment::Open: LogDir=/home/bitcoin-dev/.bitcoin/testnet3/wallets/database ErrorFile=/home/bitcoin-dev/.bitcoin/testnet3/wallets/db.log
2019-05-06T14:43:10Z net: setting try another outbound peer=false
2019-05-06T14:43:10Z Cache configuration:
2019-05-06T14:43:10Z * Using 2.0MiB for block index database
2019-05-06T14:43:10Z * Using 56.0MiB for transaction index database
2019-05-06T14:43:10Z * Using 8.0MiB for chain state database
2019-05-06T14:43:10Z * Using 384.0MiB for in-memory UTXO set (plus up to 286.1MiB of unused mempool space)
2019-05-06T14:43:10Z init message: Loading block index...
2019-05-06T14:43:10Z Opening LevelDB in /home/bitcoin-dev/.bitcoin/testnet3/blocks/index
2019-05-06T14:43:10Z Opened LevelDB successfully
2019-05-06T14:43:10Z Using obfuscation key for /home/bitcoin-dev/.bitcoin/testnet3/blocks/index: 0000000000000000
2019-05-06T14:43:19Z LoadBlockIndexDB: last block file = 161
2019-05-06T14:43:19Z LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=755, size=30875345, heights=1513309...1514061, time=2019-04-29...2019-05-03)
2019-05-06T14:43:19Z Checking all blk files are present...
2019-05-06T14:43:20Z Opening LevelDB in /home/bitcoin-dev/.bitcoin/testnet3/chainstate
2019-05-06T14:43:20Z Opened LevelDB successfully
2019-05-06T14:43:20Z Using obfuscation key for /home/bitcoin-dev/.bitcoin/testnet3/chainstate: 2686d59caeb1917c
2019-05-06T14:43:20Z Loaded best chain: hashBestChain=00000000b3b6a5db140b6058b7abe5cb00d8af61afd2a237ae3468cd36e387fa height=927391 date=2016-09-08T15:04:00Z progress=0.311180
2019-05-06T14:43:20Z init message: Rewinding blocks...
2019-05-06T14:43:29Z init message: Verifying blocks...
2019-05-06T14:43:29Z Verifying last 6 blocks at level 3
2019-05-06T14:43:29Z [0%]...[16%]...[33%]...[50%]...[66%]...[83%]...[99%]...[DONE].
2019-05-06T14:43:29Z No coin database inconsistencies in last 6 blocks (500 transactions)
2019-05-06T14:43:29Z  block index           19450ms
2019-05-06T14:43:29Z Opening LevelDB in /home/bitcoin-dev/.bitcoin/testnet3/indexes/txindex
2019-05-06T14:43:30Z Opened LevelDB successfully
2019-05-06T14:43:30Z Using obfuscation key for /home/bitcoin-dev/.bitcoin/testnet3/indexes/txindex: 0000000000000000
2019-05-06T14:43:30Z init message: Loading wallet...
2019-05-06T14:43:30Z txindex thread start
2019-05-06T14:43:30Z [default wallet] nFileVersion = 170100
2019-05-06T14:43:30Z [default wallet] Keys: 2005 plaintext, 0 encrypted, 2005 w/ metadata, 2005 total. Unknown wallet records: 1
2019-05-06T14:43:30Z Syncing txindex with block chain from height 694205
2019-05-06T14:43:30Z [default wallet] Wallet completed loading in             123ms
2019-05-06T14:43:30Z [default wallet] setKeyPool.size() = 2000
2019-05-06T14:43:30Z [default wallet] mapWallet.size() = 7
2019-05-06T14:43:30Z [default wallet] mapAddressBook.size() = 4
2019-05-06T14:43:30Z mapBlockIndex.size() = 1515581
2019-05-06T14:43:30Z nBestHeight = 927391
2019-05-06T14:43:30Z torcontrol thread start
2019-05-06T14:43:30Z Bound to [::]:18333
2019-05-06T14:43:30Z Bound to
2019-05-06T14:43:30Z init message: Loading P2P addresses...
2019-05-06T14:43:30Z Loaded 10420 addresses from peers.dat  36ms
2019-05-06T14:43:30Z init message: Loading banlist...
2019-05-06T14:43:30Z Loaded 0 banned node ips/subnets from banlist.dat  29ms
2019-05-06T14:43:30Z init message: Starting network threads...
2019-05-06T14:43:30Z net thread start
2019-05-06T14:43:30Z dnsseed thread start
2019-05-06T14:43:30Z addcon thread start
2019-05-06T14:43:30Z msghand thread start
2019-05-06T14:43:30Z init message: Done loading
2019-05-06T14:43:30Z opencon thread start
  • Can you provide the contents of the debug.log file? – Andrew Chow May 6 '19 at 14:31
  • Sorry @AndrewChow I forgot to put that. I'll edit the question with the content that appears after I run bitcoind, because after that all that appears in there are "UpdateTip", "Requesting block", "received block" and "getdata" messages. – Victor Pietro Moreno May 6 '19 at 14:40
  • It looks like bitcoind is unable to bind to port 18332. Given that running as sudo works, it sounds like there is a permissions problem with your system which is preventing non-root users to bind to port 18332. – Andrew Chow May 6 '19 at 16:35
  • Thanks, it indeed makes sense. Is there any way I could possibly verify why or how my 18332 port is being prevented from being binded? – Victor Pietro Moreno May 6 '19 at 17:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.