How to lower difficulty on blockchain?
How to lower difficulty on blockchain?


  The problem now is, sometimes some user create pools and use rented mining rigs to mine on my coin. But after a while they stop and my blockchain stucks at a certain block. 


You could include in your expected difficulty calculation a factor of time, where say, for example, every 10 minutes since expected next block time (supposing you have a ten minute average block time) the expected difficulty is lowered by a factor, say divided by 2.

The problem with this method is that it may allow cheating unless you also carefully control network time. If it is not carefully managed then a cheat could submit a block with a future time and a lower difficulty.