Bitcoin Forum
May 25, 2019, 08:26:41 PM *
News: Latest Bitcoin Core release: 0.18.0 [Torrent] (New!)
 
   Home   Help Search Login Register More  
Pages: [1] 2 3 4 5 »  All
  Print  
Author Topic: *** Complete Guide on How to Create a New Alt Coin – Update 2018 ***  (Read 8356 times)
hushan
Jr. Member
*
Offline Offline

Activity: 57
Merit: 9


View Profile
April 18, 2018, 04:13:45 PM
Merited by tk808 (5), supermoney (1), psycodad (1)
 #1

This post is based on 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, 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 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!

BTC: 38ykUxZeSv5aqav1keCc4KUxXLPPGkfrm5 LTC: MPpWNvqDCVB1PHJt4A28j9oFfc6Y1KKDno ETH: 0x07C8c68d5253247038947EF9495b054160c8737c
1558816001
Hero Member
*
Offline Offline

Posts: 1558816001

View Profile Personal Message (Offline)

Ignore
1558816001
Reply with quote  #2

1558816001
Report to moderator
1558816001
Hero Member
*
Offline Offline

Posts: 1558816001

View Profile Personal Message (Offline)

Ignore
1558816001
Reply with quote  #2

1558816001
Report to moderator
1558816001
Hero Member
*
Offline Offline

Posts: 1558816001

View Profile Personal Message (Offline)

Ignore
1558816001
Reply with quote  #2

1558816001
Report to moderator
GET 25 FREE SPINS AT REGISTRATION
GET 100% BONUS ON FIRST DEPOSIT
PLAY NOW
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1558816001
Hero Member
*
Offline Offline

Posts: 1558816001

View Profile Personal Message (Offline)

Ignore
1558816001
Reply with quote  #2

1558816001
Report to moderator
haoqian
Newbie
*
Offline Offline

Activity: 20
Merit: 0


View Profile
April 29, 2018, 06:52:31 AM
 #2

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
haoqian
Newbie
*
Offline Offline

Activity: 20
Merit: 0


View Profile
April 29, 2018, 07:11:25 AM
 #3

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
haoqian
Newbie
*
Offline Offline

Activity: 20
Merit: 0


View Profile
April 29, 2018, 07:52:09 AM
 #4

May I know which version of bitcoin core you are using?
hushan
Jr. Member
*
Offline Offline

Activity: 57
Merit: 9


View Profile
April 29, 2018, 08:47:42 AM
 #5

May I know which version of bitcoin core you are using?


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

BTC: 38ykUxZeSv5aqav1keCc4KUxXLPPGkfrm5 LTC: MPpWNvqDCVB1PHJt4A28j9oFfc6Y1KKDno ETH: 0x07C8c68d5253247038947EF9495b054160c8737c
hushan
Jr. Member
*
Offline Offline

Activity: 57
Merit: 9


View Profile
April 29, 2018, 08:49:28 AM
 #6

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.

BTC: 38ykUxZeSv5aqav1keCc4KUxXLPPGkfrm5 LTC: MPpWNvqDCVB1PHJt4A28j9oFfc6Y1KKDno ETH: 0x07C8c68d5253247038947EF9495b054160c8737c
haoqian
Newbie
*
Offline Offline

Activity: 20
Merit: 0


View Profile
April 29, 2018, 10:34:20 AM
 #7

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
hushan
Jr. Member
*
Offline Offline

Activity: 57
Merit: 9


View Profile
April 29, 2018, 01:57:04 PM
 #8

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.

BTC: 38ykUxZeSv5aqav1keCc4KUxXLPPGkfrm5 LTC: MPpWNvqDCVB1PHJt4A28j9oFfc6Y1KKDno ETH: 0x07C8c68d5253247038947EF9495b054160c8737c
haoqian
Newbie
*
Offline Offline

Activity: 20
Merit: 0


View Profile
April 29, 2018, 02:46:01 PM
 #9

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)
BogdanGFTP
Full Member
***
Offline Offline

Activity: 504
Merit: 101



View Profile
April 29, 2018, 03:09:19 PM
 #10

Very good instruction. Thank you very much!

MyCryptoBank  ――  Legal and Reliable Crypto Bank
Whitepaper  ――  CRYPTOBANK FOR CRYPTOCOMMUNITY  ――  Announce
―― Medium ―― YouTube ―― LinkedIn ―― Telegram ―― Facebook ―― Twitter ――
hushan
Jr. Member
*
Offline Offline

Activity: 57
Merit: 9


View Profile
April 29, 2018, 09:18:35 PM
 #11

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.

BTC: 38ykUxZeSv5aqav1keCc4KUxXLPPGkfrm5 LTC: MPpWNvqDCVB1PHJt4A28j9oFfc6Y1KKDno ETH: 0x07C8c68d5253247038947EF9495b054160c8737c
haoqian
Newbie
*
Offline Offline

Activity: 20
Merit: 0


View Profile
April 30, 2018, 02:25:36 AM
 #12

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
haoqian
Newbie
*
Offline Offline

Activity: 20
Merit: 0


View Profile
April 30, 2018, 04:04:00 AM
 #13

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)
plr
Member
**
Offline Offline

Activity: 602
Merit: 15


View Profile
April 30, 2018, 04:09:44 AM
 #14

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.
hushan
Jr. Member
*
Offline Offline

Activity: 57
Merit: 9


View Profile
May 03, 2018, 07:40:25 AM
 #15

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.

BTC: 38ykUxZeSv5aqav1keCc4KUxXLPPGkfrm5 LTC: MPpWNvqDCVB1PHJt4A28j9oFfc6Y1KKDno ETH: 0x07C8c68d5253247038947EF9495b054160c8737c
haoqian
Newbie
*
Offline Offline

Activity: 20
Merit: 0


View Profile
May 03, 2018, 09:25:01 AM
 #16

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.
hushan
Jr. Member
*
Offline Offline

Activity: 57
Merit: 9


View Profile
May 03, 2018, 01:02:46 PM
 #17

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.

BTC: 38ykUxZeSv5aqav1keCc4KUxXLPPGkfrm5 LTC: MPpWNvqDCVB1PHJt4A28j9oFfc6Y1KKDno ETH: 0x07C8c68d5253247038947EF9495b054160c8737c
haoqian
Newbie
*
Offline Offline

Activity: 20
Merit: 0


View Profile
May 03, 2018, 02:26:22 PM
 #18

Thank you for your reply.

I do generate my own genesis block. It seems that it is just keeping downloading.
hushan
Jr. Member
*
Offline Offline

Activity: 57
Merit: 9


View Profile
May 04, 2018, 12:29:09 AM
 #19

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.

BTC: 38ykUxZeSv5aqav1keCc4KUxXLPPGkfrm5 LTC: MPpWNvqDCVB1PHJt4A28j9oFfc6Y1KKDno ETH: 0x07C8c68d5253247038947EF9495b054160c8737c
haoqian
Newbie
*
Offline Offline

Activity: 20
Merit: 0


View Profile
May 04, 2018, 01:04:34 PM
 #20

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...
Pages: [1] 2 3 4 5 »  All
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!