Blockchain

山寨幣節點連接問題

  • February 24, 2018

我為了好玩而複製了萊特幣,但我正在努力連接到節點。我已經生成了創世塊並且編譯一切正常。

我在本地 Macosx 和 amazon vps 上執行了兩個 litecoin 守護程序,但我似乎無法連接兩者。我在埠 26201 上執行主網

我嘗試執行 ./litecoind -daemon -addnode=xyyy 但它不起作用。

鏈參數.cpp

class CMainParams : public CChainParams {
public:
   CMainParams() {
       strNetworkID = "main";
       consensus.nSubsidyHalvingInterval = 100000;
       consensus.BIP34Height = 710000;
       consensus.BIP34Hash = uint256S("e6024058338254100b68f794f3a5d14f9b9a7f0bfb68bf302d63c47c027b64ca");
       consensus.BIP65Height = 918684; // bab3041e8977e0dc3eeff63fe707b92bde1dd449d8efafb248c27c8264cc311a
       consensus.BIP66Height = 811879; // 7aceee012833fa8952f8835d8b1b3ae233cd6ab08fdb27a771d2bd7bdc491894
       consensus.powLimit = uint256S("e6024058338254100b68f794f3a5d14f9b9a7f0bfb68bf302d63c47c027b64ca"); 
       consensus.nPowTargetTimespan = 3.5 * 24 * 60 * 60; // 3.5 days
       consensus.nPowTargetSpacing = 2.5 * 60;
       consensus.fPowAllowMinDifficultyBlocks = false;
       consensus.fPowNoRetargeting = false;
       consensus.nRuleChangeActivationThreshold = 6048; // 75% of 8064
       consensus.nMinerConfirmationWindow = 8064; // nPowTargetTimespan / nPowTargetSpacing * 4
       consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28;
       consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 1199145601; // January 1, 2008
       consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = 1230767999; // December 31, 2008

       // Deployment of BIP68, BIP112, and BIP113.
       consensus.vDeployments[Consensus::DEPLOYMENT_CSV].bit = 0;
       consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nStartTime = 1485561600; // January 28, 2017
       consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = 1517356801; // January 31st, 2018

       // Deployment of SegWit (BIP141, BIP143, and BIP147)
       consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].bit = 1;
       consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nStartTime = 1485561600; // January 28, 2017
       consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nTimeout = 1517356801; // January 31st, 2018

       // The best chain should have at least this much work.
       consensus.nMinimumChainWork = uint256S("0x0000000000000000000000000000000000000000000000000000000000400040");

       // By default assume that the signatures in ancestors of this block are valid.
       consensus.defaultAssumeValid = uint256S("0x3095c904a9907471390b80730bb760b28754501006cd7fe8ea0943dd71796c51"); //1353397

       /**
        * The message start string is designed to be unlikely to occur in normal data.
        * The characters are rarely used upper ASCII, not valid as UTF-8, and produce
        * a large 32-bit integer with any alignment.
        */
       pchMessageStart[0] = 0xfb;
       pchMessageStart[1] = 0xc0;
       pchMessageStart[2] = 0xb6;
       pchMessageStart[3] = 0xdb;
       nDefaultPort = 26201;
       nPruneAfterHeight = 100000;

       genesis = CreateGenesisBlock(1518803474, 4251767 , 0x1e0ffff0, 1, 1000 * COIN);
       consensus.hashGenesisBlock = genesis.GetHash();



       //printf("Genesis hash:  %s\n", consensus.hashGenesisBlock.ToString().c_str());
       //printf("Merkel root:  %s\n", genesis.hashMerkleRoot.ToString().c_str());


       assert(consensus.hashGenesisBlock == uint256S("0xe6024058338254100b68f794f3a5d14f9b9a7f0bfb68bf302d63c47c027b64ca"));
       assert(genesis.hashMerkleRoot == uint256S("0x29b1458191d86739ff3ef0f179c0927a95cb89fa054e3e2a41dfe843ee0acc42"));

       // Note that of those with the service bits flag, most only support a subset of possible options
       //vSeeds.emplace_back("dnsseed.citizenshipcoin.org", true);
       //vSeeds.emplace_back("dnsseed.thrasher.io", true);
       //vSeeds.emplace_back("dnsseed.litecointools.com", true);
       //vSeeds.emplace_back("dnsseed.litecoinpool.org", true);
       //vSeeds.emplace_back("dnsseed.koin-project.com", false);

       base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,11);
       base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,5);
       base58Prefixes[SCRIPT_ADDRESS2] = std::vector<unsigned char>(1,50);
       base58Prefixes[SECRET_KEY] =     std::vector<unsigned char>(1,176);
       base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x88, 0xB2, 0x1E};
       base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x88, 0xAD, 0xE4};

       vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_main, pnSeed6_main + ARRAYLEN(pnSeed6_main));

       fDefaultConsistencyChecks = false;
       fRequireStandard = true;
       fMineBlocksOnDemand = false;

       checkpointData = (CCheckpointData) {
           {
               { 1, uint256S("0xcbf5d62bd22c4bbd616bd59b2b634d2fa896a4192a5c24298b26e1d9454e8559")},
               { 3, uint256S("0x3095c904a9907471390b80730bb760b28754501006cd7fe8ea0943dd71796c51")},
               { 5, uint256S("0x11f32abdff3d58c27ebbf53ff1fbc15aabef8b5f7665fd84ba3ce1f368402798")},
          /*     { 23420, uint256S("0xd80fdf9ca81afd0bd2b2a90ac3a9fe547da58f2530ec874e978fce0b5101b507")},
               { 50000, uint256S("0x69dc37eb029b68f075a5012dcc0419c127672adb4f3a32882b2b3e71d07a20a6")},
               { 80000, uint256S("0x4fcb7c02f676a300503f49c764a89955a8f920b46a8cbecb4867182ecdb2e90a")},
               {120000, uint256S("0xbd9d26924f05f6daa7f0155f32828ec89e8e29cee9e7121b026a7a3552ac6131")},
               {161500, uint256S("0xdbe89880474f4bb4f75c227c77ba1cdc024991123b28b8418dbbf7798471ff43")},
               {179620, uint256S("0x2ad9c65c990ac00426d18e446e0fd7be2ffa69e9a7dcb28358a50b2b78b9f709")},
               {240000, uint256S("0x7140d1c4b4c2157ca217ee7636f24c9c73db39c4590c4e6eab2e3ea1555088aa")},
               {383640, uint256S("0x2b6809f094a9215bafc65eb3f110a35127a34be94b7d0590a096c3f126c6f364")},
               {409004, uint256S("0x487518d663d9f1fa08611d9395ad74d982b667fbdc0e77e9cf39b4f1355908a3")},
               {456000, uint256S("0xbf34f71cc6366cd487930d06be22f897e34ca6a40501ac7d401be32456372004")},
               {638902, uint256S("0x15238656e8ec63d28de29a8c75fcf3a5819afc953dcd9cc45cecc53baec74f38")},
               {721000, uint256S("0x198a7b4de1df9478e2463bd99d75b714eab235a2e63e741641dc8a759a9840e5")}, */
           }
       };

       chainTxData = ChainTxData{
           // Data as of block 59c9b9d3fec105bdc716d84caa7579503d5b05b73618d0bf2d5fa639f780a011 (height 1353397).
           1516406833, // * UNIX timestamp of last known number of transactions
           19831879,  // * total number of transactions between genesis and that timestamp
                   //   (the tx=... number in the SetBestChain debug.log lines)
           0.06     // * estimated number of transactions per second after that timestamp
       };

鏈參數種子.h

#ifndef BITCOIN_CHAINPARAMSSEEDS_H
#define BITCOIN_CHAINPARAMSSEEDS_H
/**
* List of fixed seed nodes for the litecoin network
* AUTOGENERATED by contrib/seeds/generate-seeds.py
*
* Each line contains a 16-byte IPv6 address and a port.
* IPv4 as well as onion addresses are wrapped inside a IPv6 address accordingly.
*/
static SeedSpec6 pnSeed6_main[] = {
  // {{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x0d,0x3b,0xbd,0x0b}, 26201}
};

static SeedSpec6 pnSeed6_test[] = {
   //{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x0d,0x3b,0xbd,0x0b}, 26202}
};
#endif // BITCOIN_CHAINPARAMSSEEDS_H

litecoin.conf (macosx)

rpcuser=litecoinrpc
rpcpassword=xxxx
addnode=xx.xx.xx.xx:26201

我的 vps 節點上沒有 litecoin.conf。

debug.log (macosx)

2018-02-23 17:07:18 0 addresses found from DNS seeds
2018-02-23 17:07:18 dnsseed thread exit
2018-02-23 17:08:19 socket recv error Connection reset by peer (54)
2018-02-23 17:08:19 Adding fixed seed nodes as DNS doesn't seem to be available.
2018-02-23 17:09:19 socket recv error Connection reset by peer (54)
2018-02-23 17:10:20 socket recv error Connection reset by peer (54)
2018-02-23 17:11:20 socket recv error Connection reset by peer (54)
2018-02-23 17:13:22 socket recv error Connection reset by peer (54)
2018-02-23 17:15:23 socket recv error Connection reset by peer (54)

debug.log (vps) 我的 vps 上的 debug.log 顯示了這個(很多行)以及循環的埠號。

2018-02-23 17:09:19 connection from x.x.x.x:55668 dropped (banned)
2018-02-23 17:09:19 connected to self at y.y.y.y:49226, disconnecting

我知道 xxxx 是我的 macosx ip,yyyy 是本地 vps 伺服器公共 ip 地址。

為什麼無法連接到節點?

查看 debug.log 為什麼 IP 循環通過超過 55,000 個不同的埠而不是連接到它應該連接的 26201?

2018-02-23 17:09:19 connection from x.x.x.x:55668 dropped (banned)

查看您在問題中發布的內容,您的節點因被禁止而被刪除。

您需要為初學者清除您的禁令列表,並可能從日誌中找出它被禁止的原因。

查看 debug.log 為什麼 IP 循環通過超過 55,000 個不同的埠而不是連接到它應該連接的 26201?

超過 55,000 的埠是來自埠,因為您在日誌中看到連接嘗試,因此埠是 26201,假設您已按照描述正確配置了所有內容。

引用自:https://bitcoin.stackexchange.com/questions/71339