Add -chainstatedir and -blocksdir in bitcoin.conf #14595

issue Janaka-Steph opened this issue on October 28, 2018
  1. Janaka-Steph commented at 5:12 PM on October 28, 2018: none

    Hello!

    I am running a bitcoin core node on my macbook with datadir on an external hard drive. The sync performance wasn't great so I searched to improve it and I found this thread #10647 (comment)

    Peter is suggesting to keep the chainstate on internal disk but only moving blocks on external disk. My question is, is there some plans to let user the possibility to specify that in the config file instead of creating symlink, having chainstatedir and blocksdir parameters in addition to datadir?

    Thank you

  2. hebasto commented at 9:02 PM on November 3, 2018: member

    -blocksdir option has been already supported by the command line and/or bitcoin.conf file. See: #12653

  3. Janaka-Steph commented at 6:13 PM on November 5, 2018: none

    spec: Bitcoin 0.17.0, Mac OSX @hebasto Oh ok I didn't know that, thank you. However I tried to add blocksdir to my config file and it is not taken into account. I first tried to add blocksdir under sections [main] and [test]. This doesn't work. And having a global blocksdir doesn't work either.

    I have an additional issue with regtest. I want to keep the default data directory but when I run bitcoind, it will create an empty blocks folder at the root of the bitcoin directory in addition to a blocks folder in the regtest directory. It seems that bitcoind in regtest will first search for a blocks dir as if it was on mainnet. It forces me to plug my external hard drive even if I work on regtest. Specifying datadir or blocksdir in [regtest] to avoid this unwanted behavior doesn't work.

  4. hebasto commented at 7:49 PM on November 5, 2018: member

    @Janaka-Steph

    However I tried to add blocksdir to my config file and it is not taken into account. I first tried to add blocksdir under sections [main] and [test]. This doesn't work. And having a global blocksdir doesn't work either.

    Can you provide your bitcoin.conf file here?

    I have an additional issue with regtest. I want to keep the default data directory but when I run bitcoind, it will create an empty blocks folder at the root of the bitcoin directory in addition to a blocks folder in the regtest directory.

    The #14409 patch fixes this issue.

  5. Janaka-Steph commented at 9:48 PM on November 5, 2018: none

    Here is my bitcoin conf file. blocksdir is commented. I tried different things but can't have it working.

    # This config should be placed in following path on Mac OSX:
    # $HOME/Library/Application Support/Bitcoin/bitcoin.conf
    
    ###
    #[core]
    
    #regtest=1
    testnet=1
    
    # Maintain a full transaction index, used by the getrawtransaction rpc call.
    txindex=1
    
    # Specify a non-default location to store blockchain and other data.
    # Default location on Mac OSX: $HOME/Library/Application Support/Bitcoin
    # Having chainstate on external HD hurts performance badly, see [#10647 (comment)](/bitcoin-bitcoin/10647/#issuecomment-312466993)
    # datadir=/Volumes/Blockchains/Bitcoin
    
    # Configuration file location
    # conf=/Users/steph/Library/Application Support/Bitcoin/bitcoin.conf
    
    # Set database cache size in megabytes; machines sync faster with a larger cache
    # Recommend setting as high as possible based upon machine's available RAM
    dbcache=10000
    
    # Append comment to the user agent string
    uacomment=fuckTheBanks
    
    
    ###
    #[zeromq]
    # Enable publishing of block hashes to <address>.
    zmqpubhashblock=tcp://127.0.0.1:30001
    
    # Enable publishing of transaction hashes to <address>.
    zmqpubhashtx=tcp://127.0.0.1:30001
    
    
    
    ###
    #[debug]
    # Categories: net, tor, mempool, http, bench, zmq, db, rpc, estimatefee, addrman, selectcoins, reindex, cmpctblock, rand, prune, proxy, mempoolrej, libevent, coindb, qt, leveldb
    debug=1
    # Log IP Addresses in debug output.
    logips=1
    
    
    # [network]
    # Automatically create Tor hidden service
    # listenonion=0
    # Use UPnP to map the listening port
    upnp=1
    
    
    ###
    #[rpc]
    # Accept command line and JSON-RPC commands.
    server=1
    
    # Accept public REST requests.
    rest=1
    
    # Secure the JSON-RPC api. Deprecated method, use rpcauth instead
    #rpcuser=user
    #If no rpcpassword is set, rpc cookie auth is sought
    #rpcpassword=lulz
    
    # Location of the RPC auth cookie
    #rpccookiefile=/Users/steph/Library/Application\ Support/Bitcoin/regtest/.cookie
    
    # Username and hashed password for JSON-RPC connections. <USERNAME>:<SALT>$<HASH>
    # RPC clients connect using rpcuser=<USERNAME>/rpcpassword=<PASSWORD> arguments.
    # You can generate this value with the ./share/rpcauth/rpcauth.py script in the Bitcoin Core repository
    # rpcauth=stephane:c2aab19c89911bdeae44792ad23a8edb$e1057aa437fb1b6466de687f697b6ba8ea6fd3807b9b5bf38e972771ad4c6ce2
    
    # Allow JSON-RPC connections from specified source. Valid for <ip> are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times.
    #rpcallowip=127.0.0.1
    
    
    ###
    # [wallet]
    # Send transactions with full-RBF (bip125-replaceable), activated by default. Use bumpfee "txid" to replace a tx.
    walletrbf=1
    
    #disablewallet=1
    
    
    
    ###
    # Network specific sections
    # https://bitcoin.org/en/release/v0.17.0#configuration-sections-for-testnet-and-regtest
    [main]
    #blocksdir=/Volumes/Blockchains/Bitcoin
    
    # Bitcoin network protocol listen port (default 8333)
    #port=8333
    
    # RPC connection port (default 8332)
    #rpcport=8332
    
    #mempoolsize=300
    
    
    
    [test]
    #blocksdir=/Volumes/Blockchains/Bitcoin
    
    # Bitcoin network protocol listen port (default 18333)
    port=18401
    
    # RPC connection port (default 18332)
    #rpcport=18332
    
    #mempoolsize=100
    
    # Fees (in BTC/kB) smaller than this are considered zero fee for transaction creation (default: 0.00001)
    mintxfee=0.001
    
    # Fee (in BTC/kB) to add to transactions you send (default: 0.00)
    #paytxfee=0.001
    
    # If paytxfee is not set, include enough fee so transactions begin confirmation on average within n blocks (default: 6)
    txconfirmtarget=1
    
    # Specify a non-default location to store wallet data.
    # walletdir=/Users/steph/Library/Application Support/Bitcoin/testnet3/wallet1
    
    
    
    [regtest]
    #blocksdir=/Volumes/Blockchains/Bitcoin
    
    # Bitcoin network protocol listen port (default 18444)
    #port=18444
    
    # RPC connection port (default 18443)
    #rpcport=18443
    
    # Location of the RPC auth cookie
    # rpccookiefile=/Users/steph/Desktop/Bitcoin/Regtest_Server/.cookie
    
    # Set the depth of the work queue to service RPC calls
    rpcworkqueue=32
    
    #mempoolsize=20
    
  6. hebasto commented at 4:27 PM on November 30, 2018: member

    @Janaka-Steph I've tested your config file on MacOS 10.13.6:

    ...
    testnet=1
    ...
    [test]
    #blocksdir=/Volumes/Blockchains/Bitcoin
    blocksdir=/Users/hebasto/Desktop/BLOCKS
    ...
    

    It works as expected for me:

    $ ls /Users/hebasto/Desktop/BLOCKS/testnet3/
    blocks
    
  7. Janaka-Steph commented at 12:15 PM on January 11, 2019: none

    Hello, Sorry for the delay. I have tested again the blocksdir option in conf file test section, on Mac 10.14.2 and Core 0.17.1, and it works. Blocks are written on my external HD.

  8. Janaka-Steph closed this on Jan 11, 2019

  9. laanwj referenced this in commit 64ee94356f on Jan 16, 2019
  10. PastaPastaPasta referenced this in commit c1d86731ef on Jun 26, 2021
  11. PastaPastaPasta referenced this in commit a8c5821419 on Jun 27, 2021
  12. PastaPastaPasta referenced this in commit b12c459007 on Jun 28, 2021
  13. DrahtBot locked this on Dec 16, 2021

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-13 18:15 UTC

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