RPC calls fail in offline mode #4620

issue kostaz opened this issue on August 2, 2014
  1. kostaz commented at 2:39 PM on August 2, 2014: contributor

    In Bitcoin 0.7 it was possible to run bitcoind in offline mode to call RPC functions. For example: Link

    [offline]$ bitcoind getnewaddress
    [offline]$ bitcoind decoderawtransaction
    etc.
    

    Now (tested with commit b7bba43a14a641b6b64bbf48357b2987c1b05800) it does not work:

    $ ./src/bitcoin-cli getnewaddress
    error: You must set rpcpassword=<password> in the configuration file:
    /home/kostaz/.bitcoin/bitcoin.conf
    If the file does not exist, create it with owner-readable-only file permissions.
    
    $ ./src/bitcoind getnewaddress
    Error: There is no RPC client functionality in bitcoind anymore. Use the bitcoin-cli utility instead.
    

    It is wrong IMHO, because Bitcoin Core (bitcoind / bitcoin-cli) need to be useful offline.

  2. sipa commented at 5:32 PM on August 2, 2014: member

    This is still possible, but you need a bitcoin.conf file so bitcoin-cli knows what bitcoind to talk to.

    All that changed was that bitcoin-cli now does what bitcoind did when it was given a command on the command line.

  3. kostaz commented at 3:32 AM on August 3, 2014: contributor

    This is true - I can run bitcoind and bitcoin-cli on the same machine to perform local RPC calls (even without bitcoin.conf):

    $ ./src/bitcoind -regtest -datadir=datadir -port=18333 -rpcport=18332 -rpcallowip=127.0.0.1 -rpcuser=bitcoinrpc -rpcpassword=123456
    
    $ ./src/bitcoin-cli -regtest -rpcconnect=127.0.0.1 -rpcport=18332 -rpcuser=bitcoinrpc -rpcpassword=123456 getblockhash 0
    

    But it is really cumbersome. Why not enable RPC functionality in bitcoin-cli without the actual RPC calls?

  4. sipa commented at 9:36 AM on August 3, 2014: member

    Because bitcoin-cli's only functionality is taking the command line and sending it to bitcoind. It doesn't have any bitcoin-related logic in it.

    Nothing changed. Except instead of ./bitcoind [command] you use ./bitcoin-cli [command] now.

  5. sipa commented at 10:45 AM on August 3, 2014: member

    So I have the impression that you think that previously "bitcoind getrawtransaction" worked without communication to another running bitcoind. This is not correct - such functionality never existing, and whenever you typed "bitcoind [command]", it always needed to find a running daemon to talk to. This did not change, only the ability to send commands elsewhere was moved from bitcoind to bitcoin-cli.

    However, very recently a new command was added (bitcoin-tx; not in a release yet), which allows for some simply offline transaction manipulation, without assistance from a bitcoind. It cannot manipulate your wallet though, just individual transactions.

  6. laanwj commented at 11:03 AM on August 3, 2014: member

    This has never been possible and is also not planned. bitcoin-cli is a JSON-RPC client and nothing more. The whole point is to communicate to a bitcoind.

    If you need something else, use other software. As Sipa says the bitcoin-tx tool may be useful here. There is also sx (https://github.com/spesmilo/sx) with similar functionality.

  7. laanwj closed this on Aug 3, 2014

  8. MarcoFalke locked this on Sep 8, 2021
Contributors

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-17 06:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me