Pages:
Author

Topic: *** Complete Guide on How to Create a New Alt Coin – Update 2019 *** - page 2. (Read 2155 times)

newbie
Activity: 29
Merit: 6
@isp92074 I had the same error, please check that SegWit height is not 1.
At the beginning try to leave the SegWit height as is.
newbie
Activity: 4
Merit: 0
Thanks your guide helps cloning Bitcoin latest version.

hi sir ,
dear may be you help me .
i do all by your instruction but have some errors

Validation.cpp is not finished yet. We have a problem with SEGWIT. It cannot work at height 1. So in the beginning, we need to disable some

1)IsNullDummyEnabled has the same problem, do the same to that function return true/


===========
Suggested: IsNullDummyEnabled has the same problem, do the same to that function.
Question: Cant find it?!! Is it in validation.cpp on the latest bitcoin version?

=> this I do not understand.

===========



2)If ccminer cannot mine, then you can use my fixed version here: https://github.com/NicolasChoukroun/stratum



In the latest version I do not find a function IsNullDummyEnabled
1) to replace the return
2) I do not find C ++ stratum files for change
3) After compiling the QT wallet, the nodes are well connected and the sync is finished the tick in the lower right corner, but
in console command result  

getblocktemplate
= Bitcoin core is in initial sync and waiting for blocks code -10

but still still problems solo mining in yiimp pool issues the same synchronization error for added coin..

Stratum server issues a message - unknown method getblocktemplate 192.168.0.104
-
started easymainer on 192.168.0.4  issues a message
2 miner theads started using sha25 algo
HTTP request failed
json_rpc_call failed  

Please advise how to how to solve these problems??
 i need solo mininig on cpu for my cloned version & remove the synchronization error in the new Bitcoin core 21.99
copper member
Activity: 1190
Merit: 3
Truly speaking, the information provided by you is too technical for me but I see how step by step it is presented and made it simple. At least the first time I came to know about specific points on the creation of new altcoin. Would like to appreciate your efforts in putting this information altogether.
newbie
Activity: 1
Merit: 0
Take a look at this coin just launched.

https://github.com/kanchiworld/kanchan

It is fairly new, and they are giving away free coins to early adopters. It may be a good idea to get in early.
newbie
Activity: 7
Merit: 0
You're correct.
Setgenerate has been removed a while ago. I'm late to the party.

I will need to figure out a way to mine these before spending big $$.

Thank you for responding so quickly.

You cannot mine like this. You need to use a stratum pool.
Solo mining has been disabled for a long time (unless they added it back? but I am doubtful)

You need to setup a mining pool, and it is quite a complicated process.
A good start is here: https://github.com/tpruvot/yiimp
Take a cheap dedicated server here for example: https://www.hetzner.com/sb
Use an install script like this: https://github.com/xavatar/yiimp_install_scrypt

Do not let anyone install it for you, services will generally have some sort of spyware, and will mine partially for them, so it is not worth.
newbie
Activity: 7
Merit: 0
Interesting..I thought if the blockchain is brand new and difficulty is very low, you should be able to mine it locally before setting up servers and pools etc.
Thanks for the info though.

You cannot mine like this. You need to use a stratum pool.
Solo mining has been disabled for a long time (unless they added it back? but I am doubtful)

You need to setup a mining pool, and it is quite a complicated process.
A good start is here: https://github.com/tpruvot/yiimp
Take a cheap dedicated server here for example: https://www.hetzner.com/sb
Use an install script like this: https://github.com/xavatar/yiimp_install_scrypt

Do not let anyone install it for you, services will generally have some sort of spyware, and will mine partially for them, so it is not worth.
full member
Activity: 615
Merit: 154
CEO of Metaisland.gg and W.O.K Corp
You cannot mine like this. You need to use a stratum pool.
Solo mining has been disabled for a long time (unless they added it back? but I am doubtful)

You need to setup a mining pool, and it is quite a complicated process.
A good start is here: https://github.com/tpruvot/yiimp
Take a cheap dedicated server here for example: https://www.hetzner.com/sb
Use an install script like this: https://github.com/xavatar/yiimp_install_scrypt

Do not let anyone install it for you, services will generally have some sort of spyware, and will mine partially for them, so it is not worth.
newbie
Activity: 7
Merit: 0
Thank you.
I've reset all heights to 0 (previously I had them at 1) and returning true from the "if" condition below.

I was able to start the xxxcoind.exe and it used the default %APPDATA% folder.

When I tried to start the wallet ( xxx-qt.exe or xxx-cli.exe), it complained about unable to lock the data directory.

Is this by design, that you cannot start daemon and wallet on the same node?
I ended up changing the data directory for wallet to somewhere else like "C:\data". I'm guessing this will duplicate the entire chain?

Then stopped the wallet and running this command in a loop to mine few blocks. Not sure how long this will take on a CPU or where I can check if the transactions are being processed (since I cannot open qt-exe while CLI.exe has locked the wallet)

Code:
cli-exe -generate 1



@TheWolf666

Thank you for the great guide. I've followed the instructions to make changes and able to build the code on Windows. But I'm unable to start the wallet or the coin daemon server.
It fails in this code, in tx_check.cpp.

Code:
if (tx.IsCoinBase())
    {
        if (tx.vin[0].scriptSig.size() < 2 || tx.vin[0].scriptSig.size() > 100)
            return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-cb-length");
    }

I see that in Chainparams.cpp, there are new variables being set in the latest core code, for example
Code:
consensus.SegwitHeight = 481824;
I've set this to 1 but still no use.

Any pointers? I would like to create a brand new blockchain from start using bitcoin core code for experimental purposes.

Thanks in advance

I would comment the
Code:
return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-cb-length");
and do consensus.SegwitHeight = 0;

You are starting a new blockchain so you need all the BIPs starting at zero.
If you have a validation error, temporary comment the error, so that the first block (genesis) can be written into the blockchain.
The first block is always a problem, because the authors of Bitcoin Core are not helping the altcoin developers with their validation tests that are specific to Bitcoin.

full member
Activity: 615
Merit: 154
CEO of Metaisland.gg and W.O.K Corp
@TheWolf666

Thank you for the great guide. I've followed the instructions to make changes and able to build the code on Windows. But I'm unable to start the wallet or the coin daemon server.
It fails in this code, in tx_check.cpp.

Code:
if (tx.IsCoinBase())
    {
        if (tx.vin[0].scriptSig.size() < 2 || tx.vin[0].scriptSig.size() > 100)
            return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-cb-length");
    }

I see that in Chainparams.cpp, there are new variables being set in the latest core code, for example
Code:
consensus.SegwitHeight = 481824;
I've set this to 1 but still no use.

Any pointers? I would like to create a brand new blockchain from start using bitcoin core code for experimental purposes.

Thanks in advance

I would comment the
Code:
return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-cb-length");
and do consensus.SegwitHeight = 0;

You are starting a new blockchain so you need all the BIPs starting at zero.
If you have a validation error, temporary comment the error, so that the first block (genesis) can be written into the blockchain.
The first block is always a problem, because the authors of Bitcoin Core are not helping the altcoin developers with their validation tests that are specific to Bitcoin.
newbie
Activity: 7
Merit: 0
@TheWolf666

Thank you for the great guide. I've followed the instructions to make changes and able to build the code on Windows. But I'm unable to start the wallet or the coin daemon server.
It fails in this code, in tx_check.cpp.

Code:
if (tx.IsCoinBase())
    {
        if (tx.vin[0].scriptSig.size() < 2 || tx.vin[0].scriptSig.size() > 100)
            return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-cb-length");
    }

I see that in Chainparams.cpp, there are new variables being set in the latest core code, for example
Code:
consensus.SegwitHeight = 481824;
I've set this to 1 but still no use.

Any pointers? I would like to create a brand new blockchain from start using bitcoin core code for experimental purposes.

Thanks in advance
full member
Activity: 615
Merit: 154
CEO of Metaisland.gg and W.O.K Corp
Suggested:
// change the hash of BIPs to your genesis hash (see the genesis section) Huh is your genesis hash
// do it for main, testnet and regnet.
consensus.BIP16Exception = uint256S("0x???");
consensus.BIP34Hash = uint256S("0x???");

=>  you are doing an altcoin so all the BIP should start at Genesis or very early (see my last answer). So, take the hash from your blockchain and yes it should be the same as the assert.

// fix the checkpoint data with your genesis hash, do it for main,testnet and regnet
checkpointData = {{{0, uint256S("0x???")},}};

=> go in your blockchain and add checkpointData = {{{blocknumber, uint256S("hash")},}}; as checkpoint so that if someone change the the blockchain on purpose, the wallets will reject the change. Do it periodically so that you solidify your blockchain against attackers. Add many checkpoints as your blockchain grows, at block 1000, 10000, 50000, 100000, etc...

===========
Suggested: IsNullDummyEnabled has the same problem, do the same to that function.
Question: Cant find it?!! Is it in validation.cpp on the latest bitcoin version?

=> this I do not understand.

===========
Suggested:  Find this “return state.DoS(100, false, REJECT_INVALID, "bad-cb-height", false, "block height mismatch in coinbase");” and comment it.
Question: Cant find it?!! Is it in validation.cpp on the latest bitcoin version?

What I do find is this...

            return state.Invalid(BlockValidationResult::BLOCK_CONSENSUS, "bad-cb-height", "block height mismatch in coinbase");

=> the genesis block will shoot this error, so you need to comment it in order to have your wallet to mine, or you will not mine.
Also all similar errors due to SEGWITH security tests needs to be commented, at least for the first blocks. SEGWITH needs to check the block before, and there is none for the first blocks... it is impossible to start mining without commenting these.
then you can reinstall all the BIP tests that were blocking the mining, let say at block 1000 for example and change chainparams.cpp accordingly.



===========

member
Activity: 238
Merit: 10
Thanks for this amazing post, im sure it will be useful for those who wants to know how to build their own projects, as for me I don't need it because I'm not qualified to be a blockchain developer or something close, I believe we will only see more scam projects from now on but I'm sure I can avoid getting scam.
full member
Activity: 615
Merit: 154
CEO of Metaisland.gg and W.O.K Corp
Suggested:
// change the hash of BIPs to your genesis hash (see the genesis section) Huh is your genesis hash
// do it for main, testnet and regnet.
consensus.BIP16Exception = uint256S("0x???");
consensus.BIP34Hash = uint256S("0x???");

=>  you are doing an altcoin so all the BIP should start at Genesis or very early (see my last answer). So, take the hash from your blockchain and yes it should be the same as the assert.

// fix the checkpoint data with your genesis hash, do it for main,testnet and regnet
checkpointData = {{{0, uint256S("0x???")},}};

=> go in your blockchain and add checkpointData = {{{blocknumber, uint256S("hash")},}}; as checkpoint so that if someone change the the blockchain on purpose, the wallets will reject the change. Do it periodically so that you solidify your blockchain against attackers.

===========
Suggested: IsNullDummyEnabled has the same problem, do the same to that function.
Question: Cant find it?!! Is it in validation.cpp on the latest bitcoin version?

=> this I do not understand.

===========
Suggested:  Find this “return state.DoS(100, false, REJECT_INVALID, "bad-cb-height", false, "block height mismatch in coinbase");” and comment it.
Question: Cant find it?!! Is it in validation.cpp on the latest bitcoin version?

What I do find is this...

            return state.Invalid(BlockValidationResult::BLOCK_CONSENSUS, "bad-cb-height", "block height mismatch in coinbase");

=> the genesis block will shoot this error, so you need to comment it in order to have your wallet to mine, or you will not mine.
Also all similar errors due to SEGWITH security tests needs to be commented, at least for the first blocks. SEGWITH needs to check the block before, and there is none for the first blocks... it is impossible to start mining without commenting these.
then you can reinstall all the BIP tests that were blocking the mining, let say at block 1000 for example and change chainparams.cpp accordingly.



===========
full member
Activity: 312
Merit: 111
for the hash creation I finally got it using this script;
https://github.com/liveblockchain/genesisgen

Just remember to use Byteswapped as merkelhas! It toke me almst 2 days to find out what I was doig wrong Grin



I got finally the wallet running and adjusted all the other params... But need some info on the instructions mentioned below and would be great if you could give some explanations. I do program in php, python and java but not a C++ guru.. so bear with me Smiley

=========
Suggested:
// change the hash of BIPs to your genesis hash (see the genesis section) Huh is your genesis hash
// do it for main, testnet and regnet.
consensus.BIP16Exception = uint256S("0x???");
consensus.BIP34Hash = uint256S("0x???");

// fix the checkpoint data with your genesis hash, do it for main,testnet and regnet
checkpointData = {{{0, uint256S("0x???")},}};

Question: Do you mean the same hash that also should be used here;
        assert(consensus.hashGenesisBlock == uint256S("000000002737f91027590faddd70434f10ac4d0bc673f4134e2d7671ae7d7a86"));

or is it something else?

===========
Suggested: IsNullDummyEnabled has the same problem, do the same to that function.
Question: Cant find it?!! Is it in validation.cpp on the latest bitcoin version?

===========
Suggested:  Find this “return state.DoS(100, false, REJECT_INVALID, "bad-cb-height", false, "block height mismatch in coinbase");” and comment it.
Question: Cant find it?!! Is it in validation.cpp on the latest bitcoin version?

What I do find is this...

            return state.Invalid(BlockValidationResult::BLOCK_CONSENSUS, "bad-cb-height", "block height mismatch in coinbase");

===========
full member
Activity: 312
Merit: 111
Solved using another genesis creator script
full member
Activity: 615
Merit: 154
CEO of Metaisland.gg and W.O.K Corp
Use this to mine the genesis block

Code:
static void MineGenesis(CBlockHeader &genesisBlock, const uint256 &powLimit, bool noProduction) {
    if (noProduction) genesisBlock.nTime = std::time(nullptr);
    genesisBlock.nNonce = std::time(nullptr);

    printf("NOTE: Genesis nTime = %u \n", genesisBlock.nTime);
    printf("WARN: Genesis nNonce (BLANK!) = %u \n", genesisBlock.nNonce);

    arith_uint256 besthash;
    memset(&besthash, 0xFF, 32);
    arith_uint256 hashTarget = UintToArith256(powLimit);
    printf("Target: %s\n", hashTarget.GetHex().c_str());
    arith_uint256 newhash = UintToArith256(genesisBlock.GetHash());
    while (newhash > hashTarget) {
        genesisBlock.nNonce++;
        if (genesisBlock.nNonce == 0) {
            printf("NONCE WRAPPED, incrementing time\n");
            ++genesisBlock.nTime;
        }
        // If nothing found after trying for a while, print status
        if ((genesisBlock.nNonce & 0xffff) == 0)
            printf("nonce %08X: hash = %s target=%s \r",
                   genesisBlock.nNonce, newhash.ToString().c_str(),
                   hashTarget.ToString().c_str());

        if (newhash < besthash) {
            besthash = newhash;
            printf("New best: %s\n", newhash.GetHex().c_str());
        }
        newhash = UintToArith256(genesisBlock.GetHash());
    }
    printf("\nGenesis nTime = %u \n", genesisBlock.nTime);
    printf("Genesis nNonce = %u \n", genesisBlock.nNonce);
    printf("Genesis nBits: %08x\n", genesisBlock.nBits);
    printf("Genesis Hash = %s\n", newhash.ToString().c_str());
    printf("Genesis Hash Merkle Root = %s\n", genesisBlock.hashMerkleRoot.ToString().c_str());
    printf("Genesis Hash Merkle Root = %s\n", genesisBlock.hashMerkleRoot.ToString().c_str());
}

call like this

Code:
        genesis = CreateGenesisBlock(std::time(nullptr), 546521654, 0x1d00ffff, 1, 50 * COIN);
        MineGenesis(genesis, consensus.powLimit, true);

Then change the asserts with the merkel and hash generated by this algo. It will work on the latest version of Bitcoin core.
full member
Activity: 312
Merit: 111
to give an update, this coode doesnt work on the latest bitcoin version;

hashGenesisBlock = uint256("0x01");
if (true && genesis.GetHash() != hashGenesisBlock)
        {
            printf("recalculating params for mainnet.\n");
            printf("old mainnet genesis nonce: %d\n", genesis.nNonce);
            printf("old mainnet genesis hash:  %s\n", hashGenesisBlock.ToString().c_str());
            // deliberately empty for loop finds nonce value.
            for(genesis.nNonce == 0; genesis.GetHash() > bnProofOfWorkLimit; genesis.nNonce++){ }
            printf("new mainnet genesis merkle root: %s\n", genesis.hashMerkleRoot.ToString().c_str());
            printf("new mainnet genesis nonce: %d\n", genesis.nNonce);
            printf("new mainnet genesis hash: %s\n", genesis.GetHash().ToString().c_str());
        }


It gives erros;
full member
Activity: 312
Merit: 111
or you can just use ark deployer, in a few clicks you would get a working blockchain/altcoin,
https://ark.io/deployer

soon it will just one click,
https://deployer.io/

And whats the point of doing that? I try to build, learn and test, not using some past© click & done chain. If you cant help with the code above, don’t bother spamming.
legendary
Activity: 1764
Merit: 1000
or you can just use ark deployer, in a few clicks you would get a working blockchain/altcoin,
https://ark.io/deployer

soon it will just one click,
https://deployer.io/
full member
Activity: 312
Merit: 111
Hi, I try to create a new alt from btc code to test couple of things, but somehow I am missing something. I think I can get the genessis block created as assert dont give me any error anymore but I still get the error below;
ERROR: ReadBlockFromDisk: Errors in block header at FlatFilePos(nFile=0, nPos=8)

I think that there is something about the nNonce or minimum difficulty that gets in the way.
Pages:
Jump to: