<p>I am not 100% sure, if this also applies to Litecoin, as it is a clone of Bitcoin. But I understand the signature scheme is the same... So it should be possible to use openssl or any ECDSA library to check the signature. Therefor the double sea of the unsigned tx must be created, as per these steps by <a href="https://bitcoin.stackexchange.com/questions/32305/how-does-the-ecdsa-verification-algorithm-work-during-transaction">amaclin's answer</a>:</p>

<blockquote>
  <p>1) Remove input script from transaction </p>
  
  <p>2) Replace it with the previous TX's pubkeyscript </p>
  
  <p>3) Append SIGHASH_ALL </p>
  
  <p>4) Hash it twice with SHA256</p>
</blockquote>

<p>I try to replay it, and get these values:</p>

<pre><code>sig:         3045022100ac91b8da716668553088da2da32c596a03973fffcbc36d2a7f3ecb8e93c3de07022040b7015c065e74d6f5fc30c9458c0631ddfb2d72feae3bb699c6ce835cd0ba54 
pubkey:      02d41b76393d5f82b1856343623974684ff2bf03b26ec6bc2d0391ae0768cd9ebd 
double hash: c54fa81808f1feef80298f232f00b42fa5d548b964d580026799b1bf5f431529
</code></pre>

<p>This returns an error in signature verification. This can have several root causes... You said, "after adjusting fee's and other network variables": the fees are related to the amounts in the output structure, and they are signed. At anytime something of the signed tx is changed, invalidates the signature. This might be the root cause ...
Can we see the unsigned transaction?</p>

CC BY-SA 3.0
2018-04-17T10:00:25.310Z
2018-04-17T10:00:25.310Z
pebwindkraft
<p>I have manually a raw transaction using <a href="https://github.com/ofek/bit" rel="nofollow noreferrer">bit library</a> in order to send a transaction using Litecoin testnet. After adjusting fee's and other network variables I got the following error that is stated in the subject of the post. This transaction isn't a multisignature one. This is the hex value of the raw transaction </p>

<pre><code>0100000001d0e0112dd6bf2b44c44895d5363f2d2b940d4aff8d7fc2852a4c751e90200a5e000000006b483045022100ac91b8da716668553088da2da32c596a03973fffcbc36d2a7f3ecb8e93c3de07022040b7015c065e74d6f5fc30c9458c0631ddfb2d72feae3bb699c6ce835cd0ba54012102d41b76393d5f82b1856343623974684ff2bf03b26ec6bc2d0391ae0768cd9ebdffffffff0200286bee000000001976a914df918d7a0efe546d0284e217a3a322bb09f37f3988acb0a69a3b000000001976a914f2ebf3c5642abf069b4197a08e116937503d13e488ac00000000
</code></pre>

<p>After decoding this hex, this is the output:</p>

<pre><code>{
  "txid": "2915435fbfb199670280d564b948d5a52fb4002f238f2980effef10818a84fc5",
  "hash": "2915435fbfb199670280d564b948d5a52fb4002f238f2980effef10818a84fc5",
  "version": 1,
  "size": 226,
  "vsize": 226,
  "locktime": 0,
  "vin": [
    {
      "txid": "5e0a20901e754c2a85c27f8dff4a0d942b2d3f36d59548c4442bbfd62d11e0d0",
      "vout": 0,
      "scriptSig": {
        "asm": "3045022100ac91b8da716668553088da2da32c596a03973fffcbc36d2a7f3ecb8e93c3de07022040b7015c065e74d6f5fc30c9458c0631ddfb2d72feae3bb699c6ce835cd0ba54[ALL] 02d41b76393d5f82b1856343623974684ff2bf03b26ec6bc2d0391ae0768cd9ebd",
        "hex": "483045022100ac91b8da716668553088da2da32c596a03973fffcbc36d2a7f3ecb8e93c3de07022040b7015c065e74d6f5fc30c9458c0631ddfb2d72feae3bb699c6ce835cd0ba54012102d41b76393d5f82b1856343623974684ff2bf03b26ec6bc2d0391ae0768cd9ebd"
      },
      "sequence": 4294967295
    }
  ],
  "vout": [
    {
      "value": 40.00000000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 df918d7a0efe546d0284e217a3a322bb09f37f39 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914df918d7a0efe546d0284e217a3a322bb09f37f3988ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "n1u5M1NRi1VGDrAQujjzaRhRsfWBtvsVLA"
        ]
      }
    }, 
    {
      "value": 9.99990960,
      "n": 1,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 f2ebf3c5642abf069b4197a08e116937503d13e4 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914f2ebf3c5642abf069b4197a08e116937503d13e488ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "n3fQUj2SSLcuAQjeL97WWuLm3n5DvjNYA8"
        ]
      }
    }
  ]
}
</code></pre>

<p>Thank you in advance! :)</p>

<transactions><transaction-fees><litecoin><raw-transaction>
Litecoin - mandatory-script-verify-flag-failed (Signature must be zero for failed CHECK(MULTI)SIG operation)
Micic
# Litecoin - mandatory-script-verify-flag-failed (Signature must be zero for failed CHECK(MULTI)SIG operation)

(Asked by: username_0 on 2018-04-10)

I have manually a raw transaction using [bit library](https://github.com/ofek/bit) in order to send a transaction using Litecoin testnet. After adjusting fee's and other network variables I got the following error that is stated in the subject of the post. This transaction isn't a multisignature one. This is the hex value of the raw transaction

```
0100000001d0e0112dd6bf2b44c44895d5363f2d2b940d4aff8d7fc2852a4c751e90200a5e000000006b483045022100ac91b8da716668553088da2da32c596a03973fffcbc36d2a7f3ecb8e93c3de07022040b7015c065e74d6f5fc30c9458c0631ddfb2d72feae3bb699c6ce835cd0ba54012102d41b76393d5f82b1856343623974684ff2bf03b26ec6bc2d0391ae0768cd9ebdffffffff0200286bee000000001976a914df918d7a0efe546d0284e217a3a322bb09f37f3988acb0a69a3b000000001976a914f2ebf3c5642abf069b4197a08e116937503d13e488ac00000000

```

After decoding this hex, this is the output:

```
{
  "txid": "2915435fbfb199670280d564b948d5a52fb4002f238f2980effef10818a84fc5",
  "hash": "2915435fbfb199670280d564b948d5a52fb4002f238f2980effef10818a84fc5",
  "version": 1,
  "size": 226,
  "vsize": 226,
  "locktime": 0,
  "vin": [
    {
      "txid": "5e0a20901e754c2a85c27f8dff4a0d942b2d3f36d59548c4442bbfd62d11e0d0",
      "vout": 0,
      "scriptSig": {
        "asm": "3045022100ac91b8da716668553088da2da32c596a03973fffcbc36d2a7f3ecb8e93c3de07022040b7015c065e74d6f5fc30c9458c0631ddfb2d72feae3bb699c6ce835cd0ba54[ALL] 02d41b76393d5f82b1856343623974684ff2bf03b26ec6bc2d0391ae0768cd9ebd",
        "hex": "483045022100ac91b8da716668553088da2da32c596a03973fffcbc36d2a7f3ecb8e93c3de07022040b7015c065e74d6f5fc30c9458c0631ddfb2d72feae3bb699c6ce835cd0ba54012102d41b76393d5f82b1856343623974684ff2bf03b26ec6bc2d0391ae0768cd9ebd"
      },
      "sequence": 4294967295
    }
  ],
  "vout": [
    {
      "value": 40.00000000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 df918d7a0efe546d0284e217a3a322bb09f37f39 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914df918d7a0efe546d0284e217a3a322bb09f37f3988ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "n1u5M1NRi1VGDrAQujjzaRhRsfWBtvsVLA"
        ]
      }
    }, 
    {
      "value": 9.99990960,
      "n": 1,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 f2ebf3c5642abf069b4197a08e116937503d13e4 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914f2ebf3c5642abf069b4197a08e116937503d13e488ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "n3fQUj2SSLcuAQjeL97WWuLm3n5DvjNYA8"
        ]
      }
    }
  ]
}

```

Thank you in advance! :)

**Tags:** transactions, transaction-fees, litecoin, raw-transaction


---

## 1 answers

### Answer by username_1 on 2018-04-17. Score: 0

I am not 100% sure, if this also applies to Litecoin, as it is a clone of Bitcoin. But I understand the signature scheme is the same... So it should be possible to use openssl or any ECDSA library to check the signature. Therefor the double sea of the unsigned tx must be created, as per these steps by [amaclin's answer](https://bitcoin.stackexchange.com/questions/32305/how-does-the-ecdsa-verification-algorithm-work-during-transaction):

> 1) Remove input script from transaction
>
> 2) Replace it with the previous TX's pubkeyscript
>
> 3) Append SIGHASH\_ALL
>
> 4) Hash it twice with SHA256

I try to replay it, and get these values:

```
sig:         3045022100ac91b8da716668553088da2da32c596a03973fffcbc36d2a7f3ecb8e93c3de07022040b7015c065e74d6f5fc30c9458c0631ddfb2d72feae3bb699c6ce835cd0ba54 
pubkey:      02d41b76393d5f82b1856343623974684ff2bf03b26ec6bc2d0391ae0768cd9ebd 
double hash: c54fa81808f1feef80298f232f00b42fa5d548b964d580026799b1bf5f431529

```

This returns an error in signature verification. This can have several root causes... You said, "after adjusting fee's and other network variables": the fees are related to the amounts in the output structure, and they are signed. At anytime something of the signed tx is changed, invalidates the signature. This might be the root cause ...
Can we see the unsigned transaction?


---

