user29691: I created a testnet for mining using several ports in a single machine. However I see that the source codes [CAddrInfo, CAddr] are based on IP and not IP||port. Is there an easy change to make it do mining across ports [under same IP] or this is simply not possible?

user23123: I've had to do this, so I'll try to describe exactly what you need to do to get mining on testnet to work in a local setup. For our purposes, we'll have 2 instances of bitcoind running, the first set up to be a miner, the second as a peer.
First, create two directories, one for the miner, the other for the peer:
$ mkdir 1
$ mkdir 2

Now create this file in the 1 directory:
$ <your favorite editor> 1/bitcoin.conf

Here are the contents of the file:
testnet=1
irc=0
dnsseed=0
upnp=0
listen=1
checkpoints=0
server=1
rpcuser=test
rpcpassword=test
rpcallowip=127.0.0.1
port=20000
rpcport=20001

Now go and make the same file for the 2 directory
$ <your favorite editor> 2/bitcoin.conf

Contents:
testnet=1
irc=0
dnsseed=0
upnp=0
listen=0
checkpoints=0
connect=127.0.0.1:20000
rpcuser=test
rpcpassword=test
port=20010
rpcport=20011

Run the first instance:
$ bitcoind -datadir=1 -daemon

Run the second instance:
$ bitcoind -datadir=2 -daemon

You can check to see if everything is up and running by using bitcoin-cli:
$ bitcoin-cli -datadir=1 getinfo

Blocks should be 0 until you mine something.
If you have mining hardware, you can now mine by connecting to 127.0.0.1:20001 with the user/pass of test/test. The actual command to connect will differ based on the mining software you use, but for bfgminer, it would be something like:
$ bfgminer -o http://127.0.0.1:20001 -O test:test --generate-to <a testnet address> --no-longpoll -S all

Note that CPU mining takes several hours to find a block from my experience.

29691: <p>I created a testnet for mining using several ports in a single machine. However I see that the source codes [CAddrInfo, CAddr] are based on IP and not IP||port. Is there an easy change to make it do mining across ports [under same IP] or this is simply not possible?</p>
 23123: <p>I've had to do this, so I'll try to describe exactly what you need to do to get mining on testnet to work in a local setup. For our purposes, we'll have 2 instances of bitcoind running, the first set up to be a miner, the second as a peer.</p>

<p>First, create two directories, one for the miner, the other for the peer:</p>

<pre><code>$ mkdir 1
$ mkdir 2
</code></pre>

<p>Now create this file in the 1 directory:</p>

<pre><code>$ &lt;your favorite editor&gt; 1/bitcoin.conf
</code></pre>

<p>Here are the contents of the file:</p>

<pre><code>testnet=1
irc=0
dnsseed=0
upnp=0
listen=1
checkpoints=0
server=1
rpcuser=test
rpcpassword=test
rpcallowip=127.0.0.1
port=20000
rpcport=20001
</code></pre>

<p>Now go and make the same file for the 2 directory</p>

<pre><code>$ &lt;your favorite editor&gt; 2/bitcoin.conf
</code></pre>

<p>Contents:</p>

<pre><code>testnet=1
irc=0
dnsseed=0
upnp=0
listen=0
checkpoints=0
connect=127.0.0.1:20000
rpcuser=test
rpcpassword=test
port=20010
rpcport=20011
</code></pre>

<p>Run the first instance:</p>

<pre><code>$ bitcoind -datadir=1 -daemon
</code></pre>

<p>Run the second instance:</p>

<pre><code>$ bitcoind -datadir=2 -daemon
</code></pre>

<p>You can check to see if everything is up and running by using bitcoin-cli:</p>

<pre><code>$ bitcoin-cli -datadir=1 getinfo
</code></pre>

<p>Blocks should be 0 until you mine something.</p>

<p>If you have mining hardware, you can now mine by connecting to 127.0.0.1:20001 with the user/pass of test/test. The actual command to connect will differ based on the mining software you use, but for bfgminer, it would be something like:</p>

<pre><code>$ bfgminer -o http://127.0.0.1:20001 -O test:test --generate-to &lt;a testnet address&gt; --no-longpoll -S all
</code></pre>

<p>Note that CPU mining takes several hours to find a block from my experience.</p>
