litecoin-project / litecoin

Litecoin source tree
http://www.litecoin.org
MIT License
4.37k stars 3.03k forks source link

Mining block are not accepted if BIP related values changed to 0 or 1 #538

Closed adneerav closed 6 years ago

adneerav commented 6 years ago

Hello I am creating own alt from litecoin source. So I have changed hashGenesisBlock , hashMerkleRoot , nonce , timestamp etc.Things are working fine if i dont make BIP34Height , BIP65Height , BIP66Height & BIP34Hash value to 1 . While doing mining using cpuminer generated hash/blocks are not accepting and thats why blocks are not getting generated/added.

If I change that BIP( BIP34Height , BIP65Height & BIP66Height and BIP34Hash) values(not default which is litecoin values), that generated hash/block should be accepted from cpu miner or any other third party mining binary. I've tried by setting value to 0 & 1 both but same result things are not working as expected.. Here is log URL generated from mining : https://goo.gl/JyLPHh

If I don't change that BIP values things are working fine.Generated blocks are accepted to add.Please check log which is generated from mining process. https://goo.gl/hf7uj2

Machine specs:

For testing and initial setup i am doing things on LAN.All things are working fine if i don't change BIP values only(changing only genesis , merke minimum chain etc)

I know for this BIP related conceptual should be clear but I've not found any example & proper documentation so I came here to make things clear if anyone can provide more details/document/blogs and help me to solve this things.

Thanks

losh11 commented 6 years ago

Hi, unfortunately this issues section is only for the litecoin-project and specifically for issues related to the reference client, Litecoin Core. Therefore we are unable to help with altcoin development. Perhaps you should try asking a question on the Bitcoin Stackexchange?

Closing for now.

adneerav commented 6 years ago

Hello @losh11 Thanks for responding.

I am leaving comment here.I can understand Repo's member can't reply on this type of issue but in case if anyone else facing this issue and found solution please respond .

I am creating AltCoin from litecoin source.And using GenesisHO generating genesis block details like nonce ,genesis hash , merkle etc.

While generating genesis block I have changed the coin value parameters in genesis coin value. that is -v parameters and generated genesis hash and merkle etc.

static const int COINBASE_MATURITY = 2;

I've done changes regarding genesis , nonce, coins for genesis block. genesis = CreateGenesisBlock(1538404994, 2086003386, 0x1e0ffff0, 1, 50000 * COIN); eg. I want to premine 50,000 coins in genesis block. I don't want give condition in validation.cpp like if block height 1 than reward should be 50,000.

I've generated pub key and used the same pub key while generating genesis hash.So I can use that genesis block coins by importing private key of that pub key.

After all above change in source,I've build daemon ,cli ,tx and qt from same source.

Next From cli I have executed command(coin-cli generate 1) to generate one block so I can get genesis block coin(Yes!! initially it will be in immature state after x(which I've set to 1) amount of block it will be in mature state). And imported that private key in wallet.

Result of above : After execution of coin-cli generate 1 genesis coins are generated.Displayed in wallet and account under account name ""

Started Mining (using cpuminer) which has another account's address. And after few blocks genesis block coins converted to mature state

Problem/Issue

Now when i tried to transfer from that genesis block coins(are in mature and available to spend) its not transferring to any address.Its not displaying in qt wallet but using cli command its displaying balance.

So where do I need to make other changes to make that genesis coin spendable.

Transactions details Image:: https://i.stack.imgur.com/Yk67i.png
Balance details from qt wallet and command : https://i.stack.imgur.com/cacZ6.png

I've tried & follow steps from this answer too After updating as per from above answer in validation.cpp : Updated validation.cpp

Second try : I also tried with another answer given by same user for litecoin source changes.But facing same issue.

validation.cpp after updating as per second try answer Screens of same updates

Well I know this is not something related to altgeneration script(script work is awesome :) ) related issue. But in this script initial coin mining is configured as a block reward(at height 1) so i just want to what are the changes required if i want to mine coin as a premine not insta mine

If anyone can help me or guide me on this ?

Thanks