Insta-mining problems, how to prevent being outgunned? And difficulty + adjustments

Insta-mining problems, how to prevent being outgunned? And difficulty + adjustments

I created a new coin to learn something about Bitcoin. I cloned the source code, called it something different, put a new logo on it, nothing major. Then I made some nodes available, and put the source on github.

The number of connections (aside from me) to the nodes reflected the number of git clones. I'm sure I had an instamine problem, where the hashrate went up and the difficulty went up so that I wasn't able to catch up quick enough and outgun the miners. Even when I did point significant hashpower at my new pool, I just made the difficulty go way up. I mined blocks, but they were orphaned. So was I mining on a different chain? i.e. the "wrong" one that broke off from the original that I wanted to catch up with?

There have been some ideas on preventing an instamine. One is to mine a large number of blocks, and before putting out the source code and making it available for anyone, just hobbyists I would hope, and this is to mine at least 1000 blocks over a while, then put in the chainwork and checkpoint for block 1000. Would that help, or does the difficulty need to be much higher as well?

In other words, do I need to keep mining a good number of blocks and increase the hashpower so the difficulty becomes infeasible (I would hope) for a very fast instamine?

How does this relate to difficulty adjustments? I was thinking of a rather dumb change to the code that could somehow detect a sudden increase in hashrate over the previous block mined, and adjust the difficulty way up somehow but also to keep the timespan between blocks at 2 minutes, if that's possible.

Would it be possible in the code to reject a block if there has been a sudden increase in hashrate >= 30% over the previous 1 or 2 minutes? I would hope to prevent a majority attack this way, but I'm unsure at this point.

My new coin I decided to try and learn something from is a clone of Litecoin, using scrypt. I've adjusted it for 2 minute blocks, 120 second adjustment intervals, and 63,000,000 coins, with initial block reward of 150 coins. The block halving subsidy remains the same as for Litecoin, every X blocks.

I've heard of algorithms like MIDAS described on bitcointalk, and others I wouldn't understand at this point. What I would like to achieve is to prevent instamining and try to make any adjustments necessary (would they be if I mined and enforced the chainwork and checkpoints later?) so that the coin produces a block roughly every 2 minutes, and I would hope the current difficulty adjustments are good enough to keep it in check so the difficulty can go up and down depending on how much hashpower is being put in, minus the sudden spikes I want to try and prevent.

Thank you if you have any suggestions or tips, or reading material.

https://ift.tt/2SBZhVa

Comments

Popular posts from this blog

sendrawtransaction and txn-mempool-conflict

How to generate public and private key pairs from the 12 seed words in python