<p>I've cloned litecoin 0.21, trying to create a new coin. It was running well <strong>until block 1439</strong>. Then, miners stopped working because <code>getblocktemplate</code> was returning this:</p>
<pre><code>CreateNewBlock: TestBlockValidity failed: bad-txns-vin-empty, Transaction check failed (tx hash 7f77894ebcb3xxxx) 
</code></pre>
<p>In code, it's like this:</p>
<pre><code>if (!tx.IsMWEBOnly()) {
   if (tx.vin.empty())
      return state.Invalid(TxValidationResult::TX_CONSENSUS, &quot;bad-txns-vin-empty&quot;);
</code></pre>
<p>I was unable to find the related transaction with getrawtransaction on a node with <code>-txindex</code>. Then I modified code to skip the <code>tx.vin.empty</code> check. <code>getblocktemplate</code> worked, I was able to mine but other nodes rejected it naturally. After that I was able to get the raw transaction:</p>
<pre><code>{
  &quot;txid&quot;: &quot;7f77894ebcb37xxxx&quot;,
  &quot;hash&quot;: &quot;7f77894ebcb37xxxx&quot;,
  &quot;version&quot;: 2,
  &quot;size&quot;: 56,
  &quot;vsize&quot;: 53,
  &quot;weight&quot;: 212,
  &quot;locktime&quot;: 0,
  &quot;vin&quot;: [
  ],
  &quot;vout&quot;: [
    {
      &quot;ismweb&quot;: false,
      &quot;value&quot;: 0.00000000,
      &quot;n&quot;: 0,
      &quot;scriptPubKey&quot;: {
        &quot;asm&quot;: &quot;8 32a71ad39691052a88bxxxxxx&quot;,
        &quot;hex&quot;: &quot;582032a71ad39691052a88bxxxxx&quot;,
        &quot;type&quot;: &quot;witness_mweb_hogaddr&quot;
      }
    }
  ]
}
</code></pre>
<p>Decoding script gave following results:</p>
<pre><code>$ decodescript 582032a71ad39691052axxxxx

{
  &quot;asm&quot;: &quot;8 32a71ad3969105xxxxx&quot;,
  &quot;type&quot;: &quot;witness_mweb_hogaddr&quot;,
  &quot;p2sh&quot;: &quot;CeRHKxxxxx&quot;
}


$ decodescript 32a71ad39691052a88bfeb9fxxxxx

{
  &quot;asm&quot;: &quot;[error]&quot;,
  &quot;type&quot;: &quot;nonstandard&quot;,
  &quot;p2sh&quot;: &quot;CaiSWTDxxxxx&quot;,
  &quot;segwit&quot;: {
    &quot;asm&quot;: &quot;0 c0ce9f7xxxxxxxxx&quot;,
    &quot;hex&quot;: &quot;0020c0cexxxxxxxx&quot;,
    &quot;reqSigs&quot;: 1,
    &quot;type&quot;: &quot;witness_v0_scripthash&quot;,
    &quot;addresses&quot;: [
      &quot;mycoin1qcr8f7ut3gsy022rruydxxxxxxxxx&quot;
    ],
    &quot;p2sh-segwit&quot;: &quot;CcDNqxxxxxxxx&quot;
  }
}
</code></pre>
<p>Transaction vout says <code>&quot;ismweb&quot;: false</code> but vin is empty and pubkey is <code>witness_mweb_hogaddr</code>, meaning it should be <code>true</code> instead?</p>
<p>Could this be a bug? How should I approach this issue? My best guess is editing <code>chainparams.cpp</code> and editing mweb activation caused this issue:</p>
<pre><code>consensus.vDeployments[Consensus::DEPLOYMENT_MWEB].bit = 4;
consensus.vDeployments[Consensus::DEPLOYMENT_MWEB].nStartHeight = 0;
consensus.vDeployments[Consensus::DEPLOYMENT_MWEB].nTimeoutHeight = 0;
</code></pre>
<p>Oh also, I'm getting this when sending a tx:</p>
<pre><code>$ createrawtransaction &quot;[{\&quot;txid\&quot;:\&quot;83e01378c82fe86a0cebb8ad063764xxxxxxx\&quot;,\&quot;vout\&quot;:0}]&quot; &quot;[{\&quot;mycoin1qjqmp2rssgkp5gdexxxxx\&quot;:100.5}]&quot;

0200000001d67e79dd60e5dexxxxxxx


$ signrawtransactionwithwallet 0200000001d67e79dd60e5ded6xxxxxxx

Missing amount for CTxOut(nValue=100000000.00000000, scriptPubKey=0014cb0c40a27192xxxx) (code -3)


$ decodescript 0014cb0c40a27xxxx
￼
{
  &quot;asm&quot;: &quot;0 [error]&quot;,
  &quot;type&quot;: &quot;nonstandard&quot;,
  &quot;p2sh&quot;: &quot;CNaVj7QRiXN5TYxxxxx&quot;,
  &quot;segwit&quot;: {
    &quot;asm&quot;: &quot;0 23e055958bec23xxxxxxxx&quot;,
    &quot;hex&quot;: &quot;002023e055958bxxxxxxxxx&quot;,
    &quot;reqSigs&quot;: 1,
    &quot;type&quot;: &quot;witness_v0_scripthash&quot;,
    &quot;addresses&quot;: [
      &quot;mycoin1qy0s9t9vtas3hycvufadz6a9e4lxxxxx&quot;
    ],
    &quot;p2sh-segwit&quot;: &quot;CSaK1duFt2Fxxxxx&quot;
  }
}

</code></pre>
<p>Note that I've tried with 99,999,999 coins (input minus 1 coin) and still getting the same issue so it's not about the huge fee.</p>
<p>And IDK if it's relevant, but some more configurations here from <code>chainparams.cpp</code>:</p>
<pre><code>consensus.nSubsidyHalvingInterval = 840000;
consensus.BIP16Height = 0;
consensus.BIP34Height = 0;
consensus.BIP34Hash = uint256S(&quot;0xfa09d204a83a7xxxxxxxx&quot;);
consensus.BIP65Height = 0;
consensus.BIP66Height = 0;
consensus.CSVHeight = 0;
consensus.SegwitHeight = 0;
consensus.MinBIP9WarningHeight = 0; // segwit activation height + miner confirmation window
consensus.powLimit = uint256S(&quot;00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff&quot;);
consensus.nPowTargetTimespan = 3 * 60 * 60; // 3hrs
consensus.nPowTargetSpacing = 1.5 * 60;
consensus.fPowAllowMinDifficultyBlocks = false;
consensus.fPowNoRetargeting = false;
consensus.nRuleChangeActivationThreshold = 6048; // 75% of 8064
consensus.nMinerConfirmationWindow = 480; // nPowTargetTimespan / nPowTargetSpacing * 4
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28;
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = Consensus::BIP9Deployment::NEVER_ACTIVE;
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;
</code></pre>
<p>Really appreciate the help!</p>

CC BY-SA 4.0
2022-09-08T17:13:46.353Z
apparently it's getting stuck at `nMinerConfirmationWindow * 3`th block. I tried setting DEPLOYMENT_MWEB start height NEVER_ACTIVE but it was still being active. So I just put 99999999 instead and it works now, as a workaround..
Cagri
CC BY-SA 4.0
2022-09-08T19:01:28.963Z
Hi Cagri, I'm voting to close your topic as questions about cryptocurrencies other than Bitcoin and topics concerning the development of altcoins are not on-topic on Bitcoin Stack Exchange.
Murch
<bip><mweb>
Cloned litecoin - mweb issue, "bad-txns-vin-empty", getblocktemplate isn't working
Cagri
# Cloned litecoin - mweb issue, "bad-txns-vin-empty", getblocktemplate isn't working

(Asked by: username_0 on 2022-09-08)

I've cloned litecoin 0.21, trying to create a new coin. It was running well **until block 1439**. Then, miners stopped working because `getblocktemplate` was returning this:

```
CreateNewBlock: TestBlockValidity failed: bad-txns-vin-empty, Transaction check failed (tx hash 7f77894ebcb3xxxx) 

```

In code, it's like this:

```
if (!tx.IsMWEBOnly()) {
   if (tx.vin.empty())
      return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-txns-vin-empty");

```

I was unable to find the related transaction with getrawtransaction on a node with `-txindex`. Then I modified code to skip the `tx.vin.empty` check. `getblocktemplate` worked, I was able to mine but other nodes rejected it naturally. After that I was able to get the raw transaction:

```
{
  "txid": "7f77894ebcb37xxxx",
  "hash": "7f77894ebcb37xxxx",
  "version": 2,
  "size": 56,
  "vsize": 53,
  "weight": 212,
  "locktime": 0,
  "vin": [
  ],
  "vout": [
    {
      "ismweb": false,
      "value": 0.00000000,
      "n": 0,
      "scriptPubKey": {
        "asm": "8 32a71ad39691052a88bxxxxxx",
        "hex": "582032a71ad39691052a88bxxxxx",
        "type": "witness_mweb_hogaddr"
      }
    }
  ]
}

```

Decoding script gave following results:

```
$ decodescript 582032a71ad39691052axxxxx

{
  "asm": "8 32a71ad3969105xxxxx",
  "type": "witness_mweb_hogaddr",
  "p2sh": "CeRHKxxxxx"
}

$ decodescript 32a71ad39691052a88bfeb9fxxxxx

{
  "asm": "[error]",
  "type": "nonstandard",
  "p2sh": "CaiSWTDxxxxx",
  "segwit": {
    "asm": "0 c0ce9f7xxxxxxxxx",
    "hex": "0020c0cexxxxxxxx",
    "reqSigs": 1,
    "type": "witness_v0_scripthash",
    "addresses": [
      "mycoin1qcr8f7ut3gsy022rruydxxxxxxxxx"
    ],
    "p2sh-segwit": "CcDNqxxxxxxxx"
  }
}

```

Transaction vout says `"ismweb": false` but vin is empty and pubkey is `witness_mweb_hogaddr`, meaning it should be `true` instead?

Could this be a bug? How should I approach this issue? My best guess is editing `chainparams.cpp` and editing mweb activation caused this issue:

```
consensus.vDeployments[Consensus::DEPLOYMENT_MWEB].bit = 4;
consensus.vDeployments[Consensus::DEPLOYMENT_MWEB].nStartHeight = 0;
consensus.vDeployments[Consensus::DEPLOYMENT_MWEB].nTimeoutHeight = 0;

```

Oh also, I'm getting this when sending a tx:

```
$ createrawtransaction "[{\"txid\":\"83e01378c82fe86a0cebb8ad063764xxxxxxx\",\"vout\":0}]" "[{\"mycoin1qjqmp2rssgkp5gdexxxxx\":100.5}]"

0200000001d67e79dd60e5dexxxxxxx

$ signrawtransactionwithwallet 0200000001d67e79dd60e5ded6xxxxxxx

Missing amount for CTxOut(nValue=100000000.00000000, scriptPubKey=0014cb0c40a27192xxxx) (code -3)

$ decodescript 0014cb0c40a27xxxx
￼
{
  "asm": "0 [error]",
  "type": "nonstandard",
  "p2sh": "CNaVj7QRiXN5TYxxxxx",
  "segwit": {
    "asm": "0 23e055958bec23xxxxxxxx",
    "hex": "002023e055958bxxxxxxxxx",
    "reqSigs": 1,
    "type": "witness_v0_scripthash",
    "addresses": [
      "mycoin1qy0s9t9vtas3hycvufadz6a9e4lxxxxx"
    ],
    "p2sh-segwit": "CSaK1duFt2Fxxxxx"
  }
}

```

Note that I've tried with 99,999,999 coins (input minus 1 coin) and still getting the same issue so it's not about the huge fee.

And IDK if it's relevant, but some more configurations here from `chainparams.cpp`:

```
consensus.nSubsidyHalvingInterval = 840000;
consensus.BIP16Height = 0;
consensus.BIP34Height = 0;
consensus.BIP34Hash = uint256S("0xfa09d204a83a7xxxxxxxx");
consensus.BIP65Height = 0;
consensus.BIP66Height = 0;
consensus.CSVHeight = 0;
consensus.SegwitHeight = 0;
consensus.MinBIP9WarningHeight = 0; // segwit activation height + miner confirmation window
consensus.powLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
consensus.nPowTargetTimespan = 3 * 60 * 60; // 3hrs
consensus.nPowTargetSpacing = 1.5 * 60;
consensus.fPowAllowMinDifficultyBlocks = false;
consensus.fPowNoRetargeting = false;
consensus.nRuleChangeActivationThreshold = 6048; // 75% of 8064
consensus.nMinerConfirmationWindow = 480; // nPowTargetTimespan / nPowTargetSpacing * 4
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28;
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = Consensus::BIP9Deployment::NEVER_ACTIVE;
consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;

```

Really appreciate the help!

**Tags:** bip, mweb

> **Comments:**
> **username_0**: apparently it's getting stuck at `nMinerConfirmationWindow * 3`th block. I tried setting DEPLOYMENT_MWEB start height NEVER_ACTIVE but it was still being active. So I just put 99999999 instead and it works now, as a workaround..  
> **username_1**: Hi username_0, I'm voting to close your topic as questions about cryptocurrencies other than Bitcoin and topics concerning the development of altcoins are not on-topic on Bitcoin Stack Exchange.  

---

## 0 answers

