Bitcoin Forum
May 08, 2024, 07:12:38 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: bitcoin fork on private network - transaction stucks in mempool  (Read 138 times)
fietepfennig (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
April 27, 2018, 03:06:33 PM
 #1

Hi everybody,
 
I have forked the bitcoin code (v0.16.99.0-9bedf07f3-dirty), modified the genesis block and wrote some lines of code to calcuate nonce / hash / etc of the genesis block .. see code below

I have a private network running 5 nodes and I mined several blocks using cpuminer in order to get some money. Everthing worked fine and i was a "rich kid" after a few minutes.  Grin

Moreover, i have written some python code to store values in OP_RETURN in the blockchain using the bitcoind REST API and everything seems to work fine and the transaction is visible in the mempool on all nodes.

Eventually, I use cpuminer again and while it mines block after block devotedly, the transaction remains unconfirmed in the mempool. This is also the case for transactions which I have sent with bitcoin-cli sendtoaddress .....


Any ideas ?

Thanks

Thomas


bitcoin-cli getrawtransaction 86b9ac32b8816ce3fe105ff1491b7e5d4be4a4c45905e4f153c923a3699f35c0 1
{
  "txid": "86b9ac32b8816ce3fe105ff1491b7e5d4be4a4c45905e4f153c923a3699f35c0",
  "hash": "ce8437bb9ff1d3aa5a675cd34925a5cc093c305f477e82002d3e8c1584b0e1ef",
  "version": 2,
  "size": 266,
  "vsize": 185,
  "locktime": 0,
  "vin": [
    {
      "txid": "b5c945322f0ba2151ac2b095cd4e37fcd943a24ed7c427b4cd0b373643df68db",
      "vout": 0,
      "scriptSig": {
        "asm": "00145927bb374bf9d14a3ec8555a3b8ed010709bae1e",
        "hex": "1600145927bb374bf9d14a3ec8555a3b8ed010709bae1e"
      },
      "txinwitness": [
        "304402207c42f52046d0c756f95b688d10b392e40b1c2f1e44ced2c5c2bd9811f56fde520220637 78db537f7d9ca4cd328c02749846e53bd3241921ab0aa66cccf5de431658201",
        "035a59ca6537235b60c84f227c8b341dca7e476ed59c5b499a2f244cb57b69730c"
      ],
      "sequence": 4294967295
    }
  ],
  "vout": [
    {
      "value": 0.31400000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_HASH160 b80626c22e26a5401c98925f1f120be4a7589e6d OP_EQUAL",
        "hex": "a914b80626c22e26a5401c98925f1f120be4a7589e6d87",
        "reqSigs": 1,
        "type": "scripthash",
        "addresses": [
          "3JU3dFJL9hJkiMcMtPHAAHRTRBtde532o7"
        ]
      }
    },
    {
      "value": 49.58600000,
      "n": 1,
      "scriptPubKey": {
        "asm": "OP_HASH160 4086a7b517483719a876d68857d85285cb2762c6 OP_EQUAL",
        "hex": "a9144086a7b517483719a876d68857d85285cb2762c687",
        "reqSigs": 1,
        "type": "scripthash",
        "addresses": [
          "37aCUpcdy56sD8mb78rCHjX9x6mX2ts1dx"
        ]
      }
    },
    {
      "value": 0.00000000,
      "n": 2,
      "scriptPubKey": {
        "asm": "OP_RETURN 3131313131313131",
        "hex": "6a083131313131313131",
        "type": "nulldata"
      }
    }
  ],
  "hex": "02000000000101db68df4336370bcdb427c4d74ea243d9fc374ecd95b0c21a15a20b2f3245c9b50 0000000171600145927bb374bf9d14a3ec8555a3b8ed010709bae1effffffff034020df01000000 0017a914b80626c22e26a5401c98925f1f120be4a7589e6d87403b8e270100000017a9144086a7b 517483719a876d68857d85285cb2762c68700000000000000000a6a083131313131313131024730 4402207c42f52046d0c756f95b688d10b392e40b1c2f1e44ced2c5c2bd9811f56fde52022063778 db537f7d9ca4cd328c02749846e53bd3241921ab0aa66cccf5de43165820121035a59ca6537235b 60c84f227c8b341dca7e476ed59c5b499a2f244cb57b69730c00000000"
}

$bicoin-cli listtransactions

{
    "account": "",
    "address": "3JU3dFJL9hJkiMcMtPHAAHRTRBtde532o7",
    "category": "send",
    "amount": -0.31400000,
    "label": "legacy",
    "vout": 0,
    "fee": -0.10000000,
    "confirmations": 0,
    "trusted": true,
    "txid": "86b9ac32b8816ce3fe105ff1491b7e5d4be4a4c45905e4f153c923a3699f35c0",
    "walletconflicts": [
    ],
    "time": 1524838528,
    "timereceived": 1524838528,
    "bip125-replaceable": "no",
    "abandoned": false
  }



class CMainParams : public CChainParams {
public:
    CMainParams() {
        strNetworkID = "main";
        consensus.nSubsidyHalvingInterval = 210000;
        consensus.BIP16Height = 514; // 00000000040b4e986385315e14bee30ad876d8b47f748025b26683116d21aa65
        consensus.BIP34Height = 21111;
        consensus.BIP34Hash = uint256S("0x0000000023b3a96d3484e5abb3755c413e7d41500f8e2a5c3f0dd01299cd8ef8");
        consensus.BIP65Height = 581885; // 00000000007f6655f22f98e72ed80d8b06dc761d5da09df0fa1dc4be4f861eb6
        consensus.BIP66Height = 330776; // 000000002104c8c45e99a8853285a3b592602a3ccde2b832481da85e9e4ba182
        consensus.powLimit = uint256S("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
        consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
        consensus.nPowTargetSpacing = 1;
        consensus.fPowAllowMinDifficultyBlocks = false;
        consensus.fPowNoRetargeting = false;
        consensus.nRuleChangeActivationThreshold = 1512; // 75% for testchains
        consensus.nMinerConfirmationWindow = 2016; // nPowTargetTimespan / nPowTargetSpacing
        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 = 2456790400; // March 1st, 2016
        consensus.vDeployments[Consensus::DEPLOYMENT_CSV].nTimeout = 2493596800; // May 1st, 2017

        // Deployment of SegWit (BIP141, BIP143, and BIP147)
        consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].bit = 1;
        consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nStartTime = 2462060800; // May 1st 2016
        consensus.vDeployments[Consensus::DEPLOYMENT_SEGWIT].nTimeout = 2493596800; // May 1st 2017

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

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

        pchMessageStart[0] = 0x0c;
        pchMessageStart[1] = 0x12;
        pchMessageStart[2] = 0x08;
        pchMessageStart[3] = 0x06;
        nDefaultPort = 18443;
        nPruneAfterHeight = 1000;

        genesis = CreateGenesisBlock(1524572463, 5720405,0x1e0ffff0 , 1, 50 * COIN);
        consensus.hashGenesisBlock = genesis.GetHash();

        CBlock block = genesis;

        if (true )
        {
            uint256 hashTarget = ArithToUint256(arith_uint256().SetCompact(block.nBits));
            uint256 thash;

            while(true)
            {
                thash = block.GetHash();
                if (UintToArith256(thash) < UintToArith256(hashTarget))
                    break;
                ++block.nNonce;
            }
            printf("block.nTime = %u \n", block.nTime);
            printf("block.nNonce = %u \n", block.nNonce);
            printf("block.GetHash = %s\n", block.GetHash().ToString().c_str());

        }


        assert(consensus.hashGenesisBlock == uint256S("000007ceb735550638da8aa16d5c525cf278eddf422c7ed6b7f13bca16c1e4e7"));
        printf("block.Merkle = %s\n", block.hashMerkleRoot.ToString().c_str());
        assert(genesis.hashMerkleRoot == uint256S("13ffe96e5900022b549093047981de317ec3010c7c4a0c7aa8f0306fe9517f13"));

        // Note that of those which support the service bits prefix, most only support a subset of
        // possible options.
        // This is fine at runtime as we'll fall back to using them as a oneshot if they don't support the
        // service bits we want, but we should get them updated to support all service bits wanted by any
        // release ASAP to avoid it where possible.
        vSeeds.emplace_back("CENSORED");
        vSeeds.emplace_back("CENSORED");
        vSeeds.emplace_back("CENSORED");
        vSeeds.emplace_back("CENSORED");
        vSeeds.emplace_back("CENSORED");

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

        bech32_hrp = "bc";

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

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

        checkpointData = {
            {
                {122, uint256S("00000a8def55f5dab450e69938224ba8d52af72370b7500e100a13b59e3bdd09")},
            }
        };

        chainTxData = ChainTxData{
        };

        /* disable fallback fee on mainnet */
        m_fallback_fee_enabled = false;
    }
};
1715152358
Hero Member
*
Offline Offline

Posts: 1715152358

View Profile Personal Message (Offline)

Ignore
1715152358
Reply with quote  #2

1715152358
Report to moderator
1715152358
Hero Member
*
Offline Offline

Posts: 1715152358

View Profile Personal Message (Offline)

Ignore
1715152358
Reply with quote  #2

1715152358
Report to moderator
"With e-currency based on cryptographic proof, without the need to trust a third party middleman, money can be secure and transactions effortless." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
aleksej996
Sr. Member
****
Offline Offline

Activity: 490
Merit: 389


Do not trust the government


View Profile
April 27, 2018, 03:18:34 PM
 #2

I have no idea, but maybe Segwit softfork was never activated on your network, due to lower number of blocks.
This is maybe causing your transactions to be valid, since segwit is a softfork and your Segwit supporting nodes will relay it normally and keep it in a mempool.
However, when it comes to putting them in a block, maybe the node waits until segwit is activated, before that these just might be considered non-standard transactions on the non-segwit chain.

It is just a theory though.
fietepfennig (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
April 27, 2018, 03:45:43 PM
 #3

I have no idea, but maybe Segwit softfork was never activated on your network, due to lower number of blocks.
This is maybe causing your transactions to be valid, since segwit is a softfork and your Segwit supporting nodes will relay it normally and keep it in a mempool.
However, when it comes to putting them in a block, maybe the node waits until segwit is activated, before that these just might be considered non-standard transactions on the non-segwit chain.

It is just a theory though.


You were right, With "legacy" addresses it works like a charm ....  Thank you so much.

Thomas
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!