1. I created two peers on same machine and I want to add them both to the block chain(The first one is already up). Is it enough to add address of first node to the config file of second node or I need to add both address to the each other's config file ?
Just one is enough, node connection are bi-directional and both nodes sends and receive information.
2. Should all nodes when created, mine blocks till at least their coinbase maturity?With two nodes on same machine I have to at least generate blocks till their coinbase maturity otherwise I can't spend any amount. It didn't make sense to me. Is it true with bitcoin chain itself ? Cause difficulty there is very high!!!
It's true with most/all coins. Orphan chains happens pretty often and it doesn't make sense for the coinbase maturity to be zero or small; the coins that would've otherwise been spent several times could turn out to be invalid. It would result in a relatively easy double spend (accidential or not). Bitcoin's coinbase maturity is 100 blocks but most mining pools absorbs the risks and rewards their miners at 6 confirmations as orphans that are greater than that rarely happens, if any at all.
3. First thing I do when a node starts up is that I generate a new address for it by
getnewaddress
command in console.Before typing this command there should be some automatically generated address assigned to the node or account. How can I get it?
There should be a keypool to your wallet. The getnewaddress doesn't generate addresses on the fly but rather it just reveals an address from the keypool each time you use the commands.
4. After mining enough blocks, I try to send some bitcoins to the other node,
but the coins wont't transfer and stays in memory pool for forever. Since I increased the target and reduced difficulty, this shouldn't happen. I guess my coins get lost or something....
What client are you using? If you're using the original Bitcoin client (or its fork) to mine, you can manually include transactions into the blocks. Check if the mempool of the mining node lists that specific transaction you're trying to include.