Pages:
Author

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

newbie
Activity: 2
Merit: 0
Hello everyone.

I am moving my older alt-coin from bitcoin core 9.0 to bitcoin core 13.0.

I have everything I can think of done, but I seem to be missing one thing.

If anyone can help, it would be greatly appreciated!

Here is the error that I am getting.

Run the wallet, get the following :
bitcoin-qt: main.cpp:1856: void InvalidChainFound(CBlockIndex*): Assertion `tip' failed.
Aborted (core dumped)

Debug log shows this :

2023-01-04 21:00:11 ERROR: ConnectBlock: Consensus::CheckBlock: high-hash, proof of work failed (code
16)
2023-01-04 21:00:11 InvalidChainFound: invalid block=000005232c6fe11ca78e898bcd61a031b461dee02ef950dae
74423c3fcbd8e69  height=0  log2_work=20.000001  date=2018-05-31 20:33:34

Now, this IS the genesis block that was created on the 9.0 version.


Any help would be greatly appreciated!

newbie
Activity: 2
Merit: 0
Lets do it together. i just starting to new own bitcoin on v22.

Has anyone given this a shot with the latest Bitcoin repo? (22.x) I'm going to dive in shortly and report back.....
newbie
Activity: 1
Merit: 0
Has anyone given this a shot with the latest Bitcoin repo? (22.x) I'm going to dive in shortly and report back.....
newbie
Activity: 22
Merit: 0
hi guys,
I'm having a weird issue, sometimes it would confirm transactions and sometimes it wouldn't, I don't understand the issue here, I saw the guide I followed that but I got other issues however I switched back to my original source code. I'm using Litecoin latest code

check this screenshot and check the timestamp, many blocks were mined and the number is incrementing and those are still in mempool



Image link https://ibb.co/nkBpZzM

newbie
Activity: 29
Merit: 6
@Toki.Fujinami which software are you using in order to mine?
newbie
Activity: 25
Merit: 1
How are you mining? via generatetoaddress or a miner?

hi can you help me? Same issue
newbie
Activity: 25
Merit: 1
Hello
i hope you can help me
i cloned a coin bitcoinpos,all is ok,block genesis generated but i can't mine pow blocks,i tried with generatetoaddress also setting a pool,nothing,what i do?
--------------------------------------------------
class CMainParams : public CChainParams {
public:
    CMainParams() {
        strNetworkID = CBaseChainParams::MAIN;
        consensus.signet_blocks = false;
        consensus.signet_challenge.clear();
        consensus.nSubsidyHalvingInterval = 2200000;
        consensus.BIP16Exception = uint256S("0x00000bcd2d9ccbb28606a8b2d962b97394f612bf6e021ce1d64d71cecb008029");
        consensus.BIP34Height = 1;
        consensus.BIP34Hash = uint256S("0x00000b3b403a2b37780a8dc3813e02463cbaceab135efffe4aaacf0446f862d5");
        consensus.BIP65Height = 1;
        consensus.BIP66Height = 1;
        consensus.CSVHeight = 1;
        consensus.SegwitHeight = 1;
        consensus.MinBIP9WarningHeight = consensus.SegwitHeight + consensus.nMinerConfirmationWindow;
        consensus.BPSRewardMatchStep = 6000;
        consensus.BPSRewardMatchHeight = 3 * consensus.BPSRewardMatchStep;
        consensus.BPSDiffAdjHeight = 13000;
        consensus.BPSColdStakeEnableHeight = 26000;
        consensus.powLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
        consensus.posLimit = uint256S("00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
        consensus.nPowTargetTimespan = 10 * 1 * 60; // every 10 blocks
        consensus.nPowTargetSpacing = 1 * 60;
        consensus.fPowAllowMinDifficultyBlocks = false;
        consensus.fPowNoRetargeting = false;
        consensus.fPoSNoRetargeting = false;
        consensus.nRuleChangeActivationThreshold = 1916; // 95% of 2016
        consensus.nMinerConfirmationWindow = 2016; // nPowTargetTimespan / nPowTargetSpacing
        consensus.nLastPOWBlock = 5000;
        consensus.nMPoSRewardRecipients = 10;
        consensus.nFirstMPoSBlock = consensus.nLastPOWBlock +
                                    consensus.nMPoSRewardRecipients +
                                    COINBASE_MATURITY;
        consensus.nLastMPoSBlock = consensus.BPSColdStakeEnableHeight;
        consensus.nEnableHeaderSignatureHeight = 0;
        consensus.nCheckpointSpan = COINBASE_MATURITY;
        consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28;
        consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 1199145601; // January 1, 2008
        consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = 1230767999; // December 31, 2008

        // Deployment of Taproot (BIPs 340-342)
        consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].bit = 2;
        consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nStartTime = 1199145601; // January 1, 2008
        consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nTimeout = 1230767999; // December 31, 2008

        consensus.nMinimumChainWork = uint256S("0x0000000000000000000000000000000000000000000000000000000000000001"); //block 1
        consensus.defaultAssumeValid = uint256S("0x00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); //block 1
newbie
Activity: 10
Merit: 0
Hi

Was wondering if anyone has come across this error before when running the getblocktemplate method

error -10: bitcoin is downloading blocks...

I cant seem to get past this error. Has anyone ever experienced anything similar? Any suggestions welcomed.

Thanks

newbie
Activity: 7
Merit: 0
Hey,

I wanna help you guys by solving a problem,
If your confirmations are going to fast (sometimes x100 faster than blocks mined) than you have to lower the coin maturity, i still didn't find out why this is happening and i will soon test other coin maturity amounts, but i know 100 is not working proberly and 10 does.

after months of searching and trying things out i managed to get a good working coin on version 0.18.1 (windows included).
(thx TheWolf666 for helping me with the segwit and IsNullDummyEnabled problem that fixed the transactions that stay forever in memory pool Smiley
(For the people that come here for the same problem under here you can see a copy of a piece out of the tutorial to fix this problem

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 checks, that will have to be re-enabled when the blockchain has at least 2000 blocks mined. You have to experiment here; the goal of this tutorial is not to deal with the blockchain maintenance.

bool IsWitnessEnabled needs to return true in all cases. So just add return true; at the beginning of the function.

IsNullDummyEnabled has the same problem, do the same to that function.

Find this “return state.DoS(100, false, REJECT_INVALID, "bad-cb-height", false, "block height mismatch in coinbase");” and comment it.

End of the validation.cpp customization.

h)   Other code modifications.
There are more modifications, spread everywhere that needs to be fixed in order to get the coin to work correctly.

validation.h  :
-   you need to change the DEFAULT_MAX_TIP_AGE to something very large (60*60*24*365 for example). This is temporary. This is the interval when the blockchain is not mining. At starting you might have a genesis made long time ago, and not have mined for a while, so that this has to be changed or your Coin will not work.
-   DEFAULT_CHECKPOINTS_ENABLED = true; needs to be changed to false, or your coin will try to verify that you are on the Bitcoin blockchain, which you are not.

\rpc\mining.cpp :
Another SEGWIT test that needs to be removed:

Code:
throw JSONRPCError(RPC_INVALID_PARAMETER, "getblocktemplate must be called with the segwit rule set (call with {\"rules\": [\"segwit\"]})");
Comment this line.

net_processing.cpp :
-   STALE_CHECK_INTERVAL need to be changed to a large value to avoid having a STALE error, this is again temporary, once the blockchain is mined by many people, it can be back to the original values. (3600*24*365 for example)
-   STALE_RELAY_AGE_LIMIT same for this static variable.

\qt\bitcoingui.cpp
Get rid of the loading form set this variable to 0.

Code:
qint64 secs = blockDate.secsTo(currentDate);
becomes qint64 secs=0;

Now you should have a functional Coin. But you need to mine.

Greetings,
Jonas Bellaert
newbie
Activity: 1
Merit: 0
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.

Thanks for the tutorial, that's very helpful. I tried the MineGenesis() function (on windows 10) based on the latest bitcoin core. It's been running for more than 2+ hours but couldn't find the genesis block yet, I wonder if that is normal and roughly how long it'd take to mine the genesis block?
newbie
Activity: 1
Merit: 0
Thank you for your tutorial! I made a altcoin for fun, But i meet a problem which is (can't broadcast immediately no witness yet) im forked bitcoin core 0.16.0. If u can help me solve the problem i love to donate some ETH for your help. Grin Grin
newbie
Activity: 12
Merit: 8
Hi pal,

Followed this tutorial and now have two working instances of my Alt running. I decided to try and mine via RPC (still available on v0.18) with a simple python script I found on github (ntgbtminer). Problem is I'm getting the error

    Consensus::CheckBlock: bad-txns-vout-toolarge

Sorry for the off topic question but I could do with a second opinion.

Cheers
newbie
Activity: 12
Merit: 0
Code:
chainparams.cpp:27:5: error: ‘arith_uint256’ was not declared in this scope
errors for more than just line 27. What I'm doing to put your code into chainparams.cpp, is copy and pasting https://raw.githubusercontent.com/NicolasChoukroun/altcoin-genesis/master/creategenesis.cpp under all of the #include in chainparams.cpp. There is probably something I'm doing wrong here, and I'm way too new to C++ to know what I'm doing wrong. Any help would be greatly appreciated!

You need to add this before the mining function
Code:
#include
newbie
Activity: 4
Merit: 0
@isp92074 don't activate SegWit at the beginning.
how to do it ?,
I changed some files https://github.com/isp92074/b3c, but still only regtest version miners works ok
isp@isp:~/ntgbtminer$ python3 ntgbtminer.py Test 2N3SryuVcYR3y8wgMcw98T2ek3VU8HpoSeg
Mining block template, height 7...
    0.0000 KH/s

Solved a block! Block hash: 1abbc23f5a921cfe88d1a4bbcd1411340c0e25353469a35da47816ab69d27ef0
Submitting: 00000020120e25591b008f7b2c1fce3affb687a261a6ee6d3094efd0e34d8e185c21b15fa5be88a 1a5723be3c71c3213a0128d38668bc9c631a9a3f62c7ebc092001682979228f60ffff7f20000000 000101000000010000000000000000000000000000000000000000000000000000000000000000f fffffff0a01075465737400000000ffffffff0100f2052a010000001976a9146fe4b6ca0ddb5ed5 9215dabb005292207550b5a788ac00000000

Mining block template, height 8...
    160.6757 KH/s

-----------------------------------------

on mainnet some errors
python3 ntgbtminer.py Test bc1qaaak4zwyq2dqleztjmz8hy407mlx08nl7wjneu
Traceback (most recent call last):
  File "ntgbtminer.py", line 482, in
    standalone_miner(sys.argv[1].encode().hex(), sys.argv[2])
  File "ntgbtminer.py", line 460, in standalone_miner
    block_template = rpc_getblocktemplate()
  File "ntgbtminer.py", line 69, in rpc_getblocktemplate
    return rpc("getblocktemplate", [{"rules": ["segwit"]}])
  File "ntgbtminer.py", line 52, in rpc
    with urllib.request.urlopen(request) as f:
  File "/usr/lib/python3.6/urllib/request.py", line 223, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python3.6/urllib/request.py", line 532, in open
    response = meth(req, response)
  File "/usr/lib/python3.6/urllib/request.py", line 642, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python3.6/urllib/request.py", line 570, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.6/urllib/request.py", line 650, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 500: Internal Server Error

in bitcoinqt console


getblocktemplate

Bitcoin Core Clone is in initial sync and waiting for blocks... (code -10)

generatetoaddress 1 bc1qaaak4zwyq2dqleztjmz8hy407mlx08nl7wjneu

CreateNewBlock: TestBlockValidity failed: unexpected-witness, ContextualCheckBlock : unexpected witness data found (code -1)

newbie
Activity: 29
Merit: 6
@isp92074 don't activate SegWit at the beginning.
newbie
Activity: 4
Merit: 0
How are you mining? via generatetoaddress or a miner?
1)generatetoaddress error
CreateNewBlock :TestBlockValidity failed unexpected-witness ContextualCheckBlock unexpected witness data found code -1
newbie
Activity: 7
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.


What is this coin? Is there a purpose to it? Any details of mining etc?
newbie
Activity: 4
Merit: 0
Hello, I am having some problems with the genesis block. I am new to C++, but what I know is that because my assert of the genesis hash is failing, it means that I am putting the wrong genesis hash. Here is my code for generating the genesis hash (I'm using the genesis generator from https://github.com/hashcrack256/node-genesis-block):
Code:
node genesis -p 040839e4f568674e93581cf1db43a7b09a8ba9d440bad64b296c1554cf7c9c9714d1b5d19c3aadc01647ab41266d4fe2745afa72166c3d69a66cd35c4f3a0b5de0 -t 1618258400 -n 404483 -a sha256d -v 5000000000 -z "Ion got it on me." -b 0x1d00ffff
And in my chainparams.cpp:
Code:
static CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
{
    const char* pszTimestamp = "Ion got it on me.";
    const CScript genesisOutputScript = CScript() << ParseHex("040839e4f568674e93581cf1db43a7b09a8ba9d440bad64b296c1554cf7c9c9714d1b5d19c3aadc01647ab41266d4fe2745afa72166c3d69a66cd35c4f3a0b5de0") << OP_CHECKSIG;
    return CreateGenesisBlock(pszTimestamp, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward);
}
As well as:
Code:
        genesis = CreateGenesisBlock(1618258400, 404483, 0x1d00ffff, 1, 50 * COIN);
        consensus.hashGenesisBlock = genesis.GetHash();
        assert(consensus.hashGenesisBlock == uint256S("0x000005a48ef8e68ac2f26d0987784eaace9dc304f9f579a652f83c958d5fadb1"));
        assert(genesis.hashMerkleRoot == uint256S("0x941d67c6b23e01ae4f16284613133be33c46d23d38fe150c34ab92bc7bd04176"));
What exactly am I missing? What missing parameter am I missing that affects the genesis hash, so that the assert fails? The reason I'm not using your provided genesis generator is because it gives me a ton of
Code:
chainparams.cpp:27:5: error: ‘arith_uint256’ was not declared in this scope
errors for more than just line 27. What I'm doing to put your code into chainparams.cpp, is copy and pasting https://raw.githubusercontent.com/NicolasChoukroun/altcoin-genesis/master/creategenesis.cpp under all of the #include in chainparams.cpp. There is probably something I'm doing wrong here, and I'm way too new to C++ to know what I'm doing wrong. Any help would be greatly appreciated!
newbie
Activity: 29
Merit: 6
How are you mining? via generatetoaddress or a miner?
newbie
Activity: 4
Merit: 0
@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.
Height was 0))now I made a consensus.segwit height  as in last bitcoin, but the error persists. testnet works without this error
Pages:
Jump to: