Bitcoin Forum

Alternate cryptocurrencies => Altcoin Discussion => Topic started by: hushan on April 18, 2018, 04:13:45 PM



Title: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: hushan on April 18, 2018, 04:13:45 PM
This post is based on https://bitcointalk.org/index.php?topic=225690.0 (https://bitcointalk.org/index.php?topic=225690.0) and is an update to it.

Disclaimer:
I was trying to setup my own private bitcoin network and understand how it works. Thanks to fisheater’s famous post(150k read!)(https://bitcointalk.org/index.php?topic=225690.0) I could get a start. However, it was created in 2013 and I found some of the changes no longer applies today. So I made this post as an update.
I used the same title, but this is not a post to guide how to make new coins or ICOs, just help to study how bitcoin and blockchain works only.
This post does not include making changes to the qt GUI program, only command line programs.
This post is based on bitcoin core code base, not litecoin.

Preparation:
Download the bitcoin core full source code, if you cloned the source tree, make a new branch to work on. Setup the compiling environment and make a successful build.

Design the coin’s parameters:
Refer to fisheater’s post.

Code change:
1. Name substitution
You could run a search in the whole tree and replace all occurrences of “bitcoin” or “BTC” to your coin name. But this is not important.

2. Network ports
2.1 Change RPC port:
Code:
CBaseChainParams::nRPCPort in chainparamsbase.cpp

2.2 Change deamon port:
Code:
CChainParams::nDefaultPort in chainparams.cpp

3. Message signature
Choose a different message start signature:
Code:
CChainParams::pchMessageStart in chainparams.cpp

pchMessageStart[0] = 0xf0;
pchMessageStart[1] = 0xb0;
pchMessageStart[2] = 0xb0;
pchMessageStart[3] = 0xd0;
This is important, without this change, if you accidentally connect your node to the bitcoin network, it will decide that bitcoin’s chain is longer and starting to download the real bitcoin blocks hence override your coin’s blocks.

4. Address prefixes:
Choose your preferred address prefix letter. Refer to the table in https://en.bitcoin.it/wiki/List_of_address_prefixes (https://en.bitcoin.it/wiki/List_of_address_prefixes), for example, if you want address start with ‘X’, use 75 or 76.
Code:
CChainParams::base58Prefixes in chainparams.cpp.

base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,75);

You can also choose prefixes of segwit address, private keys, and extended keys.

5. Block reward
This decide how many coins are generated for each mined blocks.
Code:
in validation.cpp:

CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams)
{
    int halvings = nHeight / consensusParams.nSubsidyHalvingInterval;
    // Force block reward to zero when right shift is undefined.
    if (halvings >= 64)
        return 0;

    CAmount nSubsidy =  (1 << 10) * COIN;  // Initial block reward 1024 coins
    // Subsidy is cut in half every 210,000 blocks which will occur approximately every 4 years.
    nSubsidy >>= halvings;
    return nSubsidy;
}

6. Coinbase maturity
This decide how many blocks after could the generated coins be spent.
Code:
in consensus/consensus.h:
static const int COINBASE_MATURITY = 100;

7. Halving interval
How many blocks will block reward be halved.
Code:
CChainParams::nSubsidyHalvingInternal in chainparams.cpp.

8. Max money
Code:
static const CAmount MAX_MONEY = 21000000 * COIN; in amount.h.
Note this isn’t the total supply of the coins, and modify this value won’t limit the total number of coins can be generated. The total coin is controlled by block reward in GetBlockSubsidy, this is just a value to help run sanity checks.

9. Minimum chain work
This is the minimum chain work required to consider the blockchain is updated. Set this to the minimum value otherwise your coin will not mine. When you have mined some blocks, this can be updated to a larger value.
Code:
In chainparams.cpp:
consensus.nMinimumChainWork = uint256S("0000000000000000000000000000000000000000000000000000000100010001");

10. Remove dns seeds
In chainparams.cpp, remove lines start with “vSeeds.emplace_back”

11. Remove checkpoints
In chainparams.cpp, set checkpointData = { };

12. Generate genesis block
Bitcoin’s block have to satisfy certain difficulty, so you cannot just modify genesis parameters and use that arbitrary block hash, you have to mine the genesis block.
12.1 Generate a private key and get its public key, e.g.
Code:
048E794284AD7E4D776919BDA05CDD38447D89B436BDAF5F65EBE9D7AD3A0B084908B88162BB60B1AA5ED6542063A30FC9584A335F656A54CD9F66D6C742B67F55
12.2 Choose a genesis message, like a New York Times headline
NY Times 07/Apr/2018 More Jobs, Faster Growth and Now, the Threat of a Trade War
12.3 Get and compile the genesis block generator from https://github.com/liveblockchain/genesisgen
The program is based on Remember remember the 5th of November’s post  https://bitcointalk.org/index.php?topic=181981.0, with an improvements:
The timestamp string cannot be longer than 91 bytes, since the coinbase transaction’s scriptSig is limited to 100 bytes. Also, when the string is longer than 76 bytes, add OP_PUSHDATA1(0x4c) prefix into the script.
Code:
gcc genesis.c -o genesis -lcrypto
12.4 Feed the data into the program and let it mine the genesis block
Code:
$ ./genesis 048E794284AD7E4D776919BDA05CDD38447D89B436BDAF5F65EBE9D7AD3A0B084908B88162BB60B1AA5ED6542063A30FC9584A335F656A54CD9F66D6C742B67F55 "NY Times 07/Apr/2018 More Jobs, Faster Growth and Now, the Threat of a Trade War" 486604799
nBits: 0x1d00ffff
startNonce: 0
unixtime: 0

Coinbase: 04ffff001d01044c504e592054696d65732030372f4170722f32303138204d6f7265204a6f62732c204661737465722047726f77746820616e64204e6f772c2074686520546872656174206f66206120547261646520576172

PubkeyScript: 41048e794284ad7e4d776919bda05cdd38447d89b436bdaf5f65ebe9d7ad3a0b084908b88162bb60b1aa5ed6542063a30fc9584a335f656a54cd9f66d6c742b67f55ac

Merkle Hash: 63f73f6e72c8355d21b5c198406fde2480acf0263fec63dcbe7f6165d410c2c8
Byteswapped: c8c210d465617fbedc63ec3f26f0ac8024de6f4098c1b5215d35c8726e3ff763
Generating block...
939453 Hashes/s, Nonce 23980758224
Block found!
Hash: 00000000ad913538b8764573d00c3eb4a87723e11d8bd008f9125246c58e0252
Nonce: 2398108787
Unix time: 1524021159
12.5 When it’s done, set the block data in chainparams.cpp
In CMainParams constructor, set the nonce and unittime, block hash and merkle root assertions:
Code:
genesis = CreateGenesisBlock(1524021159, 2398108787, 0x1d00ffff, 1, 50 * COIN);
assert(consensus.hashGenesisBlock == uint256S("0x00000000ad913538b8764573d00c3eb4a87723e11d8bd008f9125246c58e0252"));
assert(genesis.hashMerkleRoot == uint256S("0xc8c210d465617fbedc63ec3f26f0ac8024de6f4098c1b5215d35c8726e3ff763"));
in function static CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward), set the timestap string:
Code:
const char* pszTimestamp = "NY Times 07/Apr/2018 More Jobs, Faster Growth and Now, the Threat of a Trade War";
const CScript genesisOutputScript = CScript() << ParseHex("048e794284ad7e4d776919bda05cdd38447d89b436bdaf5f65ebe9d7ad3a0b084908b88162bb60b1aa5ed6542063a30fc9584a335f656a54cd9f66d6c742b67f55") << OP_CHECKSIG;

13. If you do not want to generate your own genesis block, you can just use the original bitcoin genesis block, but update the DEFAULT_MAX_TIP_AGE value to a larger value.
Code:
In validation.cpp:
int64_t nMaxTipAge = DEFAULT_MAX_TIP_AGE * 4000;
DEFAULT_MAX_TIP_AGE is one day, if the gap between the tip block and current time, the node won’t mine new blocks, so set this at least to the time elapsed since the creation of bitcoin in Jan 2009.

Mining
1. Get cpuminer from https://github.com/pooler/cpuminer (https://github.com/pooler/cpuminer) and build it
2. Start mining
Code:
./minerd --user rpcuser --pass 111111 --url http://127.0.0.1:6332/ --threads 4 --coinbase-addr XQg3PmNxX9oEbxsymqtQHir6dkPpVPTJ6P --coinbase-sig "my test coins" -a sha256d -D
When a block is mined, you will notice bitcoind will log something like this:
Code:
2018-04-18 02:31:52 UpdateTip: new best=00000000fbf2808044cbcf00ddb54988c600f65c0960dcf5143bc0a1ed84da39 height=1 version=0x20000000 log2_work=33.000022 tx=2 date='2018-04-18 02:31:36' progress=0.000000 cache=0.0MiB(1txo)
2018-04-18 02:31:52 CreateNewBlock(): block weight: 764 txs: 0 fees: 0 sigops 400
2018-04-18 02:31:52 AddToWallet 8663f334ca80d55ed41ebaaf313935163d57ba3eead98399a3e0b4a2cf679b81  new

You have now made your own coins. Enjoy!


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: haoqian on April 29, 2018, 06:52:31 AM
Hi, Thank you very much for your post. It helps me a lot.
Now I encountered a problem. When I try CPU Mining, it shows a 500 Internal Server Error. How to solve it?

[2018-04-28 23:39:50] Binding thread 0 to cpu 0
[2018-04-28 23:39:50] Binding thread 1 to cpu 1
[2018-04-28 23:39:50] 2 miner threads started, using 'scrypt' algorithm.
[2018-04-28 23:39:50] HTTP request failed: The requested URL returned error: 500 Internal Server Error
[2018-04-28 23:39:50] json_rpc_call failed, retry after 30 seconds

My Bitcoin.conf is:

server=1
gen=0
rpcuser=rpcuser
rpcpassword=111111
rpcallowip=127.0.0.1
rpcport=8962
listen=1


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: haoqian on April 29, 2018, 07:11:25 AM
I opened the debug mode and it shows that:

2018-04-29T07:10:19Z ThreadRPCServer method=getblocktemplate user=rpcuser

It looks that something wrong with getblocktemplate


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: haoqian on April 29, 2018, 07:52:09 AM
May I know which version of bitcoin core you are using?


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: hushan on April 29, 2018, 08:47:42 AM
May I know which version of bitcoin core you are using?


I was using latest version, or v0.16.0 to be precise.


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: hushan on April 29, 2018, 08:49:28 AM
Hi, Thank you very much for your post. It helps me a lot.
Now I encountered a problem. When I try CPU Mining, it shows a 500 Internal Server Error. How to solve it?

[2018-04-28 23:39:50] Binding thread 0 to cpu 0
[2018-04-28 23:39:50] Binding thread 1 to cpu 1
[2018-04-28 23:39:50] 2 miner threads started, using 'scrypt' algorithm.
[2018-04-28 23:39:50] HTTP request failed: The requested URL returned error: 500 Internal Server Error
[2018-04-28 23:39:50] json_rpc_call failed, retry after 30 seconds

My Bitcoin.conf is:

server=1
gen=0
rpcuser=rpcuser
rpcpassword=111111
rpcallowip=127.0.0.1
rpcport=8962
listen=1

Hi, you need to specify sha256d as mining algorithm, you were using scrypt instead. Try add "-a sha256d" to cpuminer command line.


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: haoqian on April 29, 2018, 10:34:20 AM
Hi, thank you very much for your reply.

I am now using the 0.16 version and I used the following:

./minerd --user rpcuser --pass 111111 --url http://127.0.0.1:8961/ --threads 4 --coinbase-addr XQg3PmNxX9oEbxsymqtQHir6dkPpVPTJ6P --coinbase-sig "my test coins" -a sha256d -D

My bitcoin.conf is:

server=1
gen=0
rpcuser=rpcuser
rpcpassword=111111
rpcallowip=127.0.0.1
rpcport=8961
listen=1

However, I still get the same error:

[2018-04-29 03:21:00] Binding thread 0 to cpu 0
[2018-04-29 03:21:00] 4 miner threads started, using 'sha256d' algorithm.
[2018-04-29 03:21:00] Binding thread 3 to cpu 1
[2018-04-29 03:21:00] Binding thread 2 to cpu 0
[2018-04-29 03:21:00] Binding thread 1 to cpu 1
[2018-04-29 03:21:00] HTTP request failed: The requested URL returned error: 500 Internal Server Error
[2018-04-29 03:21:00] json_rpc_call failed, retry after 30 seconds
[2018-04-29 03:21:30] HTTP request failed: The requested URL returned error: 500 Internal Server Error
[2018-04-29 03:21:30] json_rpc_call failed, retry after 30 seconds
[2018-04-29 03:22:00] HTTP request failed: The requested URL returned error: 500 Internal Server Error
[2018-04-29 03:22:00] json_rpc_call failed, retry after 30 seconds
[2018-04-29 03:22:30] HTTP request failed: The requested URL returned error: 500 Internal Server Error


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: hushan on April 29, 2018, 01:57:04 PM
Hi, thank you very much for your reply.

I am now using the 0.16 version and I used the following:

./minerd --user rpcuser --pass 111111 --url http://127.0.0.1:8961/ --threads 4 --coinbase-addr XQg3PmNxX9oEbxsymqtQHir6dkPpVPTJ6P --coinbase-sig "my test coins" -a sha256d -D

My bitcoin.conf is:

server=1
gen=0
rpcuser=rpcuser
rpcpassword=111111
rpcallowip=127.0.0.1
rpcport=8961
listen=1

However, I still get the same error:

[2018-04-29 03:21:00] Binding thread 0 to cpu 0
[2018-04-29 03:21:00] 4 miner threads started, using 'sha256d' algorithm.
[2018-04-29 03:21:00] Binding thread 3 to cpu 1
[2018-04-29 03:21:00] Binding thread 2 to cpu 0
[2018-04-29 03:21:00] Binding thread 1 to cpu 1
[2018-04-29 03:21:00] HTTP request failed: The requested URL returned error: 500 Internal Server Error
[2018-04-29 03:21:00] json_rpc_call failed, retry after 30 seconds
[2018-04-29 03:21:30] HTTP request failed: The requested URL returned error: 500 Internal Server Error
[2018-04-29 03:21:30] json_rpc_call failed, retry after 30 seconds
[2018-04-29 03:22:00] HTTP request failed: The requested URL returned error: 500 Internal Server Error
[2018-04-29 03:22:00] json_rpc_call failed, retry after 30 seconds
[2018-04-29 03:22:30] HTTP request failed: The requested URL returned error: 500 Internal Server Error

Can you run "bitcoin-cli getblocktemplate" and show its output? Also show the relevant part of debug.log in .bitcoin dir.


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: haoqian on April 29, 2018, 02:46:01 PM
Thank you very much for your reply.

Run ./bitcoin-cli getblocktemplate , I got following:
error code: -9
error message:
Bitcoin is not connected!

In debug log:

2018-04-29 14:41:29 Bitcoin Core version v0.16.0.0-9ea62a3dc-dirty (release build)
2018-04-29 14:41:29 InitParameterInteraction: parameter interaction: -whitelistforcerelay=1 -> setting -whitelistrelay=1
2018-04-29 14:41:29 Assuming ancestors of block 0000000000000000005214481d2d96f898e3d5416e43359c145944a909d242e0 have valid signatures.
2018-04-29 14:41:29 Setting nMinimumChainWork=0000000000000000000000000000000000000000000000000000000100010001
2018-04-29 14:41:29 Using the 'sse4' SHA256 implementation
2018-04-29 14:41:29 Using RdRand as an additional entropy source
2018-04-29 14:41:29 Default data directory /home/zhq/.bitcoin
2018-04-29 14:41:29 Using data directory /home/zhq/.bitcoin
2018-04-29 14:41:29 Using config file /home/zhq/.bitcoin/bitcoin.conf
2018-04-29 14:41:29 Using at most 125 automatic connections (1024 file descriptors available)
2018-04-29 14:41:29 Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
2018-04-29 14:41:29 Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
2018-04-29 14:41:29 Using 2 threads for script verification
2018-04-29 14:41:29 scheduler thread start
2018-04-29 14:41:29 Binding RPC on address 0.0.0.0 port 8962 failed.
2018-04-29 14:41:29 HTTP: creating work queue of depth 16
2018-04-29 14:41:29 Starting RPC
2018-04-29 14:41:29 Starting HTTP RPC server
2018-04-29 14:41:29 Config options rpcuser and rpcpassword will soon be deprecated. Locally-run instances may remove rpcuser to use cookie-based auth, or may be replaced with rpcauth. Please see share/rpcuser for rpcauth auth generation.
2018-04-29 14:41:29 HTTP: starting 4 worker threads
2018-04-29 14:41:29 Using wallet directory /home/zhq/.bitcoin
2018-04-29 14:41:29 init message: Verifying wallet(s)...
2018-04-29 14:41:29 Using BerkeleyDB version Berkeley DB 4.8.30: (April  9, 2010)
2018-04-29 14:41:29 Using wallet wallet.dat
2018-04-29 14:41:29 CDBEnv::Open: LogDir=/home/zhq/.bitcoin/database ErrorFile=/home/zhq/.bitcoin/db.log
2018-04-29 14:41:29 Cache configuration:
2018-04-29 14:41:29 * Using 2.0MiB for block index database
2018-04-29 14:41:29 * Using 8.0MiB for chain state database
2018-04-29 14:41:29 * Using 440.0MiB for in-memory UTXO set (plus up to 286.1MiB of unused mempool space)
2018-04-29 14:41:29 init message: Loading block index...
2018-04-29 14:41:29 Opening LevelDB in /home/zhq/.bitcoin/blocks/index
2018-04-29 14:41:29 Opened LevelDB successfully
2018-04-29 14:41:29 Using obfuscation key for /home/zhq/.bitcoin/blocks/index: 0000000000000000
2018-04-29 14:41:29 LoadBlockIndexDB: last block file = 0
2018-04-29 14:41:29 LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=1, size=305, heights=0...0, time=2018-04-18...2018-04-18)
2018-04-29 14:41:29 Checking all blk files are present...
2018-04-29 14:41:29 LoadBlockIndexDB: transaction index disabled
2018-04-29 14:41:29 Opening LevelDB in /home/zhq/.bitcoin/chainstate
2018-04-29 14:41:29 Opened LevelDB successfully
2018-04-29 14:41:29 Using obfuscation key for /home/zhq/.bitcoin/chainstate: d5db8947d9371fc8
2018-04-29 14:41:29 Loaded best chain: hashBestChain=00000000ad913538b8764573d00c3eb4a87723e11d8bd008f9125246c58e0252 height=0 date=2018-04-18 03:12:39 progress=0.000000
2018-04-29 14:41:29 init message: Rewinding blocks...
2018-04-29 14:41:29 init message: Verifying blocks...
2018-04-29 14:41:29  block index              21ms
2018-04-29 14:41:29 init message: Loading wallet...
2018-04-29 14:41:29 nFileVersion = 160000
2018-04-29 14:41:29 Keys: 2001 plaintext, 0 encrypted, 2001 w/ metadata, 2001 total
2018-04-29 14:41:29  wallet                   25ms
2018-04-29 14:41:29 setKeyPool.size() = 2000
2018-04-29 14:41:29 mapWallet.size() = 0
2018-04-29 14:41:29 mapAddressBook.size() = 0
2018-04-29 14:41:29 mapBlockIndex.size() = 1
2018-04-29 14:41:29 nBestHeight = 0
2018-04-29 14:41:29 Imported mempool transactions from disk: 0 succeeded, 0 failed, 0 expired, 0 already there
2018-04-29 14:41:29 Bound to [::]:8963
2018-04-29 14:41:29 Bound to 0.0.0.0:8963
2018-04-29 14:41:29 init message: Loading P2P addresses...
2018-04-29 14:41:29 torcontrol thread start
2018-04-29 14:41:29 Loaded 1191 addresses from peers.dat  3ms
2018-04-29 14:41:29 init message: Loading banlist...
2018-04-29 14:41:29 init message: Starting network threads...
2018-04-29 14:41:29 net thread start
2018-04-29 14:41:29 init message: Done loading
2018-04-29 14:41:29 opencon thread start
2018-04-29 14:41:29 msghand thread start
2018-04-29 14:41:29 addcon thread start
2018-04-29 14:41:29 dnsseed thread start
2018-04-29 14:41:30 connect() to [2600:3c02::f03c:91ff:fe8e:bcd9]:8333 failed after select(): Connection refused (111)
2018-04-29 14:41:31 connect() to [2001:0:9d38:6abd:180b:29be:3429:fede]:8333 failed after select(): Connection refused (111)
2018-04-29 14:41:31 connect() to [2001:0:9d38:6abd:180b:29be:3429:fede]:8333 failed after select(): Connection refused (111)
2018-04-29 14:41:37 connect() to [2001:0:9d38:953c:3445:1bcb:b8b5:9653]:8333 failed after select(): Connection refused (111)
2018-04-29 14:41:37 ThreadRPCServer method=getblocktemplate
2018-04-29 14:41:39 ThreadRPCServer method=getblocktemplate
2018-04-29 14:41:40 Loading addresses from DNS seeds (could take a while)
2018-04-29 14:41:40 0 addresses found from DNS seeds
2018-04-29 14:41:40 dnsseed thread exit
2018-04-29 14:41:43 connect() to [2001:0:9d38:6ab8:d3:69e:d0a0:1b73]:8333 failed after select(): Connection refused (111)
2018-04-29 14:41:43 connect() to [2001:0:5ef5:79fb:2851:c:524c:a180]:8333 failed after select(): Connection refused (111)
2018-04-29 14:41:44 connect() to [2001:0:9d38:6ab8:878:21cf:2b5b:2860]:8333 failed after select(): Connection refused (111)
2018-04-29 14:41:45 connect() to [2a01:4f8:140:524a::2]:8333 failed after select(): Connection refused (111)
2018-04-29 14:41:46 connect() to [2002:d917:d95::d917:d95]:8333 failed after select(): Connection refused (111)
2018-04-29 14:41:47 connect() to [2a03:b0c0:3:d0::23fb:6001]:8333 failed after select(): Connection refused (111)
2018-04-29 14:41:47 connect() to [2001:41f0:61:0:72f3:95ff:fe09:7521]:8333 failed after select(): Connection refused (111)
2018-04-29 14:41:48 connect() to [2a03:b0c0:3:d0::44b9:4001]:8333 failed after select(): Connection refused (111)
2018-04-29 14:41:48 connect() to [2001:0:9d38:90d7:3c2c:10a4:bbfa:e09d]:8333 failed after select(): Connection refused (111)
2018-04-29 14:41:49 connect() to [2a02:c207:2002:9013::1]:8333 failed after select(): Connection refused (111)
2018-04-29 14:41:49 connect() to [2001:0:9d38:6ab8:183d:3649:b8f5:35d9]:8333 failed after select(): Connection refused (111)
2018-04-29 14:41:50 connect() to [2a00:ee2:1200:1900:20c:29ff:fe81:a0a3]:8333 failed after select(): Connection refused (111)
2018-04-29 14:41:50 connect() to [2601:186:c100:6bcd:16bd:cea1:235d:1c19]:8333 failed after select(): Connection refused (111)
2018-04-29 14:41:52 connect() to [2400:dd01:1034:e00:f21f:afff:fedc:164d]:8333 failed after select(): Connection refused (111)
2018-04-29 14:41:53 connect() to [2a01:680:10:10::1]:8333 failed after select(): Connection refused (111)
2018-04-29 14:41:53 connect() to [2001:0:9d38:6abd:1c96:24dc:a753:d6f2]:8333 failed after select(): Connection refused (111)
2018-04-29 14:42:06 connect() to [2001:0:9d38:6ab8:868:1baa:b174:b764]:8333 failed after select(): Connection refused (111)
2018-04-29 14:42:06 connect() to [2001:0:9d38:6abd:9e:3294:c2b5:67d7]:8333 failed after select(): Connection refused (111)
2018-04-29 14:42:07 connect() to [2001:0:4137:9e76:3424:211:b600:b4cb]:8333 failed after select(): Connection refused (111)
2018-04-29 14:42:07 connect() to [2002:b4b2:3612::b4b2:3612]:8333 failed after select(): Connection refused (111)
2018-04-29 14:42:08 connect() to [2001:0:9d38:6abd:3470:346d:af23:d41b]:8333 failed after select(): Connection refused (111)
2018-04-29 14:42:09 connect() to [2604:a880:400:d0::2004:c001]:8333 failed after select(): Connection refused (111)
2018-04-29 14:42:10 connect() to [2001:980:231b:1:8e89:a5ff:fee3:f8be]:8333 failed after select(): Connection refused (111)
2018-04-29 14:42:10 connect() to [2002:9247:4cec::9247:4cec]:8333 failed after select(): Connection refused (111)
2018-04-29 14:42:11 connect() to [2a02:c205:2008:272::1]:8333 failed after select(): Connection refused (111)
2018-04-29 14:42:12 connect() to [2600:1f18:609f:da02:b283:b16e:aac4:749f]:8333 failed after select(): Connection refused (111)
2018-04-29 14:42:19 connect() to [2001:0:9d38:6abd:2436:3c96:91e9:2de3]:8333 failed after select(): Connection refused (111)
2018-04-29 14:42:19 connect() to [2001:0:9d38:90d7:34f3:3584:d0a4:aa5]:8333 failed after select(): Connection refused (111)
2018-04-29 14:42:37 connect() to [2a01:4f8:10a:3fe4::2]:8333 failed after select(): Connection refused (111)
2018-04-29 14:42:38 connect() to 208.100.137.204:8333 failed after select(): Connection refused (111)
2018-04-29 14:42:39 connect() to [2001:0:9d38:78cf:3cb3:2773:4da3:d4c]:8333 failed after select(): Connection refused (111)
2018-04-29 14:42:40 connect() to 99.198.237.76:8333 failed after select(): Connection refused (111)
2018-04-29 14:42:41 connect() to [2a01:4f8:171:d4a::2]:8333 failed after select(): Connection refused (111)
2018-04-29 14:42:43 connect() to [2001:0:5ef5:79fb:281c:2085:518d:9c97]:8333 failed after select(): Connection refused (111)
2018-04-29 14:42:49 connect() to [2a02:7b40:50d0:e335::1]:8333 failed after select(): Connection refused (111)
2018-04-29 14:42:49 connect() to [2001:0:9d38:6ab8:2436:3c78:431d:d559]:8333 failed after select(): Connection refused (111)
2018-04-29 14:42:50 connect() to [2001:0:9d38:6abd:109f:379e:aeff:3957]:8333 failed after select(): Connection refused (111)
2018-04-29 14:42:50 connect() to [2606:df00:7:4:4caa:2c79:b619:27c9]:8333 failed after select(): Connection refused (111)


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: BogdanGFTP on April 29, 2018, 03:09:19 PM
Very good instruction. Thank you very much!


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: hushan on April 29, 2018, 09:18:35 PM
Thank you very much for your reply.

Run ./bitcoin-cli getblocktemplate , I got following:
error code: -9
error message:
Bitcoin is not connected!

In debug log:

2018-04-29 14:41:29 Bitcoin Core version v0.16.0.0-9ea62a3dc-dirty (release build)



Oh, sorry I forgot to mention, in order to mine, the node has to connect to at least one peer node. So you need to run another instance of bitcoind and let it connect to the first node, like:

Code:
bitcoind -addnode=127.0.0.1:6333 -port=9333 -rpcport=9332 .... other arguments

replace 6333 with your first node's port.

After this, try restart the miner again.

Also from the debug.log you posted, it looks you didn't remove the dns seeds servers, that's ok, you can add "-dns=0 -dnsseed=0" to bitcoind command line arguments to disable them. If you are running your private network, there is no point to connect to public bitcoin nodes.


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: haoqian on April 30, 2018, 02:25:36 AM
Thank you very much for your reply.

I did delete all the DNS seeds followed your instructions. However, it seems that it is still try to connect bitcoin network.

By the way, how can you run two bitcoinds in the same machine? I tried, however, it failed to obtain the lock of .bitcoin


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: haoqian on April 30, 2018, 04:04:00 AM
Thank you very much for your reply.

Run ./bitcoin-cli getblocktemplate , I got following:
error code: -9
error message:
Bitcoin is not connected!

In debug log:

2018-04-29 14:41:29 Bitcoin Core version v0.16.0.0-9ea62a3dc-dirty (release build)



Oh, sorry I forgot to mention, in order to mine, the node has to connect to at least one peer node. So you need to run another instance of bitcoind and let it connect to the first node, like:

Code:
bitcoind -addnode=127.0.0.1:6333 -port=9333 -rpcport=9332 .... other arguments

replace 6333 with your first node's port.

After this, try restart the miner again.

Also from the debug.log you posted, it looks you didn't remove the dns seeds servers, that's ok, you can add "-dns=0 -dnsseed=0" to bitcoind command line arguments to disable them. If you are running your private network, there is no point to connect to public bitcoin nodes.

I use

Code:
sudo ./bitcoind -addnode=10.211.55.5:8963 -debug=rpc -dns=0 -dnsseed=0

And run

Code:
./bitcoin-cli getblocktemplate

I got:
error code: -10
error message:
Bitcoin is downloading blocks...

And debug.log is
2018-04-30 03:32:36 init message: Rewinding blocks...
2018-04-30 03:32:36 init message: Verifying blocks...
2018-04-30 03:32:36  block index              17ms
2018-04-30 03:32:36 init message: Loading wallet...
2018-04-30 03:32:36 nFileVersion = 160000
2018-04-30 03:32:36 Keys: 2001 plaintext, 0 encrypted, 2001 w/ metadata, 2001 total
2018-04-30 03:32:36  wallet                   26ms
2018-04-30 03:32:36 setKeyPool.size() = 2000
2018-04-30 03:32:36 mapWallet.size() = 0
2018-04-30 03:32:36 mapAddressBook.size() = 0
2018-04-30 03:32:36 mapBlockIndex.size() = 1
2018-04-30 03:32:36 nBestHeight = 0
2018-04-30 03:32:36 Imported mempool transactions from disk: 0 succeeded, 0 failed, 0 expired, 0 already there
2018-04-30 03:32:36 torcontrol thread start
2018-04-30 03:32:36 Bound to [::]:8963
2018-04-30 03:32:36 Bound to 0.0.0.0:8963
2018-04-30 03:32:36 init message: Loading P2P addresses...
2018-04-30 03:32:36 Loaded 1168 addresses from peers.dat  2ms
2018-04-30 03:32:36 init message: Loading banlist...
2018-04-30 03:32:36 init message: Starting network threads...
2018-04-30 03:32:36 DNS seeding disabled
2018-04-30 03:32:36 net thread start
2018-04-30 03:32:36 addcon thread start
2018-04-30 03:32:36 init message: Done loading
2018-04-30 03:32:36 opencon thread start
2018-04-30 03:32:36 msghand thread start
2018-04-30 03:32:36 New outbound peer connected: version: 70015, blocks=0, peer=0
2018-04-30 03:32:42 connect() to [2001:0:9d38:90d7:10aa:20c7:aa6f:d318]:8333 failed after select(): Connection refused (111)
2018-04-30 03:32:43 connect() to [2001:0:9d38:6ab8:302b:340f:e723:b15e]:8333 failed after select(): Connection refused (111)
2018-04-30 03:32:43 connect() to [2a01:4f8:192:34d0::2]:8333 failed after select(): Connection refused (111)
2018-04-30 03:32:49 ThreadRPCServer method=getblocktemplate
2018-04-30 03:32:50 connect() to 43.229.76.45:8333 failed after select(): Connection refused (111)
2018-04-30 03:32:56 connect() to [2001:41d0:1:8b26::1]:8333 failed after select(): Connection refused (111)
2018-04-30 03:32:56 connect() to [2002:b4b2:3612::b4b2:3612]:8333 failed after select(): Connection refused (111)
2018-04-30 03:32:58 connect() to [2a02:c205:2008:7160::1]:8333 failed after select(): Connection refused (111)
2018-04-30 03:32:59 connect() to [2001:0:9d38:6ab8:34f7:15b2:3012:3a74]:8333 failed after select(): Connection refused (111)
2018-04-30 03:32:59 connect() to [2604:a880:2:d0::22fa:3001]:8333 failed after select(): Connection refused (111)
2018-04-30 03:33:01 connect() to [2a01:4f8:10a:3718::2]:8333 failed after select(): Connection refused (111)
2018-04-30 03:33:02 connect() to [2601:646:4101:1603:5809:1bff:fe55:6678]:8333 failed after select(): Connection refused (111)
2018-04-30 03:33:08 connect() to 5.45.75.15:8333 failed after select(): Connection refused (111)
2018-04-30 03:33:09 connect() to 79.46.194.163:8333 failed after select(): Connection refused (111)


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: plr on April 30, 2018, 04:09:44 AM
A very good guide I have bookmarked this for future reference, I seldom seen new altcoin created as Bitcoin clone majority are ethereum smart contract or waves platform, if I only have merit to send I'll definitely send you one.


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: hushan on May 03, 2018, 07:40:25 AM
After set dns to false, you will need to delete previously saved peer database, remove peers.dat file from ~/.bitcoin direcotry, assuming you are on linux.

To run multiple instances of bitcoind, besides specifying different port number, you need to use different data directory too, add -datadir=/path/to/another/bitcoinddatadir to your other bitcoind command line.


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: haoqian on May 03, 2018, 09:25:01 AM
Thank you very much for your reply.

One more question is that I do not know why it is keeping "Bitcoin is downloading blocks..."

Because of this, the getblocktemplate will not work.


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: hushan on May 03, 2018, 01:02:46 PM
Thank you very much for your reply.

One more question is that I do not know why it is keeping "Bitcoin is downloading blocks..."

Because of this, the getblocktemplate will not work.

Did you generate your own genesis block? If not, try follow step 13, set max tip age to a very large period of time.


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: haoqian on May 03, 2018, 02:26:22 PM
Thank you for your reply.

I do generate my own genesis block. It seems that it is just keeping downloading.


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: hushan on May 04, 2018, 12:29:09 AM
Thank you for your reply.

I do generate my own genesis block. It seems that it is just keeping downloading.

It would be a lot helpful if you could run a git diff on your workspace and paste the change you have made, so that we can identify the problem.


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: haoqian on May 04, 2018, 01:04:34 PM
Thank you for your reply.

I do generate my own genesis block. It seems that it is just keeping downloading.

It would be a lot helpful if you could run a git diff on your workspace and paste the change you have made, so that we can identify the problem.

Thank you very much for your reply.

Those are the changes I made:
https://github.com/zhq422194011/bitcoin/commit/e0b0d5c9b4be209cf640cf6e8ae29bf1525c58da

My bitcoin.conf is:
Code:
server=1
gen=1
rpcbind=0.0.0.0
rpcuser=rpcuser
rpcpassword=111111
rpcallowip=127.0.0.1
rpcallowip=0.0.0.0/0
listen=1

I run the following two bitcoinds:

Code:
sudo ~/bitcoin/src/bitcoind -addnode=127.0.0.1:9332 -port=8963 -rpcport=8962 -debug=rpc -dns=0 -dnsseed=0

sudo ~/bitcoin/src/bitcoind -datadir=$HOME/.bitcoin2 -addnode=127.0.0.1:8962 -port=9333 -rpcport=9332 -debug=rpc -dns=0 -dnsseed=0

When I run ./bitcoin-cli getblocktemplate, I got:
Code:
error code: -10
error message:
Bitcoin is downloading blocks...


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: haoqian on May 04, 2018, 01:43:16 PM
Thank you for your reply.

I do generate my own genesis block. It seems that it is just keeping downloading.

It would be a lot helpful if you could run a git diff on your workspace and paste the change you have made, so that we can identify the problem.

Changes including this... (with 0x, did not show on the git diff)

consensus.nMinimumChainWork = uint256S("0x0000000000000000000000000000000000000000000000000000000100010001");

The bitcoind is still keep downloading.


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: hushan on May 05, 2018, 02:07:02 PM
Thank you for your reply.

I do generate my own genesis block. It seems that it is just keeping downloading.

It would be a lot helpful if you could run a git diff on your workspace and paste the change you have made, so that we can identify the problem.

Thank you very much for your reply.

Those are the changes I made:
https://github.com/zhq422194011/bitcoin/commit/e0b0d5c9b4be209cf640cf6e8ae29bf1525c58da

My bitcoin.conf is:
Code:
server=1
gen=1
rpcbind=0.0.0.0
rpcuser=rpcuser
rpcpassword=111111
rpcallowip=127.0.0.1
rpcallowip=0.0.0.0/0
listen=1

I run the following two bitcoinds:

Code:
sudo ~/bitcoin/src/bitcoind -addnode=127.0.0.1:9332 -port=8963 -rpcport=8962 -debug=rpc -dns=0 -dnsseed=0

sudo ~/bitcoin/src/bitcoind -datadir=$HOME/.bitcoin2 -addnode=127.0.0.1:8962 -port=9333 -rpcport=9332 -debug=rpc -dns=0 -dnsseed=0

When I run ./bitcoin-cli getblocktemplate, I got:
Code:
error code: -10
error message:
Bitcoin is downloading blocks...



The code change looks right, for the first node, don't use -addnode, becuase the second node hasn't started yet, also add "-connect=0 -listen=1 -maxtipage=$((24*60*60*5000))" to it, for second node, use addnode to add the first node.


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: haoqian on May 06, 2018, 05:48:31 AM
Thank you for your reply.

I do generate my own genesis block. It seems that it is just keeping downloading.

It would be a lot helpful if you could run a git diff on your workspace and paste the change you have made, so that we can identify the problem.

Thank you very much for your reply.

Those are the changes I made:
https://github.com/zhq422194011/bitcoin/commit/e0b0d5c9b4be209cf640cf6e8ae29bf1525c58da

My bitcoin.conf is:
Code:
server=1
gen=1
rpcbind=0.0.0.0
rpcuser=rpcuser
rpcpassword=111111
rpcallowip=127.0.0.1
rpcallowip=0.0.0.0/0
listen=1

I run the following two bitcoinds:

Code:
sudo ~/bitcoin/src/bitcoind -addnode=127.0.0.1:9332 -port=8963 -rpcport=8962 -debug=rpc -dns=0 -dnsseed=0

sudo ~/bitcoin/src/bitcoind -datadir=$HOME/.bitcoin2 -addnode=127.0.0.1:8962 -port=9333 -rpcport=9332 -debug=rpc -dns=0 -dnsseed=0

When I run ./bitcoin-cli getblocktemplate, I got:
Code:
error code: -10
error message:
Bitcoin is downloading blocks...



The code change looks right, for the first node, don't use -addnode, becuase the second node hasn't started yet, also add "-connect=0 -listen=1 -maxtipage=$((24*60*60*5000))" to it, for second node, use addnode to add the first node.

It works!  Thank you very much! Your instruction is very useful!

Fews details I want to ask you. Mining only works for second node. So the connection is one way only?
I found that connects is pretty unstable (sometime connections would be disconnected). why?


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: haoqian on May 06, 2018, 05:57:26 AM
Thank you for your reply.

I do generate my own genesis block. It seems that it is just keeping downloading.

It would be a lot helpful if you could run a git diff on your workspace and paste the change you have made, so that we can identify the problem.

Thank you very much for your reply.

Those are the changes I made:
https://github.com/zhq422194011/bitcoin/commit/e0b0d5c9b4be209cf640cf6e8ae29bf1525c58da

My bitcoin.conf is:
Code:
server=1
gen=1
rpcbind=0.0.0.0
rpcuser=rpcuser
rpcpassword=111111
rpcallowip=127.0.0.1
rpcallowip=0.0.0.0/0
listen=1

I run the following two bitcoinds:

Code:
sudo ~/bitcoin/src/bitcoind -addnode=127.0.0.1:9332 -port=8963 -rpcport=8962 -debug=rpc -dns=0 -dnsseed=0

sudo ~/bitcoin/src/bitcoind -datadir=$HOME/.bitcoin2 -addnode=127.0.0.1:8962 -port=9333 -rpcport=9332 -debug=rpc -dns=0 -dnsseed=0

When I run ./bitcoin-cli getblocktemplate, I got:
Code:
error code: -10
error message:
Bitcoin is downloading blocks...



The code change looks right, for the first node, don't use -addnode, becuase the second node hasn't started yet, also add "-connect=0 -listen=1 -maxtipage=$((24*60*60*5000))" to it, for second node, use addnode to add the first node.

One more question, I found that the first node will not download the blocks from second one (first node is still at block 0). I also run a third node which connects to the second node. The third node will also not download the blocks (still at block 0 and the getblocktemplate works fine). Why?


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: supermoney on May 23, 2018, 12:55:50 PM
Thanks for the guide, it has helped me a lot since I'm running latest Bitcoin Core version.
However I'm having some trouble with the mining part: [Solved+Fix] Issue with mined coins of my altcoin (https://bitcointalk.org/index.php?topic=4176787.0)


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: supermoney on May 24, 2018, 01:58:53 PM
Thanks for the guide, it has helped me a lot since I'm running latest Bitcoin Core version.
However I'm having some trouble with the mining part: [Solved+Fix] Issue with mined coins of my altcoin (https://bitcointalk.org/index.php?topic=4176787.0)

Issue was successfully fixed, you better go check it out because if you are running Bitcoin Core with HD enabled (MANDATORY!) then you have to apply the fix to your Minerd/CPU Miner/-Multi.


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: victorkimba17 on May 25, 2018, 08:52:16 AM
i made changes to the bitcoin-core v0.15.1 code.

Here is my bitcoin.conf
Code:
server=1
port=12000
rpcport=12001
rpcallowip=0.0.0.0/0
rpcuser=username
rpcpassword=password
daemon=1

This is how i run bitcoind
Code:
src/bitcoind -conf=../datadir/bitcoin.conf -datadir=../datadir/ -reindex

When i run bitcoin-cli, i got error code of -28.
Code:
src/bitcoin-cli  -conf=../datadir/bitcoin.conf -datadir=../datadir/ help
error code: -28
error message:
Loading wwwallet...

debug.log
Code:
2018-05-25 09:05:39 Keys: 2002 plaintext, 0 encrypted, 2002 w/ metadata, 2002 total
2018-05-25 09:05:39  wallet                   45ms
2018-05-25 09:05:39 setKeyPool.size() = 2000
2018-05-25 09:05:39 mapWallet.size() = 0
2018-05-25 09:05:39 mapAddressBook.size() = 1
2018-05-25 09:05:39 Reindexing block file blk00000.dat...
2018-05-25 09:05:40 ERROR: AcceptBlock: high-hash, proof of work failed (code 16)
2018-05-25 09:05:40 Reindexing finished
2018-05-25 09:05:40 Failed to open mempool file from disk. Continuing anyway.
2018-05-25 09:06:22 ThreadRPCServer method=help

How could i solve this error ?


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: victorkimba17 on May 25, 2018, 10:15:27 AM
after i made more changes , the customised bitcoind works! The changes can be applied to bitcoin core v0.15.1.

this is how i run bitcoind
Code:
src/bitcoind -debug=rpc -dns=0 -dnsseed=0 -datadir=../datadir/

this is how i run bitcoin-cli
Code:
src/bitcoin-cli -datadir=../datadir/ getinfo

the bitcoin.conf
Code:
server=1
gen=1
port=8963
rpcport=8962
rpcbind=0.0.0.0
rpcallowip=0.0.0.0/0
rpcuser=username
rpcpassword=password
listen=1


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: victorkimba17 on May 25, 2018, 12:12:57 PM
why we need to add -maxtipage=$((24*60*60*5000)) to first node , so that getblocktemplate can work ?

first node:
src/bitcoind -debug=rpc -dns=0 -dnsseed=0 -datadir=../datadir/ -connect=0 -maxtipage=432000000 -daemon

second node:
src/bitcoind -debug=rpc -addnode=127.0.0.1:8963 -dns=0 -dnsseed=0 -datadir=../datadir_1/ -daemon


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: supermoney on May 26, 2018, 12:11:15 PM
why we need to add -maxtipage=$((24*60*60*5000)) to first node , so that getblocktemplate can work ?

first node:
src/bitcoind -debug=rpc -dns=0 -dnsseed=0 -datadir=../datadir/ -connect=0 -maxtipage=432000000 -daemon

second node:
src/bitcoind -debug=rpc -addnode=127.0.0.1:8963 -dns=0 -dnsseed=0 -datadir=../datadir_1/ -daemon

In the case you generated a new genesis block then you don't need for maxtipage, just run your miner and start mining.


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: zhaviabieber405 on May 26, 2018, 01:32:15 PM
Nice guide, just shows how easy it is for even a semi experienced developer. I guess that's a good thing though.


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: hushan on May 27, 2018, 08:10:39 AM
Thanks a lot.

I have set up and began mining, but have not mined Block 1 several hours.

Should I modify the difficulty of POW ? and how to ?

Thanks in advance.




The debug.log saying,

......
2018-05-26 23:46:14 ERROR: ProcessNewBlock: AcceptBlock FAILED
2018-05-26 23:46:14 ERROR: ProcessNewBlock: AcceptBlock FAILED
2018-05-26 23:46:14 ERROR: ProcessNewBlock: AcceptBlock FAILED
2018-05-26 23:46:14 ERROR: ProcessNewBlock: AcceptBlock FAILED
2018-05-26 23:46:14 ERROR: ProcessNewBlock: AcceptBlock FAILED
2018-05-26 23:46:14 ERROR: ProcessNewBlock: AcceptBlock FAILED
......


Is there something wrong?



Hi, what's your command line to run bitcoind and the miner?


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: bingble on May 27, 2018, 10:39:35 AM
Thanks a lot.

I have set up and began mining, but have not mined Block 1 several hours.

Should I modify the difficulty of POW ? and how to ?

Thanks in advance.




The debug.log saying,

......
2018-05-26 23:46:14 ERROR: ProcessNewBlock: AcceptBlock FAILED
2018-05-26 23:46:14 ERROR: ProcessNewBlock: AcceptBlock FAILED
2018-05-26 23:46:14 ERROR: ProcessNewBlock: AcceptBlock FAILED
2018-05-26 23:46:14 ERROR: ProcessNewBlock: AcceptBlock FAILED
2018-05-26 23:46:14 ERROR: ProcessNewBlock: AcceptBlock FAILED
2018-05-26 23:46:14 ERROR: ProcessNewBlock: AcceptBlock FAILED
......


Is there something wrong?



Hi, what's your command line to run bitcoind and the miner?



Thank you for your kindly reply, I have made some mistakes, right now corrected and run well.

Thank you for your nice guide again, there is nothing incorrect.




Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: victorkimba17 on May 27, 2018, 12:49:35 PM
why we need to add -maxtipage=$((24*60*60*5000)) to first node , so that getblocktemplate can work ?

first node:
src/bitcoind -debug=rpc -dns=0 -dnsseed=0 -datadir=../datadir/ -connect=0 -maxtipage=432000000 -daemon

second node:
src/bitcoind -debug=rpc -addnode=127.0.0.1:8963 -dns=0 -dnsseed=0 -datadir=../datadir_1/ -daemon

In the case you generated a new genesis block then you don't need for maxtipage, just run your miner and start mining.

I modified the timestamp, the nonce, in order to generate a new genesis block. But i still need to run bitcoind with maxtipage, so that getblocktemplate can work.

if i run bitcoind as: src/bitcoind -debug=rpc -dns=0 -dnsseed=0 -datadir=../datadir/ -connect=0 -daemon
i get the following errors:
Quote
src/bitcoin-cli -datadir=../datadir/ getblocktemplate
error code: -10
error message:
Bitcoin is downloading blocks...

Since i have generated  a new genesis block, why must bitcoind be run with maxtipage ?

In validation.cpp, IsInitialBlockDownload()
Code:
   if (chainActive.Tip()->GetBlockTime() < (GetTime() - nMaxTipAge))
        return true;

With default value of nMaxTipAge of 86400, that function IsInitialBlockDownload returns true, so bitcoind will go on download blocks.

The purpose of setting a large number to maxtipage,  is to make bitcoind think that initial block has been downloaded, so bitcoind will NOT download initial block.


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: victorkimba17 on May 28, 2018, 02:37:39 AM
The default value of DEFAULT_MAX_TIP_AGE

Code:
src/validation.h:static const int64_t DEFAULT_MAX_TIP_AGE = 24 * 60 * 60;
which is equal to 86400.

I have set the value of nMaxTipAge to be multiplied by 4000.
 
Code:
src/validation.cpp:int64_t nMaxTipAge = DEFAULT_MAX_TIP_AGE * 4000;
Why it is not reflected in the bitcoind, it is still 86400, and must be set in command line with -maxtipage ?


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: sudoaaron on May 29, 2018, 03:05:02 PM
Everything runs well after following this guide, however there are SEGWIT errors when sending from client to client wallets. Can we expand on resetting the SEGWIT parameters in chainparams.cpp?


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: supermoney on May 31, 2018, 12:56:38 AM
By the way, I also suggest you guys to read the following altcoin tutorial as well because it is including the how to retrieve the private key of genesis coinbase address in order to spend the block reward of genesis block: https://bitcointalk.org/index.php?topic=1030365.0

For anyone interested in increasing/decreasing the max block size weight then open ~/bitcoin/src/consensus/consensus.h and change MAX_BLOCK_WEIGHT from 4000000 (4MB) to any size you want.
Github reference: https://github.com/bitcoin/bitcoin/blob/master/src/consensus/consensus.h#L15

Alternative block size scaling solution here: https://gist.github.com/sipa/c65665fc360ca7a176a6

--------------------
hushan merited!


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: anthinguy21 on May 31, 2018, 01:01:16 AM
Great to see this :). I think there are so many members are looking for this. But why don't you provide a service about creating new altcoin in this forum?

I think you can earn a lot of money by this way :). Beside as I can see there are some members also provide service like this and it's really good ;D


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: sudoaaron on June 01, 2018, 10:55:12 PM
When sending between two clients, an error message occurs -

Fee estimation failed. Fallbackfee is disabled. Wait a few blocks or endable -fallbackfee.

What does this mean, and how do I fix it?

Log extract below....

2018-06-01T22:48:18Z Fee Calculation: Fee:16600 Bytes:166 Needed:16600 Tgt:0 (requested 0) Reason:"PayTxFee set" Decay 0.00000: Estimation: (-1 - -1) nan% 0.0/(0.0 0 mem 0.0 out) Fail: (-1 - -1) nan% 0.0/(0.0 0 mem 0.0 out)
2018-06-01T22:48:23Z CommitTransaction:
CTransaction(hash=578d837469, ver=2, vin.size=1, vout.size=2, nLockTime=157)
    CTxIn(COutPoint(a3a8c8cd92, 0), scriptSig=160014a7419391b687baff02, nSequence=4294967293)
    CScriptWitness(3045022100887e2a97a954e5300a92ddb920256955112fe0977121b1fd9b9876b8144b246602200 f067e29f0a555a914034d13b9203390448832f43277f447c42404119e5c328001, 03a0415edb85fbdbf4b9ab3b759c3f660b8e87fe57b7dc852237a5a670ee1ba791)
    CTxOut(nValue=48.99983400, scriptPubKey=a914b4f55ca5f2a9a9a67c6dd4f8a2)
    CTxOut(nValue=1.00000000, scriptPubKey=a9147bcc4af60d02ea64d6ad3dcfc0)
2018-06-01T22:48:23Z keypool keep 1001
2018-06-01T22:48:23Z AddToWallet 578d837469ebf22fe9fff4a97ad87c11ee4453ade47c36c378c9941374d4f2e9  new
2018-06-01T22:48:23Z CommitTransaction(): Transaction cannot be broadcast immediately, no-witness-yet (code 64)
2018-06-01T22:49:51Z keypool added 1 keys (1 internal), size=2000 (1000 internal)


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: sudoaaron on June 01, 2018, 11:16:05 PM
When sending between two clients, an error message occurs -

Fee estimation failed. Fallbackfee is disabled. Wait a few blocks or endable -fallbackfee.

What does this mean, and how do I fix it?

Log extract below....

2018-06-01T22:48:18Z Fee Calculation: Fee:16600 Bytes:166 Needed:16600 Tgt:0 (requested 0) Reason:"PayTxFee set" Decay 0.00000: Estimation: (-1 - -1) nan% 0.0/(0.0 0 mem 0.0 out) Fail: (-1 - -1) nan% 0.0/(0.0 0 mem 0.0 out)
2018-06-01T22:48:23Z CommitTransaction:
CTransaction(hash=578d837469, ver=2, vin.size=1, vout.size=2, nLockTime=157)
    CTxIn(COutPoint(a3a8c8cd92, 0), scriptSig=160014a7419391b687baff02, nSequence=4294967293)
    CScriptWitness(3045022100887e2a97a954e5300a92ddb920256955112fe0977121b1fd9b9876b8144b246602200 f067e29f0a555a914034d13b9203390448832f43277f447c42404119e5c328001, 03a0415edb85fbdbf4b9ab3b759c3f660b8e87fe57b7dc852237a5a670ee1ba791)
    CTxOut(nValue=48.99983400, scriptPubKey=a914b4f55ca5f2a9a9a67c6dd4f8a2)
    CTxOut(nValue=1.00000000, scriptPubKey=a9147bcc4af60d02ea64d6ad3dcfc0)
2018-06-01T22:48:23Z keypool keep 1001
2018-06-01T22:48:23Z AddToWallet 578d837469ebf22fe9fff4a97ad87c11ee4453ade47c36c378c9941374d4f2e9  new
2018-06-01T22:48:23Z CommitTransaction(): Transaction cannot be broadcast immediately, no-witness-yet (code 64)
2018-06-01T22:49:51Z keypool added 1 keys (1 internal), size=2000 (1000 internal)

Do we have to wait 432 blocks before we can send between clients for segwit to activate?


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: victorkimba17 on June 25, 2018, 06:21:33 AM

Oh, sorry I forgot to mention, in order to mine, the node has to connect to at least one peer node. So you need to run another instance of bitcoind and let it connect to the first node, like:


what is the reason the node has to connect to at least one peer node, in order for miner to run?


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: hushan on June 29, 2018, 01:24:30 PM

Oh, sorry I forgot to mention, in order to mine, the node has to connect to at least one peer node. So you need to run another instance of bitcoind and let it connect to the first node, like:


what is the reason the node has to connect to at least one peer node, in order for miner to run?

Mined blocks needs to be broadcast and confirmed by the network, with only one node your blocks cannot be confirmed. Also this check is hard wired in bitcoin's source code, so it's a must-met condition.


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: hushan on June 29, 2018, 01:25:55 PM
Hi to all,

I'm so confused about that, is the mentioned stages in this post correct to do right now for creating a new Alt Coin?

Thanks

Yes, it is in a sense, but unless you want something POW coins similar to bitcoin, today most coins are created as ERC20 on Ethereum network.


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: hushan on July 10, 2018, 08:12:27 AM
Hi to all,

I'm so confused about that, is the mentioned stages in this post correct to do right now for creating a new Alt Coin?

Thanks

Yes, it is in a sense, but unless you want something POW coins similar to bitcoin, today most coins are created as ERC20 on Ethereum network.


How Can I do that?

Just follow the guide :)
What specifically do you want to do?


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: bitkron on July 25, 2018, 03:11:05 AM
Hi... Im having a problem connecting the nodes.

Altcoin-cli getblocktemplate returns

error code: -28
error message:
Loading wallet...

Any Idea which parts of the code should I look in to?


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: wann100 on July 31, 2018, 09:40:57 AM
Hey Guys! I am new to this blog but not new to building coins! If you need any help please Contact me!

I can create coins for 0.12 BTC  but I can also fix your code for you if that is all you need. All I ask is for a donation for whatever you can afford.
BTC ADDRESS:126Xka9v7Ge5bzn5SM2fTSN4emoNL6Xq2p


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: victorkimba17 on August 01, 2018, 07:18:24 AM
Quote
./minerd --user rpcuser --pass 111111 --url http://127.0.0.1:6332/ --threads 4 --coinbase-addr XQg3PmNxX9oEbxsymqtQHir6dkPpVPTJ6P --coinbase-sig "my test coins" -a sha256d -D

How to know The coinbase-addr ? i think it is any bitcoin address.


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: victorkimba17 on August 01, 2018, 07:32:14 AM
Hi... Im having a problem connecting the nodes.

Altcoin-cli getblocktemplate returns

error code: -28
error message:
Loading wallet...

Any Idea which parts of the code should I look in to?

do u change the bitcoin core to become an altcoin ? how many altcoin nodes are u running ?


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: gjhiggins on August 02, 2018, 09:48:18 AM
10. Remove dns seeds
In chainparams.cpp, remove lines start with “vSeeds.emplace_back”

Also, remove the hard-coded Bitcoin-specific seeds (https://github.com/laanwj/bitcoin/blob/4818dba90074f213efa0fa7faf577ce5fb02eaee/src/chainparamsseeds.h) from chainparamseeds.cpp. Otherwise the client will continue to attempt to connect with the Bitcoin network.

Cheers

Graham


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: nur1labs on August 03, 2018, 05:56:28 AM
10. Remove dns seeds
In chainparams.cpp, remove lines start with “vSeeds.emplace_back”

Also, remove the hard-coded Bitcoin-specific seeds (https://github.com/laanwj/bitcoin/blob/4818dba90074f213efa0fa7faf577ce5fb02eaee/src/chainparamsseeds.h) from chainparamseeds.cpp. Otherwise the client will continue to attempt to connect with the Bitcoin network.

Cheers

Graham


need remove all or just port change?for this emercoin not work. they have 2 system hash and transaction id[peercoin fork]

Code:
chainparams.cpp:207: CMainParams::CMainParams(): Assertion `consensus.hashGenesisBlock == uint256S("0x000000002fe872d82f457a6016df5eeb432735a3291ae3b34d04dea89caa286a")' failed.
Aborted

do i need remove checkpoint?

Code:
return CreateGenesisBlock(pszTimestamp, genesisOutputScript, nTimeTx, nTimeBlock, nNonce, nBits, nVersion, genesisReward);
genesis = CreateGenesisBlock(1533211413, 0, 3823366493, 0x1d00ffff, 1, 0);

 checkpointData = (CCheckpointData) {
             boost::assign::map_list_of
            ( 0,     uint256S("0x00000000bcccd459d036a588d1008fce8da3754b205736f32ddfd35350e84c2d"))
         };


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: gjhiggins on August 03, 2018, 09:38:02 AM
need remove all or just port change

Whatever. Althougn it's relatively harmless, the client's insistence on "phoning home" seemed to be puzzling some folks, so I thought I'd mention the source of it.

Cheers

Graham


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: nur1labs on August 03, 2018, 10:00:50 AM
need remove all or just port change

Whatever. Althougn it's relatively harmless, the client's insistence on "phoning home" seemed to be puzzling some folks, so I thought I'd mention the source of it.

Cheers

Graham


ah thank i think fixed it....as i know i need do pztimes to news. why that important....or the chain is actually reading news timestamp? ???

but that ok now thank for info sir~


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: gjhiggins on August 03, 2018, 10:52:19 AM
ah thank i think fixed it....as i know i need do pztimes to news. why that important....or the chain is actually reading news timestamp? ???

No it's not checked, it's a social convention designed to reassure people that mining did not take place before the date (supposedly included) but it's not widely advertised as such. I still follow the rather elegant lead set by Mr Spread in Spreadcoin: use the latest Bitcoin block height and hash.

Cheers

Graham


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: nur1labs on August 03, 2018, 11:03:38 AM
ah thank i think fixed it....as i know i need do pztimes to news. why that important....or the chain is actually reading news timestamp? ???

No it's not checked, it's a social convention designed to reassure people that mining did not take place before the date (supposedly included) but it's not widely advertised as such. I still follow the rather elegant lead set by Mr Spread in Spreadcoin: use the latest Bitcoin block height and hash.

Cheers

Graham


that mean everything on web record on timestamp sir?i ever expected when i do collage. before im developer of Artificial now. it's make sense when i look number the linux. and ask linux tovald used his g+. what is that. he said timestamp. and he know it and used it on bitcoin and similar Artificial checkpoint~

well this guide is good atm for learn what is linux and seed. and how distribute as chain~

Notes : guide is unworking for hash. need figure it out.


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: codyli2002hk on September 07, 2018, 06:10:33 AM
Hi to all,
Thank you very much for your post. It helps me a lot.
is it way to add smart contract?


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: chameleon123 on September 07, 2018, 03:15:21 PM
Hello

I tried to do this post in order to finally change PoW threshold to create blocks faster. Unfortunately I encountered a problem, after those 13 steps  I came up to run bitcoind command and all I got was core dumped error. like this :

Code:
~$ bitcoind
bitcoind: chainparams.cpp:132: CMainParams::CMainParams(): Assertion `consensus.hashGenesisBlock == uint256S("0x0000000001e075d779592db22d19573375d05db23bdafd0a8b06c89fb2985d89")' failed.
Aborted (core dumped)

It seems it won't accept my genesis hash and with bitcoin-cli command it says "can not connect to server 127.0.0.1:6332. I can't even add the node with its command .Here is my bitcoin.conf :

rpcuser=admin
rpcpassword=admin
server=1
rpcallowip=127.0.0.1
rpcport=6332
listen=1
gen = 1

I tried so hard but couldn't find out what i'm missing. I followed all the steps precisely.  I will be beyond grateful if some body take some time and answer my question.


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: nur1labs on September 08, 2018, 01:02:41 AM
Hello

I tried to do this post in order to finally change PoW threshold to create blocks faster. Unfortunately I encountered a problem, after those 13 steps  I came up to run bitcoind command and all I got was core dumped error. like this :

Code:
~$ bitcoind
bitcoind: chainparams.cpp:132: CMainParams::CMainParams(): Assertion `consensus.hashGenesisBlock == uint256S("0000000001e075d779592db22d19573375d05db23bdafd0a8b06c89fb2985d89")' failed.
Aborted (core dumped)

It seems it won't accept my genesis hash and with bitcoin-cli command it says "can not connect to server 127.0.0.1:6332. I can't even add the node with its command .Here is my bitcoin.conf :

rpcuser=admin
rpcpassword=admin
server=1
rpcallowip=127.0.0.1
rpcport=6332
listen=1
gen = 1

I tried so hard but couldn't find out what i'm missing. I followed all the steps precisely.  I will be beyond grateful if some body take some time and answer my question.


bitcoin is easy way after used this guide you need understand used some c++ skill to do.


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: chameleon123 on September 08, 2018, 01:32:48 PM
Hello

I tried to do this post in order to finally change PoW threshold to create blocks faster. Unfortunately I encountered a problem, after those 13 steps  I came up to run bitcoind command and all I got was core dumped error. like this :

Code:
~$ bitcoind
bitcoind: chainparams.cpp:132: CMainParams::CMainParams(): Assertion `consensus.hashGenesisBlock == uint256S("0000000001e075d779592db22d19573375d05db23bdafd0a8b06c89fb2985d89")' failed.
Aborted (core dumped)

It seems it won't accept my genesis hash and with bitcoin-cli command it says "can not connect to server 127.0.0.1:6332. I can't even add the node with its command .Here is my bitcoin.conf :

rpcuser=admin
rpcpassword=admin
server=1
rpcallowip=127.0.0.1
rpcport=6332
listen=1
gen = 1

I tried so hard but couldn't find out what i'm missing. I followed all the steps precisely.  I will be beyond grateful if some body take some time and answer my question.


bitcoin is easy way after used this guide you need understand used some c++ skill to do.

I have some knowledge of c++ but right now I can not even test my fork. I don't know why I get this error. I didn't change address prefixes. It won't be a problem,will it ?


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: nur1labs on September 09, 2018, 02:34:59 AM
Hello

I tried to do this post in order to finally change PoW threshold to create blocks faster. Unfortunately I encountered a problem, after those 13 steps  I came up to run bitcoind command and all I got was core dumped error. like this :

Code:
~$ bitcoind
bitcoind: chainparams.cpp:132: CMainParams::CMainParams(): Assertion `consensus.hashGenesisBlock == uint256S("0000000001e075d779592db22d19573375d05db23bdafd0a8b06c89fb2985d89")' failed.
Aborted (core dumped)

It seems it won't accept my genesis hash and with bitcoin-cli command it says "can not connect to server 127.0.0.1:6332. I can't even add the node with its command .Here is my bitcoin.conf :

rpcuser=admin
rpcpassword=admin
server=1
rpcallowip=127.0.0.1
rpcport=6332
listen=1
gen = 1

I tried so hard but couldn't find out what i'm missing. I followed all the steps precisely.  I will be beyond grateful if some body take some time and answer my question.


bitcoin is easy way after used this guide you need understand used some c++ skill to do.

I have some knowledge of c++ but right now I can not even test my fork. I don't know why I get this error. I didn't change address prefixes. It won't be a problem,will it ?

you need change consensus of bitcoin follow up old guide. you can see on my profile i visit old guide. then mix with this one. + you need change pcmessage that important thing on unique. and put pztime to make sense of change before doing alive. you need prepare of this. old guide + this one made complete part of puzzle. try experiment on testnet before launch and you will meet same as this and you need some trick to make it appear your genesis. by generate timestamp another two just default or put anything~


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: chameleon123 on September 16, 2018, 10:16:59 AM
Hello

I tried to do this post in order to finally change PoW threshold to create blocks faster. Unfortunately I encountered a problem, after those 13 steps  I came up to run bitcoind command and all I got was core dumped error. like this :

Code:
~$ bitcoind
bitcoind: chainparams.cpp:132: CMainParams::CMainParams(): Assertion `consensus.hashGenesisBlock == uint256S("0000000001e075d779592db22d19573375d05db23bdafd0a8b06c89fb2985d89")' failed.
Aborted (core dumped)

It seems it won't accept my genesis hash and with bitcoin-cli command it says "can not connect to server 127.0.0.1:6332. I can't even add the node with its command .Here is my bitcoin.conf :

rpcuser=admin
rpcpassword=admin
server=1
rpcallowip=127.0.0.1
rpcport=6332
listen=1
gen = 1

I tried so hard but couldn't find out what i'm missing. I followed all the steps precisely.  I will be beyond grateful if some body take some time and answer my question.


bitcoin is easy way after used this guide you need understand used some c++ skill to do.

I have some knowledge of c++ but right now I can not even test my fork. I don't know why I get this error. I didn't change address prefixes. It won't be a problem,will it ?

you need change consensus of bitcoin follow up old guide. you can see on my profile i visit old guide. then mix with this one. + you need change pcmessage that important thing on unique. and put pztime to make sense of change before doing alive. you need prepare of this. old guide + this one made complete part of puzzle. try experiment on testnet before launch and you will meet same as this and you need some trick to make it appear your genesis. by generate timestamp another two just default or put anything~

Thank You. I solved it. It was One line that I carelessly commented because it was not in the main guide.


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: gjhiggins on September 16, 2018, 01:07:39 PM
what is the diffrence between port and rpc port exactly?
port is for the main consensus protocol, i.e. passing around of headers, txs, etc. all the busywork needed to maintain consensus.

rpcport (Remote Procedure Call) is a means of issuing commands such as getinfo and sendto to a running client.

If I want to cross-connect two clients:
bitcoind -port=12000 -rpcport=12001 -datadir=/tmp/datadir1 -connect=127.0.0.1:13000

bitcoind -port=13000 -rpcport=13001 -datadir=/tmp/datadir2 -connect=127.0.0.1:12000

rpc calls to the first client need to go to 127.0.0.1:12001 and those to the second client need to go to 127.0.0.1:13001

AIUI, the miner uses the rpcport to issue getwork (or getemplate or whatever) commands and uses the port to submit its candidate blocks to the consensus protocol -- which is why it needs the values for both port and rpcport.

(Were the Bitcoin dev team not self-avowedly "primarily systems engineers", then port might have been more self-evidently labelled as "protocolport")

HTH

Cheers

Graham


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: nur1labs on September 16, 2018, 01:49:28 PM
what is the diffrence between port and rpc port exactly?
port is for the main consensus protocol, i.e. passing around of headers, txs, etc. all the busywork needed to maintain consensus.

rpcport (Remote Procedure Call) is a means of issuing commands such as getinfo and sendto to a running client.

If I want to cross-connect two clients:
bitcoind -port=12000 -rpcport=12001 -datadir=/tmp/datadir1 -connect=127.0.0.1:13000

bitcoind -port=13000 -rpcport=13001 -datadir=/tmp/datadir2 -connect=127.0.0.1:12000

rpc calls to the first client need to go to 127.0.0.1:12001 and those to the second client need to go to 127.0.0.1:13001

AIUI, the miner uses the rpcport to issue getwork (or getemplate or whatever) commands and uses the port to submit its candidate blocks to the consensus protocol -- which is why it needs the values for both port and rpcport.

(Were the Bitcoin dev team not self-avowedly "primarily systems engineers", then port might have been more self-evidently labelled as "protocolport")

HTH

Cheers

Graham

is there any method to make ip is not call back by number[seed] and run on hex method. i try call this bitcoin seems close the method for .txt


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: goolesby on September 16, 2018, 02:11:40 PM
Actually it is a very clear explanation about how to create the new altcoin. but, I myself still not yet try creating the coin because it must be very complex and must be considered smartly and carefully. but so far, it will be very helpful if we have any plan for creating it later.


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: nur1labs on September 16, 2018, 11:56:50 PM
Actually it is a very clear explanation about how to create the new altcoin. but, I myself still not yet try creating the coin because it must be very complex and must be considered smartly and carefully. but so far, it will be very helpful if we have any plan for creating it later.

i think genesis no problem. anything last guide is for ip to hex they used some engine on bitcoin can encrypt that prefent brute attack on protocol. this still solve on our side.


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: CikoXp on October 04, 2018, 08:06:55 AM
Hello guys... my coin is working good... but i've some issue with Masternodes. They are also working good.. collateral is good recognized and rewards works as expected following my block value and reward % settings. Simply i can't start them via wallet (MN tab). I can only start my MNs via debug typing:

Code:
- startmasternode all 0
or
Code:
- startmasternode alias 0 MN1
- startmasternode alias 0 MN2
- startmasternode alias 0 MN3

but if i click on "Start MISSING", "Start All" or "Start Alias" in wallet MN tab it will give me this error:

Code:
Succefull start 0 masternodes, failed to start 3, total 3
Failed to start MN1. Error: Invalid IP address xxx.xxx.xxx.xxx,
masternode=xxxxxxxxTxIDxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Failed to start MN2. Error: Invalid IP address xxx.xxx.xxx.xxx,
masternode=xxxxxxxxTxIDxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Failed to start MN3. Error: Invalid IP address xxx.xxx.xxx.xxx,
masternode=xxxxxxxxTxIDxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

but MNs still works fine because i can start them via debug consolle with above commands that give me "Success" results and make my MNs "ENABLED"....
Ther's something i forgot to do?
Following the error in the code i found this in "masternode.cpp":

Code:
mnbRet = CMasternodeBroadcast(service, txin, pubKeyCollateralAddressNew, pubKeyMasternodeNew, PROTOCOL_VERSION);

    if (!mnbRet.IsValidNetAddr()) {
        strErrorRet = strprintf("Invalid IP address %s, masternode=%s", mnbRet.addr.ToStringIP (), txin. prevout.hash.ToString());
        LogPrint("masternode","CMasternodeBroadcast::Create -- %s\n", strErrorRet);
        mnbRet = CMasternodeBroadcast();
        return false;
    }

I've also changed "PROTOCOL_VERSION" downgrading wallet verions under the "Enforce" threshold that is setted after block 1000... but it did not help.
Anyone can help me?


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: nur1labs on October 05, 2018, 02:28:09 AM
masternodes need have 5 servers. and masternodes need generate unique key for this~


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: CikoXp on October 05, 2018, 10:42:40 AM
masternodes need have 5 servers. and masternodes need generate unique key for this~

Quote
5 servers?
Where is setted this param? I think not...

Quote
generate unique key?
Maybe u mean "masternode genkey"? This is obvious. Already done.

And after googling a bit.. i think i'm setting wrong params in local.conf.. i'm working on this for now. i'll post the result....


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: nur1labs on October 06, 2018, 12:45:46 AM
masternodes need have 5 servers. and masternodes need generate unique key for this~

Quote
5 servers?
Where is setted this param? I think not...

Quote
generate unique key?
Maybe u mean "masternode genkey"? This is obvious. Already done.

And after googling a bit.. i think i'm setting wrong params in local.conf.. i'm working on this for now. i'll post the result....

so it's can do 3 servers?hmmmm if good i wanna see result. im not masternodes expert. im doing stake thing...that better  8)


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: MrGew on October 20, 2018, 06:11:33 AM
If you create the blockchain with this method, how you retrieve the tx information in 0 block?

On 1 block you can get block info and then tx info over txid, but this fails on block 0, u cant retrieve txinformation cause the txid seems not correct.

Can anyone confirm? How to handle?

Code:
getblockhash 0
getblock hash
gettransaction txhash

ends in Invalid or non-wallet transaction id (code -5)

Mr Gew


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: nur1labs on October 21, 2018, 09:54:16 AM
If you create the blockchain with this method, how you retrieve the tx information in 0 block?

On 1 block you can get block info and then tx info over txid, but this fails on block 0, u cant retrieve txinformation cause the txid seems not correct.

Can anyone confirm? How to handle?

Code:
getblockhash 0
getblock hash
gettransaction txhash

ends in Invalid or non-wallet transaction id (code -5)

Mr Gew

hmmm not sure never got this atm all rpc fine


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: TheWolf666 on November 11, 2018, 03:41:09 PM
I have an issue with this parameter? --coinbase-addr XQg3PmNxX9oEbxsymqtQHir6dkPpVPTJ6P

How do you get an address if you never mined any block? My wallet is loading and never syncing, I have no address.

Do I miss something?

Note: I have done my own genesis using genesis.cpp as instructed.


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: nur1labs on November 12, 2018, 06:10:26 AM
I have an issue with this parameter? --coinbase-addr XQg3PmNxX9oEbxsymqtQHir6dkPpVPTJ6P

How do you get an address if you never mined any block? My wallet is loading and never syncing, I have no address.

Do I miss something?

Note: I have done my own genesis using genesis.cpp as instructed.

on cli you need type : getwalletinfo there will info wallet active. but you know today is hard code. you need rebase code for easy~


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: TheWolf666 on November 12, 2018, 05:11:08 PM
getwalletinfo give no key, wallet name is empty... I have created my own blockchain so there is no transaction...
I have seen many people having the same problem and no solution.
generate or generatetoaddress is not doing anything.

However if I do getnewaddress I get a new address, but this address is not saved,  or not visible in the getwalletinfo

Code:

00:05:48

getwalletinfo


00:05:48

{
  "walletname": "",
  "walletversion": 169900,
  "balance": 0.00000000,
  "unconfirmed_balance": 0.00000000,
  "immature_balance": 0.00000000,
  "txcount": 0,
  "keypoololdest": 1541959024,
  "keypoolsize": 1000,
  "keypoolsize_hd_internal": 1000,
  "paytxfee": 0.00000000,
  "hdseedid": "33122e4958e02b7e0205a34476a13c1f45edd135",
  "hdmasterkeyid": "33122e4958e02b7e0205a34476a13c1f45edd135",
  "private_keys_enabled": true
}


I have an issue with this parameter? --coinbase-addr XQg3PmNxX9oEbxsymqtQHir6dkPpVPTJ6P

How do you get an address if you never mined any block? My wallet is loading and never syncing, I have no address.

Do I miss something?

Note: I have done my own genesis using genesis.cpp as instructed.

on cli you need type : getwalletinfo there will info wallet active. but you know today is hard code. you need rebase code for easy~


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: nur1labs on November 14, 2018, 01:22:07 AM
they already hardcode it. that why many not know . there something about new bitcoin that bip you need know that what must do. on mean time prefer used rebase code~

Here (https://imgur.com/gallery/7U0EPcf) sample of transaction receive by mining. did you look off the debug.log?


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: TheWolf666 on November 16, 2018, 06:55:11 PM
Not sure to understand your English.
But apparently latest Bitcoin 0.17 cannot solo mine, and is incompatible with all cpuminer flavors, because the RPC commands have been removed.
That's not nice for the Altcoins

they already hardcode it. that why many not know . there something about new bitcoin that bip you need know that what must do. on mean time prefer used rebase code~

Here (https://imgur.com/gallery/7U0EPcf) sample of transaction receive by mining. did you look off the debug.log?


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: nur1labs on November 17, 2018, 03:14:53 AM
Not sure to understand your English.
But apparently latest Bitcoin 0.17 cannot solo mine, and is incompatible with all cpuminer flavors, because the RPC commands have been removed.
That's not nice for the Altcoins

they already hardcode it. that why many not know . there something about new bitcoin that bip you need know that what must do. on mean time prefer used rebase code~

Here (https://imgur.com/gallery/7U0EPcf) sample of transaction receive by mining. did you look off the debug.log?


im not used that on screen shoot new bitcoin. im prefer used rebase code. since hard code is hard... ;D


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: KerberosX on January 01, 2019, 10:35:51 PM
I have created a clone of the latest version of Litecoin using this guide. All appears fine, have 2 wallets running, using minerd and it's constantly finding blocks. But for some reason my balance (on both wallets) remains at 0.

This is an extract of debug.log:
Code:
2019-01-01 22:34:28 UpdateTip: new best=b9d30863f3b2aa7d8d9d0fe61673bff488dfa4a62d4d4eb8dbb865195d76276a height=383 version=0x20000000 log2_work=28.584985 tx=384 date='2019-01-01 22:34:25' progress=1.000000 cache=0.0MiB(323txo)
2019-01-01 22:34:30 CreateNewBlock(): block weight: 772 txs: 0 fees: 0 sigops 400
2019-01-01 22:34:33 UpdateTip: new best=ae8c37c06f5da0486c438bd6ef0e403c0ccd3481c4c8fed2ff48f990b527f780 height=384 version=0x20000000 log2_work=28.588737 tx=385 date='2019-01-01 22:34:30' progress=1.000000 cache=0.0MiB(324txo)
2019-01-01 22:34:35 CreateNewBlock(): block weight: 772 txs: 0 fees: 0 sigops 400
2019-01-01 22:34:43 UpdateTip: new best=1f94f804b286ef3a80f239e860b64e094abb823eee1e311edb1d857a8d9ae28b height=385 version=0x20000000 log2_work=28.592479 tx=386 date='2019-01-01 22:34:38' progress=1.000000 cache=0.0MiB(325txo)
2019-01-01 22:34:45 CreateNewBlock(): block weight: 772 txs: 0 fees: 0 sigops 400
2019-01-01 22:34:58 UpdateTip: new best=0d9fc3f15008d97b1caba26c8dde8163850f20d1db0c4446140d9e4fd941e8ae height=386 version=0x20000000 log2_work=28.596212 tx=387 date='2019-01-01 22:34:53' progress=1.000000 cache=0.0MiB(326txo)
2019-01-01 22:34:58 CreateNewBlock(): block weight: 772 txs: 0 fees: 0 sigops 400
2019-01-01 22:34:59 UpdateTip: new best=36c70adbf212df121a0a37e0e3cb3071459b4a50b989572145f7b62f19cbcdf9 height=387 version=0x20000000 log2_work=28.599935 tx=388 date='2019-01-01 22:34:58' progress=1.000000 cache=0.0MiB(327txo)
2019-01-01 22:35:01 CreateNewBlock(): block weight: 772 txs: 0 fees: 0 sigops 400
2019-01-01 22:35:09 UpdateTip: new best=54358b011951aa4a1035dfad6490e568c655c97c6cfca35b726eb508617deff7 height=388 version=0x20000000 log2_work=28.603648 tx=389 date='2019-01-01 22:35:06' progress=1.000000 cache=0.0MiB(328txo)
2019-01-01 22:35:11 CreateNewBlock(): block weight: 772 txs: 0 fees: 0 sigops 400

What could be wrong?


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: KerberosX on January 04, 2019, 10:02:14 PM
OK, so above issue was with the latest Litecoin branch. When I switch to Litecoin 0.15, everything works fine. After some digging, it seems it has to do with the CPU mining software not compatible with the bech32 addresses (which were added in Litecoin 0.16).

When I fork the latest branch of Litecoin and start the wallets with the -addresstype=legacy switch, I am able to generated a legacy address and mine to it with minerd.

So far I was not able to find any working CPU miner that is compatible with the latest Litecoin version  :-\

Anyone else busy with this?


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: nur1labs on January 06, 2019, 09:54:15 AM
OK, so above issue was with the latest Litecoin branch. When I switch to Litecoin 0.15, everything works fine. After some digging, it seems it has to do with the CPU mining software not compatible with the bech32 addresses (which were added in Litecoin 0.16).

When I fork the latest branch of Litecoin and start the wallets with the -addresstype=legacy switch, I am able to generated a legacy address and mine to it with minerd.

So far I was not able to find any working CPU miner that is compatible with the latest Litecoin version  :-\

Anyone else busy with this?

 as you know for next version you must carefully follow up new version fork rules. so im used rebase as fine~


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: TheWolf666 on March 05, 2019, 06:40:59 PM
A couple of information to help doing an altcoin from latest version of bitcoin.
Lot of people are stuck because bitcoin 0.18 + have a lot of verification that are not taking in account the case of when you are at genesis (nheight=1) with one transaction.

The loading screen is blocking and you cannot mine without removing it. Getblocktemplate send an error "Loading blocks"

Latest version of Bitcoin (0.18) is adding a define in chain.h, this value is used in /qt/bitcoingui.cpp to show the blocking form or not.

Code:
MAX_BLOCK_TIME_GAP = 90 * 60

This value is too small for the first transactions, the genesis first tx is most of the time older than 90*60 seconds and that's what is blocking the wallet.

If you change this value to 3600*365, you will remove the loading screen and get the coin to mine.

Once your blockchain has more transactions (let say 1000 for example) and you are mining a block like a swiss clock every x minutes, you can reverse this parameter to a value close to x



Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: TheWolf666 on March 05, 2019, 07:04:44 PM
Another help for the altcoin developers. When this article was posted, it was possible to mine without using stratum, but now it is not possible.

Mining your altcoin involve more work than before (blame the Bitcoin core dev for that!). Satoshi made the first Bitcoin wallet with 3 main functions, sending/receiving and mining. The fact that the solo mining code is removed make it very complicated for the altcoin designers to use Bitcoin core as a fork, reason why they are mostly using Dash/Litecoin which are based from Bitcoin 0.14 to develop new altcoin. I think it is a shame, but I am not in a position to change anything in Bitcoin core so we can only try to find solutions.

How to mine your coin if you want to use Bitcoin core 0.18?

First you need to run your mining wallet using by the command line yourcoind -deprecatedrpc=accounts
Otherwise, getblocktemplate will not answer to stratum and mining will be impossible

(message to the Bitcoin core developers, how are we going to mine if you remove getblocktemplate?)

Right now, since getblocktemplate is not yet deprecated, we can use Yiimp to mine.

1) get an Ubuntu 0.18 server and use the script here https://github.com/NicolasChoukroun/yiimp_install_scrypt_ubuntu18.04 or https://github.com/xavatar/yiimp_install_scrypt_ubuntu18.04
and follow the instructions. To run stratum go in the /var/stratum directory and run ./run.sh sha
Careful to change the path of blocknotify to /var/stratum/blocknotify or it will not mine.

2) add your coin to Yiimp by using a second server that has its IP authorized to use the backend as explained in the instructions when you installed yiimp.
a good tutorial is here https://coinguides.org/yiimp-mining-pool/

3) compile your coin for PC and Unix, run the mining wallet where your installed Yiimp get an address (yourcoin-cli getnewaddress) and use it as main wallet and wallet in the coin configuration.

4) run yourcoin-qt -deprecatedrpc=account on a windows machine. Get ccminer-230 and edit one of the cmd file, enter the commands suggested by Yiimp (and do not forget to change the block notify address to /var/stratum/blocknotify)
Use the address of your windows wallet (getnewaddress) as parameter too ccminer230.exe as per instruction on how to use ccminer

Now you are ready to mine... run the cmd to get ccminer mining, it should work.

As you can see, the bitcoin core dev have made it really complicated to fork the latest Bitcoin core to do an altcoin.



Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: lightspeedhosting on March 10, 2019, 07:49:51 PM
So I feel like there's piece of simple info that is probably just known and expected that we know if we're interested in starting an Alt, but sadly it's not lol

Basically in this tutorial it's optional to rename BTC or bitcoin, so I guess the question is; is the symbol or name not actually assigned in the code it self?  Obviously in a wallet you can label it what ever you want and that asset has an address and network where you interact with it, and exchanges likewise are running nodes and in their displays can label blockchain "X" as what ever they want when it's displayed. 

So is the public key and/or network identifier the actual identifier for the coin and the coin name/symbol not actually dictated by the code?


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: TheWolf666 on March 11, 2019, 12:04:08 AM
You can fork and create an altcoin by only changing the name of the coin (search all occurence of Bitcoin and BTC and replace them with yours), and change the RPC port.
It would do a fork of Bitcoin, and use the bitcoin blockchain.

If you want to solomine to get your premine without a headache and have your own blockchain, you don't need to change the public key (while it is advised, it is not not mendatory).

In that case you have 3 solutions:
1) keep the bitcoin values and start over a new blockchain by only doing a new genesis as explained in the tutorial. This will make a new functionnal blockchain but you will be stuck with POW for mining and will have to add some kind of protection like DGW to avoid having big miners canibilizing your mining. You will have to setup a stratum server to mine.

2) start from Litecoin or Dash that were designed from Bitcoin 0.14 and still have the solo mining features. Doing the genesis is identical for these as explained in this tutorial.

3) start from Bytecoin and use Cryptonight. It is a fairly different version of bitcoin, based on Bitcoin 0.12 I think but highly modified.

The 2) and 3) are not developed as actively as Bitcoin core, but are easy to get started.

Bitcoin Core will not run out of the box unless you modify the stratum code from Yiimp, and remove many checks from validation.cpp, /qt/bicoingui.cpp, mining.cpp etc... you need to be a sharp C++ coder to choose the Bitcoin core forking way.


So I feel like there's piece of simple info that is probably just known and expected that we know if we're interested in starting an Alt, but sadly it's not lol

Basically in this tutorial it's optional to rename BTC or bitcoin, so I guess the question is; is the symbol or name not actually assigned in the code it self?  Obviously in a wallet you can label it what ever you want and that asset has an address and network where you interact with it, and exchanges likewise are running nodes and in their displays can label blockchain "X" as what ever they want when it's displayed. 

So is the public key and/or network identifier the actual identifier for the coin and the coin name/symbol not actually dictated by the code?


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: digitalcitizen on March 27, 2019, 05:14:14 AM
Good guide!

A couple of updates for Bitcoin release 0.17.1 which I wanted to use.

Also if you want to build a Windows GUI wallet, you will have to git clone and add --branch v.0.17.1 (it accepts a tag) so you get the /depends directory and all the stuff inside needed for cross-compile dependencies.  That way you can cross-compile for Win 64 on Ubuntu and get a slick Bitcoin Core wallet.  If you know how to get gitian up and running, you can make a setup .exe.  If you have Mac libs, you can cross-compile for a Mac wallet, too.

So first swap out the RPC port step and instead change it here in src/chainparamsbase.cpp:

Code:
std::unique_ptr<CBaseChainParams> CreateBaseChainParams(const std::string& chain)
{
    if (chain == CBaseChainParams::MAIN)
        return MakeUnique<CBaseChainParams>("", 10332);   // I set my port to 10332, Bitcoin's is 8332, I left the rest alone
    else if (chain == CBaseChainParams::TESTNET)
        return MakeUnique<CBaseChainParams>("testnet3", 18332);
    else if (chain == CBaseChainParams::REGTEST)
        return MakeUnique<CBaseChainParams>("regtest", 18443);
    else
        throw std::runtime_error(strprintf("%s: Unknown chain %s.", __func__, chain));
}

In chainparams.cpp, set the P2P port under the pchMessageStart lines:

Code:
nDefaultPort = 10333;    // Bitcoin's is 8333, I set mine to a thousand above Litecoin's P2P port (9333)

Not long after that, when you create a genesis block with genesisgen or GenesisH0's Python tool, this line should look familiar:

Code:
genesis = CreateGenesisBlock(1553416095, 2546245826, 0x1d00ffff, 1, 50 * COIN);

That was mine, but now do the same thing for testnet, otherwise the daemon will fail with the assert on the genesis hash for it.  So in chainparams.cpp set your genesis block again.  Look for the Testnet (v3) comment and the process is the same for main-net

For bech32_hrp, I left mine as "bc" but you can change that.  Litecoin's is "ltc".  Note that with miners, I found they failed to mine to older style addresses, so you will probably have to bitcoin-cli getnewaddress, then bitcoin-cli getaddressinfo "addr" and find the bech32 address in there, and set that as your --coinbase-addr parameter with cpuminer, then it works.

with chainTxData in chainparams.cpp, set nTime to the UNIX timestamp of your genesis block and the nTxCount and dTxRate both to 0.

An important step to take if you publish your source on github is to mine say 100 blocks and have them confirmed, and adjust your nPowTargetTimespan as a minimum to try and prevent instamining.  People will find it and instamine it immediately, if it looks like a new alt-coin to them, leaving you with the likely situation that they out-gun you with a higher hashrate, and trying to catch up means you could get blocks, but they will all probably get orphaned.  And then leave your blockchain in a mess and your coin stalling.

I set mine to:

Code:
consensus.nPowTargetTimespan = 3 * 60 * 60; // three hours
consensus.nPowTargetSpacing = 2 * 60; // two minutes

to begin with.  It probably still isn't good enough in comparison to implementing DGW v3 or MIDAS or something of your own invention, in particular you might like to have difficulty readjustments done less than every 3 hours as above.  This works out for me just in a test environment, and I usually get my block every two minutes although sometimes a few will pop through every minute then it will slow down again and not find a few blocks for longer than the target of 2 minutes that I wanted.

You can also premine coins for yourself if you want to with the GetBlockSubsidy function in validation.cpp.

Please note I haven't tested this at all, but for example:

Code:
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams)
{
    int halvings = nHeight / consensusParams.nSubsidyHalvingInterval;

    // Force block reward to zero when right shift is undefined.
    if (halvings >= 64)
        return 0;

    // Premine in first ten blocks, the simple approach
    
    // Start with 5000 coins per block after genesis, but otherwise leave default subsidy unchanged
    CAmount nSubsidy = 50 * COIN;

    // First 10 blocks after genesis, up the subsidy to 5000 coins
    if (nHeight > 0 && nHeight <= 10) {
        nSubsidy = 5000 * COIN;
        // You may wish to leave out the halvings below and just
        return nSubsidy;
        // especially if you just premine in block #1 and leave it at that, but check
        // to make sure it doesn't get all screwed up...
    }

    // otherwise leave nSubsidy in its default state
    
    // Subsidy is cut in half every 210,000 blocks which will occur approximately every 4 years. (Not true for my adjustments, pay attention here)
    nSubsidy >>= halvings;
    return nSubsidy;
}

I left the coin supply and subsidy halving for the moment because it doesn't matter, it's not an alt-coin but a learn-by-doing exercise, trying to retrofit in the bare minimum of difficulty adjustments, experimenting with scripts in transactions (enabling some, trying new ones, going a bit crazy there but the programmable money part is a lot of fun for me), and looking at how more privacy of transactions could be implemented.  I expect I'm a couple of years away from that, but I hope to get there some day, otherwise it's worth trying to clone ZCash or another coin.

I think I've covered the bare basic bits as a follow-on to this guide if you want Bitcoin 0.17.1, you might run into make issues after changing everything from Bitcoin to NewCoin and so on.  So for example if the build process fails in doc/man (a situation I ran into before) saying it has no rule to make newcoind.1.  Stop., then just rename bitcoind.1 to newcoind.1 (and same for 3 other files there) then run make again and it will continue where it left off.

For a Windows QT wallet, cross-compiling on Ubuntu 18.04 LTS:

Code:
sudo apt-get update
sudo apt-get upgrade

sudo apt-get install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils python3 libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-dev libboost-all-dev libboost-program-options-dev
sudo apt-get install libminiupnpc-dev libzmq3-dev libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler libqrencode-dev unzip

// Get into your src directory, e.g.

cd ~/bitcoin-0.17.1

// For a 64-bit Windows wallet

sudo apt install g++-mingw-w64-x86-64

// Set mode to POSIX when it asks after running
sudo update-alternatives --config x86_64-w64-mingw32-g++

// Get ready and change into depends directory
PATH=$(echo "$PATH" | sed -e 's/:\/mnt.*//g')
cd depends

// This will take a while
make HOST=x86_64-w64-mingw32

// Up one level to your top level src dir (not in /src, up from there to configure and make)
cd ..

// I use the latest Berkeley DB, so if like me you don't need "compatible" wallets,
// always configure with the latest Berkeley DB and pass in --with-incompatible-bdb

// This will also take a while...

./autogen.sh
CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure --with-incompatible-bdb --prefix=/
make

If all goes well, the 64-bit Windos GUI wallet e.g. newcoin-qt.exe will be in the folder src/qt when compiled. The other tools newcoin-cli.exe, newcoin-tx.exe and the daemon newcoind.exe will be in the src folder.

So I think that's all for now for a quick and dirty Bitcoin 0.17.1 based on last year's Christmas Day release.


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: TheWolf666 on March 28, 2019, 01:15:18 PM
About windows 64/32 compilation, you can use make -i to ignore the errors. There will be errors due to one sha flavor compilation error, but it does not affect the result since other sha algorithms will compile fine and this one is optionnal, but without the -i it will stop the compilation.
Also when you say "mine 100 blocks" but how? Bitcoin 0.17.1 is not mining with Yiimp without stratum modification (due to changes in how the address verification is done with RPC)
And about DWG and Midas I have experienced both, they are falling with ccminer and the coin reject the mined block with an unexpected difficulty match error. I ended up continuing to use the basic Bitcoin reajustment code - which is working fine but reajusting every block.
Another solution is to check verification.cpp from the different version of Bitcoin (cash, sv etc...) and see how they dealed with reajustment.

Good guide!

A couple of updates for Bitcoin release 0.17.1 which I wanted to use.

Also if you want to build a Windows GUI wallet, you will have to git clone and add --branch v.0.17.1 (it accepts a tag) so you get the /depends directory and all the stuff inside needed for cross-compile dependencies.  That way you can cross-compile for Win 64 on Ubuntu and get a slick Bitcoin Core wallet.  If you know how to get gitian up and running, you can make a setup .exe.  If you have Mac libs, you can cross-compile for a Mac wallet, too.

So first swap out the RPC port step and instead change it here in src/chainparamsbase.cpp:

Code:
std::unique_ptr<CBaseChainParams> CreateBaseChainParams(const std::string& chain)
{
    if (chain == CBaseChainParams::MAIN)
        return MakeUnique<CBaseChainParams>("", 10332);   // I set my port to 10332, Bitcoin's is 8332, I left the rest alone
    else if (chain == CBaseChainParams::TESTNET)
        return MakeUnique<CBaseChainParams>("testnet3", 18332);
    else if (chain == CBaseChainParams::REGTEST)
        return MakeUnique<CBaseChainParams>("regtest", 18443);
    else
        throw std::runtime_error(strprintf("%s: Unknown chain %s.", __func__, chain));
}

In chainparams.cpp, set the P2P port under the pchMessageStart lines:

Code:
nDefaultPort = 10333;    // Bitcoin's is 8333, I set mine to a thousand above Litecoin's P2P port (9333)

Not long after that, when you create a genesis block with genesisgen or GenesisH0's Python tool, this line should look familiar:

Code:
genesis = CreateGenesisBlock(1553416095, 2546245826, 0x1d00ffff, 1, 50 * COIN);

That was mine, but now do the same thing for testnet, otherwise the daemon will fail with the assert on the genesis hash for it.  So in chainparams.cpp set your genesis block again.  Look for the Testnet (v3) comment and the process is the same for main-net

For bech32_hrp, I left mine as "bc" but you can change that.  Litecoin's is "ltc".  Note that with miners, I found they failed to mine to older style addresses, so you will probably have to bitcoin-cli getnewaddress, then bitcoin-cli getaddressinfo "addr" and find the bech32 address in there, and set that as your --coinbase-addr parameter with cpuminer, then it works.

with chainTxData in chainparams.cpp, set nTime to the UNIX timestamp of your genesis block and the nTxCount and dTxRate both to 0.

An important step to take if you publish your source on github is to mine say 100 blocks and have them confirmed, and adjust your nPowTargetTimespan as a minimum to try and prevent instamining.  People will find it and instamine it immediately, if it looks like a new alt-coin to them, leaving you with the likely situation that they out-gun you with a higher hashrate, and trying to catch up means you could get blocks, but they will all probably get orphaned.  And then leave your blockchain in a mess and your coin stalling.

I set mine to:

Code:
consensus.nPowTargetTimespan = 3 * 60 * 60; // three hours
consensus.nPowTargetSpacing = 2 * 60; // two minutes

to begin with.  It probably still isn't good enough in comparison to implementing DGW v3 or MIDAS or something of your own invention, in particular you might like to have difficulty readjustments done less than every 3 hours as above.  This works out for me just in a test environment, and I usually get my block every two minutes although sometimes a few will pop through every minute then it will slow down again and not find a few blocks for longer than the target of 2 minutes that I wanted.

You can also premine coins for yourself if you want to with the GetBlockSubsidy function in validation.cpp.

Please note I haven't tested this at all, but for example:

Code:
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams)
{
    int halvings = nHeight / consensusParams.nSubsidyHalvingInterval;

    // Force block reward to zero when right shift is undefined.
    if (halvings >= 64)
        return 0;

    // Premine in first ten blocks, the simple approach
    
    // Start with 5000 coins per block after genesis, but otherwise leave default subsidy unchanged
    CAmount nSubsidy = 50 * COIN;

    // First 10 blocks after genesis, up the subsidy to 5000 coins
    if (nHeight > 0 && nHeight <= 10) {
        nSubsidy = 5000 * COIN;
        // You may wish to leave out the halvings below and just
        return nSubsidy;
        // especially if you just premine in block #1 and leave it at that, but check
        // to make sure it doesn't get all screwed up...
    }

    // otherwise leave nSubsidy in its default state
    
    // Subsidy is cut in half every 210,000 blocks which will occur approximately every 4 years. (Not true for my adjustments, pay attention here)
    nSubsidy >>= halvings;
    return nSubsidy;
}

I left the coin supply and subsidy halving for the moment because it doesn't matter, it's not an alt-coin but a learn-by-doing exercise, trying to retrofit in the bare minimum of difficulty adjustments, experimenting with scripts in transactions (enabling some, trying new ones, going a bit crazy there but the programmable money part is a lot of fun for me), and looking at how more privacy of transactions could be implemented.  I expect I'm a couple of years away from that, but I hope to get there some day, otherwise it's worth trying to clone ZCash or another coin.

I think I've covered the bare basic bits as a follow-on to this guide if you want Bitcoin 0.17.1, you might run into make issues after changing everything from Bitcoin to NewCoin and so on.  So for example if the build process fails in doc/man (a situation I ran into before) saying it has no rule to make newcoind.1.  Stop., then just rename bitcoind.1 to newcoind.1 (and same for 3 other files there) then run make again and it will continue where it left off.

For a Windows QT wallet, cross-compiling on Ubuntu 18.04 LTS:

Code:
sudo apt-get update
sudo apt-get upgrade

sudo apt-get install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils python3 libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-dev libboost-all-dev libboost-program-options-dev
sudo apt-get install libminiupnpc-dev libzmq3-dev libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler libqrencode-dev unzip

// Get into your src directory, e.g.

cd ~/bitcoin-0.17.1

// For a 64-bit Windows wallet

sudo apt install g++-mingw-w64-x86-64

// Set mode to POSIX when it asks after running
sudo update-alternatives --config x86_64-w64-mingw32-g++

// Get ready and change into depends directory
PATH=$(echo "$PATH" | sed -e 's/:\/mnt.*//g')
cd depends

// This will take a while
make HOST=x86_64-w64-mingw32

// Up one level to your top level src dir (not in /src, up from there to configure and make)
cd ..

// I use the latest Berkeley DB, so if like me you don't need "compatible" wallets,
// always configure with the latest Berkeley DB and pass in --with-incompatible-bdb

// This will also take a while...

./autogen.sh
CONFIG_SITE=$PWD/depends/x86_64-w64-mingw32/share/config.site ./configure --with-incompatible-bdb --prefix=/
make

If all goes well, the 64-bit Windos GUI wallet e.g. newcoin-qt.exe will be in the folder src/qt when compiled. The other tools newcoin-cli.exe, newcoin-tx.exe and the daemon newcoind.exe will be in the src folder.

So I think that's all for now for a quick and dirty Bitcoin 0.17.1 based on last year's Christmas Day release.


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: digitalcitizen on May 01, 2019, 04:07:05 PM
Does anyone know how to hack in BIP34 from block 1 after genesis?

It seems like this almost never works, and is something of a hack.  It fails out with -reindex and -txindex saying bad-cb-height, which is the block height in the coinbase tx.  So to set the BIP34 height and hash, how is that worked in unless you can specify you want BIP34's block height with a CPU miner?  That must be the only way to do it, then go back and validate everything.

Otherwise, maybe the only way to work around it is to skip the genesis block and start from block 1 with that block hash.  Assuming the block heights are in the coinbase tx.

Anyone figured out how to enable BIP34 from the start, aside from genesis?  Like block 1, or doesn't that make sense at all?  Am I missing something?

Thanks!


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: TheWolf666 on May 02, 2019, 11:47:57 AM
A  different thread about the same subject, but updated for 2019 and Bitcoin 0.17/0.18 has been posted here: https://bitcointalk.org/index.php?topic=5134256.0 (https://bitcointalk.org/index.php?topic=5134256.0)


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: TheRidDlerX on August 08, 2019, 06:22:04 PM
I have created a clone of the latest version of Litecoin using this guide. All appears fine, have 2 wallets running, using minerd and it's constantly finding blocks. But for some reason my balance (on both wallets) remains at 0.

What could be wrong?

Hi there! Can you (or anyone) please provide me the code to generate a genesis for the latest Litecoin core (i think its 0.17.1). Been at it for three weeks with various methods and scripts and cant seem to crack it without the hashes being wrong. Tried GenesisH0 script, custom code off the net old and new, but nothing seems to get my past the assert failed. Really appreciated. thank you


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: Matrix435 on August 18, 2019, 08:02:08 PM
Hi all i folowed the guide got an alt coin up and running all 3 vm nodes i setup find each other cpu miner works only to mine to bech32 adresses if you try mine to legacy adress it wont be credited so my question is i try send some coin from one wallet to another but the transaction does not end up in the mempool i run bitcoin source code 0.16.3


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: snwlprd on October 02, 2019, 02:22:38 AM
Everything runs well after following this guide, however there are SEGWIT errors when sending from client to client wallets. Can we expand on resetting the SEGWIT parameters in chainparams.cpp?

Hi, I have faced exactly the same error. Did anybody solve this problem? Everything worked fine for creating a new altcoin. Mining (CPUminer) is working and blocks are created accordingly. However transaction from one user to another is not confirmed and not validated. I guess this error relates to SEGWIT in chainparams.cpp. I tried many ways and get no positive results. Any suggestion?


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: apa7 on October 15, 2019, 06:26:36 AM
Hi, Thank you very much for your post. It helps me a lot.
Now I encountered a problem.
I run the following two bitcoinds:
Code:
bitcoind -conf=/home/bitcoinbitcoin.conf -rpcport=8332 -rpcbind=192.168.1.70 -connect=0 -listen=1 -maxtipage=432000000

bitcoind -conf=/home/bitcoin/peer2/bitcoin.conf -rpcport=6332 -rpcbind=192.168.1.70 -addnode=192.168.1.70:8333

When I try getblocktemplate,  it shows:
error code: -10
error message:
Bitcoin Core is in initial sync and waiting for blocks...

When I try miner, it shows:
HTTP request failed: The requested URL returned error: 500 Internal Server Error
[2019-10-15 14:25:53] json_rpc_call failed, retry after 30 seconds


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: intelli on December 22, 2019, 08:13:08 AM
Hello

I tried to do this post in order to finally change PoW threshold to create blocks faster. Unfortunately I encountered a problem, after those 13 steps  I came up to run bitcoind command and all I got was core dumped error. like this :

Code:
~$ bitcoind
bitcoind: chainparams.cpp:132: CMainParams::CMainParams(): Assertion `consensus.hashGenesisBlock == uint256S("0000000001e075d779592db22d19573375d05db23bdafd0a8b06c89fb2985d89")' failed.
Aborted (core dumped)

It seems it won't accept my genesis hash and with bitcoin-cli command it says "can not connect to server 127.0.0.1:6332. I can't even add the node with its command .Here is my bitcoin.conf :

rpcuser=admin
rpcpassword=admin
server=1
rpcallowip=127.0.0.1
rpcport=6332
listen=1
gen = 1

I tried so hard but couldn't find out what i'm missing. I followed all the steps precisely.  I will be beyond grateful if some body take some time and answer my question.


bitcoin is easy way after used this guide you need understand used some c++ skill to do.

I have some knowledge of c++ but right now I can not even test my fork. I don't know why I get this error. I didn't change address prefixes. It won't be a problem,will it ?

you need change consensus of bitcoin follow up old guide. you can see on my profile i visit old guide. then mix with this one. + you need change pcmessage that important thing on unique. and put pztime to make sense of change before doing alive. you need prepare of this. old guide + this one made complete part of puzzle. try experiment on testnet before launch and you will meet same as this and you need some trick to make it appear your genesis. by generate timestamp another two just default or put anything~

Thank You. I solved it. It was One line that I carelessly commented because it was not in the main guide.

me too

can you help me?
thank you very much


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: BlackHatCoiner on August 21, 2020, 04:12:28 PM
Hello, I have successfully built Bitcoin Core v0.20.0 on my Ubuntu 18.04.

I have made every single change you did. The only part I didn't do is the 12th, because I didn't have to. I don't care about changing genesis block. So I left Satoshi's there.

Once I open Bitcoin Core this is what it returns:

https://i.imgur.com/vSMS6RB.png

I changed everything from the source files so I can create my own blockchain. Although, I get these which make me think that something goes wrong:

https://i.imgur.com/4rswTSk.png

https://i.imgur.com/BDQxBXt.png

I haven't said this before, but I'm going to be really generous with the merits to anyone that will help me creating a coin with its own blockchain.

I hope the fault isn't on v0.20.0.


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: matrix1233 on January 09, 2021, 07:53:14 PM
Hi,
Am trying to create Altcoin with the version bitcoin v21.99.0-5574e4896-dirty (release build) and the problem when i change all and i try to mine i have Error . So i tried  ./bitcoin-cli -rpcconnect=127.0.0.1 -rpcuser=user -rpcpassword=pass -rpcport=8003 getblocktemplate
error code: -10
error message:
Bitcoin Core is in initial sync and waiting for blocks...

How can i resolve this ?


The change what i made is ==>
Code:
int64_t nMaxTipAge = DEFAULT_MAX_TIP_AGE * 4000; // use the original bitcoin genesis block

        pchMessageStart[0] = 0xf0;
        pchMessageStart[1] = 0xb0;
        pchMessageStart[2] = 0xb0;
        pchMessageStart[3] = 0xd0;

consensus.nMinimumChainWork = uint256S("0x0");
consensus.defaultAssumeValid = uint256S("0x0")
consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
ALl vSeeds.emplace_back commented



Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: magnetesim on August 02, 2021, 02:12:37 AM
When sending between two clients, an error message occurs -

Fee estimation failed. Fallbackfee is disabled. Wait a few blocks or endable -fallbackfee.

What does this mean, and how do I fix it?

Log extract below....

2018-06-01T22:48:18Z Fee Calculation: Fee:16600 Bytes:166 Needed:16600 Tgt:0 (requested 0) Reason:"PayTxFee set" Decay 0.00000: Estimation: (-1 - -1) nan% 0.0/(0.0 0 mem 0.0 out) Fail: (-1 - -1) nan% 0.0/(0.0 0 mem 0.0 out)
2018-06-01T22:48:23Z CommitTransaction:
CTransaction(hash=578d837469, ver=2, vin.size=1, vout.size=2, nLockTime=157)
    CTxIn(COutPoint(a3a8c8cd92, 0), scriptSig=160014a7419391b687baff02, nSequence=4294967293)
    CScriptWitness(3045022100887e2a97a954e5300a92ddb920256955112fe0977121b1fd9b9876b8144b246602200 f067e29f0a555a914034d13b9203390448832f43277f447c42404119e5c328001, 03a0415edb85fbdbf4b9ab3b759c3f660b8e87fe57b7dc852237a5a670ee1ba791)
    CTxOut(nValue=48.99983400, scriptPubKey=a914b4f55ca5f2a9a9a67c6dd4f8a2)
    CTxOut(nValue=1.00000000, scriptPubKey=a9147bcc4af60d02ea64d6ad3dcfc0)
2018-06-01T22:48:23Z keypool keep 1001
2018-06-01T22:48:23Z AddToWallet 578d837469ebf22fe9fff4a97ad87c11ee4453ade47c36c378c9941374d4f2e9  new
2018-06-01T22:48:23Z CommitTransaction(): Transaction cannot be broadcast immediately, no-witness-yet (code 64)
2018-06-01T22:49:51Z keypool added 1 keys (1 internal), size=2000 (1000 internal)

Do we have to wait 432 blocks before we can send between clients for segwit to activate?
Have you figured this out yet? I've mined 432 blocks, (the client turning on and off in between, idk if that matters) and it still says the same thing. I'm on block 440 right now, and I am not able to send a transaction, i just get the same CommitTransaction() error. When I use -prematurewitness to bypass that, nothing happens, it says that it's been relayed but my laptop that is running a node receives nothing. When I enable -prematurewitness on both machines, my laptop actually displays that a transactions has been sent to it but it never gets confirmed in the blockchain. And when I try to use a Bech32 address, it just says "CommitTransaction(): Transaction cannot be broadcast immediately, scriptpubkey". I don't really know what to do, any help would be appreciated.


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: Snipez on January 02, 2023, 06:47:22 PM
Can someone on here please explain what needs to be done to soft-fork an old .9 version altcoin that I did to be 13.2 or higher ?

I have tried everything I can think of, and there are 0 guides on this out there that I can find.


Any help would be greatly appreciated.


Thank you!


Title: Re: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***
Post by: Eduu84 on July 10, 2024, 11:15:05 AM
Reading the great article you posted, I thought it would be a good idea to make a similar tutorial for Kaspa. Can anyone help me to create it? ???