user24886: Assuming that there is a magical mineblocks RPC command that can mine X blocks on demand, what is the complete set of command line commands to start a client, mine my coins to a specific address, see the mined blocks, get the reward and send them to an address XXX?

user2306: 
Put your client into regtest mode. This allows you to mine an arbitrary amount of blocks very quickly. Add this to your bitcoin.conf
regtest=1
daemon=1

Generate the blocks. Run 
bitcoin-cli setgenerate true <number of blocks>

where X is the number of block you want. You'll want at least 101 blocks.
See the mined blocks. Run
bitcoin-cli getblockhash <index>

to get the hash of block number <index>. Then take that hash and run
bitcoin-cli getblock <hash>

Repeat Step 3 for each block you want.
Send the Bitcoins to a new address. Run
bitcoin-cli getbalance

to find out your balance. Run
bitcoin-cli sendtoaddress <address> <amount>


If you don't need to see the contents of the block, you can skip steps 3 and 4.

24886: <p>Assuming that there is a magical <code>mineblocks</code> RPC command that can mine X blocks on demand, what is the complete set of command line commands to start a client, mine my coins to a specific address, see the mined blocks, get the reward and send them to an address XXX?</p>
 2306: <ol>
<li><p>Put your client into regtest mode. This allows you to mine an arbitrary amount of blocks very quickly. Add this to your bitcoin.conf</p>

<pre><code>regtest=1
daemon=1
</code></pre></li>
<li><p>Generate the blocks. Run </p>

<pre><code>bitcoin-cli setgenerate true &lt;number of blocks&gt;
</code></pre>

<p>where X is the number of block you want. You'll want at least 101 blocks.</p></li>
<li><p>See the mined blocks. Run</p>

<pre><code>bitcoin-cli getblockhash &lt;index&gt;
</code></pre>

<p>to get the hash of block number <code>&lt;index&gt;</code>. Then take that hash and run</p>

<pre><code>bitcoin-cli getblock &lt;hash&gt;
</code></pre></li>
<li><p>Repeat Step 3 for each block you want.</p></li>
<li><p>Send the Bitcoins to a new address. Run</p>

<pre><code>bitcoin-cli getbalance
</code></pre>

<p>to find out your balance. Run</p>

<pre><code>bitcoin-cli sendtoaddress &lt;address&gt; &lt;amount&gt;
</code></pre></li>
</ol>

<p>If you don't need to see the contents of the block, you can skip steps 3 and 4.</p>
