<p>I have created a altcoin using the reference of LTC and already 170k blocks were formed. Now i want to change the conformation time  as well as i want the difficulty to start from base difficulty.Basically i want to Hard fork the coin, &amp; for that i recompiled the the code with new parameters and started the daemon.</p>

<p>And now i dont think the approach i took is leading me to proper direction as:</p>

<p><strong>1)I am not at all able to bring the difficulty down to base difficulty.</strong> 
(according my new code,difficulty shoud get adjusted after each block) &amp;</p>

<p><strong>2) some of the new node could not even get the copy of ledger even after they are connected to pre existing healthy nodes.</strong></p>

<p>debug.log says:</p>

<pre><code>2018-06-12 09:14:49   nActualTimespan = 0  before bounds  
2018-06-12 09:14:49 GetNextWorkRequired RETARGET  
2018-06-12 09:14:49 nTargetTimespan = 15    nActualTimespan = 3 
2018-06-12 09:14:49 Before: 1e0ffff0  00000ffff0000000000000000000000000000000000000000000000000000000  
2018-06-12 09:14:49 After:  1e033330  0000033330000000000000000000000000000000000000000000000000000000  
2018-06-12 09:14:49 ERROR: AcceptBlock() : incorrect proof of work  
2018-06-12 09:14:49 ERROR: ProcessBlock() : AcceptBlock FAILED    
</code></pre>

<p>Can someone tell me is there other way by which i can Hardfork a altcoin. Or can someone suggest me what my next step could be</p>

CC BY-SA 4.0
2018-06-12T13:46:57.283Z
If you recalculate the difficulty after each block, have you been able to solve a block at the previous difficulty?  I would be surprised because the hash rate on LTC is so high.
JBaczuk
CC BY-SA 4.0
2018-06-12T14:06:26.160Z
Actually it was not forked from LTC, the source code i used was that of LTC but blockchain was started from genesis block so starting difficulty was  0.00024414
Parishilan Rayamajhi
CC BY-SA 4.0
2018-06-12T14:14:55.363Z
I'm confused, why do you call it a hard fork?
JBaczuk
CC BY-SA 4.0
2018-06-12T14:24:05.743Z
I am sorry that was my mistake to call this altcoin as fork of LTC. But what i want to implement after block no 170k in my altcoin is  Hardfork
Parishilan Rayamajhi
CC BY-SA 4.0
2018-06-12T14:40:01.867Z
Got, it thanks for the clarification.  It appears the validity checks are still failing, can you check AcceptBlock() for where it is failing.  Could be this, for example: `bool fHasMoreOrSameWork = (chainActive.Tip() ? pindex->nChainWork >= chainActive.Tip()->nChainWork : true);`
JBaczuk
CC BY-SA 4.0
2018-06-12T18:48:16.793Z
Did you include any hard fork conditions (e.g. follow these new rules after block 170,000)? It seems to me that you have introduced new rules and are trying to validate old blocks under these new rules. However what you should be doing is instead validating old blocks under the old rules, and then after some condition is met (e.g. block height is >= 170,000) you start using the new rules to validate blocks.
Ava Chow
<bitcoin-core><bitcoind><altcoin><litecoin><blockchain-fork>
How to hard fork a altcoin?
Parishilan Rayamajhi
# How to hard fork a altcoin?

(Asked by: username_0 on 2018-06-12)

I have created a altcoin using the reference of LTC and already 170k blocks were formed. Now i want to change the conformation time as well as i want the difficulty to start from base difficulty.Basically i want to Hard fork the coin, & for that i recompiled the the code with new parameters and started the daemon.

And now i dont think the approach i took is leading me to proper direction as:

**1)I am not at all able to bring the difficulty down to base difficulty.**
(according my new code,difficulty shoud get adjusted after each block) &

**2) some of the new node could not even get the copy of ledger even after they are connected to pre existing healthy nodes.**

debug.log says:

```
2018-06-12 09:14:49   nActualTimespan = 0  before bounds  
2018-06-12 09:14:49 GetNextWorkRequired RETARGET  
2018-06-12 09:14:49 nTargetTimespan = 15    nActualTimespan = 3 
2018-06-12 09:14:49 Before: 1e0ffff0  00000ffff0000000000000000000000000000000000000000000000000000000  
2018-06-12 09:14:49 After:  1e033330  0000033330000000000000000000000000000000000000000000000000000000  
2018-06-12 09:14:49 ERROR: AcceptBlock() : incorrect proof of work  
2018-06-12 09:14:49 ERROR: ProcessBlock() : AcceptBlock FAILED    

```

Can someone tell me is there other way by which i can Hardfork a altcoin. Or can someone suggest me what my next step could be

**Tags:** bitcoin-core, bitcoind, altcoin, litecoin, blockchain-fork

> **Comments:**
> **username_1**: If you recalculate the difficulty after each block, have you been able to solve a block at the previous difficulty?  I would be surprised because the hash rate on LTC is so high.  
> **username_0**: Actually it was not forked from LTC, the source code i used was that of LTC but blockchain was started from genesis block so starting difficulty was  0.00024414  
> **username_1**: I'm confused, why do you call it a hard fork?  
> **username_0**: I am sorry that was my mistake to call this altcoin as fork of LTC. But what i want to implement after block no 170k in my altcoin is  Hardfork  
> **username_1**: Got, it thanks for the clarification.  It appears the validity checks are still failing, can you check AcceptBlock() for where it is failing.  Could be this, for example: `bool fHasMoreOrSameWork = (chainActive.Tip() ? pindex->nChainWork >= chainActive.Tip()->nChainWork : true);`  
> **username_2**: Did you include any hard fork conditions (e.g. follow these new rules after block 170,000)? It seems to me that you have introduced new rules and are trying to validate old blocks under these new rules. However what you should be doing is instead validating old blocks under the old rules, and then after some condition is met (e.g. block height is >= 170,000) you start using the new rules to validate blocks.  

---

## 0 answers

