# Gavin Andresen # 2010-07-27 14:08:17 # https://bitcointalk.org/index.php?topic=589.msg6034#msg6034 I've been working on adding -port= / -rpcport= command line / config file options to bitcoin. The idea is to let you run multiple copies of bitcoind on one machine; I need this because I'm planning on having at least two Bitcoin-related web services (the Bitcoin Faucet and a service to be named later), I want them to have completely separate wallets, but I don't want to rent multiple servers to host them. @p{par} Usage looks like this: @p{brk} Code: $ ./bitcoind getbalance # The TEST network Faucet bitcoind @p{brk} 40616.66159265000 @p{brk} $ ./bitcoind -datadir=/home/bitcoin/.bitcoinTEST2 getbalance @p{brk} 1000.000000000000 @p{brk} $ cat /home/bitcoin/.bitcoinTEST2/bitcoin.conf @p{brk} rpcpassword=..... @p{brk} port=18666 @p{brk} rpcport=18665 @p{brk} @p{brk} Satoshi pointed out that allowing bitcoin/bitcoind to run on a non-standard port could be dangerous, because if misconfigured two bitcoins might both open and write to the same database. To prevent that, the @p{lt}datadir@s{gt}/db.log file is used as a lock so only one bitcoin can access the same datadir at a time (uses boost::interprocess::file_lock, which is purported to be cross-platform and well-behaved, even if bitcoin crashes). @p{par} Issues that came up as I was doing this: @p{par} I left a call to wxSingleInstanceChecker in the Windows GUI code, so no multiple-gui-bitcoins-listening-on-different-ports on Windows. I don't do Windows... @p{par} I didn't bother making the error handling graceful if you point two bitcoins at the same datadir (you get a runtime exception "Cannot lock db.log, is bitcoin already running?"). @p{par} Patches are at @s{(link)}; I've only tested on Linux so far, anybody willing to try this on Windows? @p{par}