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?
Asked
Active
Viewed 595 times
2 Answers
1
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 runbitcoin-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.

Nick ODell
- 29,396
- 11
- 72
- 130
0
setgenerate
has been removed. and now you can use generatetoaddress
to mine.
# generatetoaddress
generatetoaddress 1 2NDyXhf4i44Vqpy9FvPHXkw8ccA2WtMkTe3

Vishwas Bhushan
- 21
- 3