In fact I reduced difficulty of whole network and created my private chain. I'm currently mining on that which is good enough to implement 51% attack quickly, and also uses all main net functions.
That's great bud. I have even used testnet and regtest quite some times, but never thought of implementing any kind of attack on it.
yes, I know but simulating these attacks require creating two blocks at the same time which the fake chain is longer that the true chain. Since for test I mine with bitcoin built-in miner I have no idea how to create two blocks at the same time. There is always a delay(at least in timestamp).
Let me try to explain it as simple as I can from what I have read about double spending and how to carry out one. Double spending can be done by many ways. The common one being what you are trying to achieve by creating 2 blocks in 2 different nodes in exactly the same timestamp. The other one being marking the validated block as invalid. I believe this method is a way of double spending a coin but not sure actually.
First send some coins to a wallet. Allow the blocks to be confirmed. Once the tx has got enough confirmations, type
invalidateblock [hash] in the console. Here
[hash] is the hash of the block where the tx is present. invalidateblock command instructs other nodes that the particular block has not followed consensus rules and would become invalid. Thus the chainstate gets back to how it was back before the block i.e your transaction is still not yet confirmed. This is where it gets tricky, you should have enough hashpower i.e more than 51% to overcome the main chain and create yourself a newer chain. Once the newer chain becomes longer, the network would shift to the longest chain as a valid one. By this way, your coins would return back to your wallet by which you have successfully double spent your coins. You have paid and got back the money by stating the block as invalid.
EDIT : achow was faster. I am in mobile right now