<p>The SHA256 of 1 is <code>4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a</code></p>

<pre><code>$ printf "01" | xxd -r -p | openssl sha256
(stdin)= 4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a
$ printf "31" | xxd -r -p | openssl sha256
(stdin)= 6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b
</code></pre>

<p>You were probably trying to do the SHA256 of the ascii character "1" which has a byte value of <code>0x31</code> or <code>41</code> in decimal.</p>

CC BY-SA 4.0
2018-11-16T03:31:43.000Z
oh.. I think this is 99% of all my problems. Thank you
Andrew
CC BY-SA 4.0
2018-11-16T03:25:14.667Z
2018-11-16T03:25:14.667Z
JBaczuk
<p>I'm trying to spend coins from this tx </p>

<blockquote>
  <p><a href="https://tchain.btc.com/ad7a1ed858eecdd146d9c932779aecae4b33f068d29cf794fad6de20f5a5d449" rel="nofollow noreferrer">https://tchain.btc.com/ad7a1ed858eecdd146d9c932779aecae4b33f068d29cf794fad6de20f5a5d449</a></p>
</blockquote>

<p>The scriptpubkey is simple:</p>

<pre><code>1 OP_CHECKSEQUENCEVERIFY OP_DROP OP_SHA256 6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b OP_EQUAL
</code></pre>

<p>SHA256 (1) = 6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b </p>

<p>So, I just need to push <strong>1</strong> to the stack using <strong>OP_1</strong></p>

<p>Here is my transaction:</p>

<pre><code>bitcoin-cli -testnet decoderawtransaction 020000000149d4a5f520ded6fa94f79cd268f0334baeec9a7732c9d946d1cdee58d81e7aad0000000001510100000001904c96000000000017a914f45d94733d430261962932e0c847075195916a048700000000
{
  "txid": "51060bbaf1b29b2ec3b1bb4eef0d56f61121e4df167768f52e6f67f81321eaf5",
  "hash": "51060bbaf1b29b2ec3b1bb4eef0d56f61121e4df167768f52e6f67f81321eaf5",
  "version": 2,
  "size": 84,
  "vsize": 84,
  "weight": 336,
  "locktime": 0,
  "vin": [
    {
      "txid": "ad7a1ed858eecdd146d9c932779aecae4b33f068d29cf794fad6de20f5a5d449",
      "vout": 0,
      "scriptSig": {
        "asm": "1",
        "hex": "51"
      },
      "sequence": 1
    }
  ],
  "vout": [
    {
      "value": 0.09850000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_HASH160 f45d94733d430261962932e0c847075195916a04 OP_EQUAL",
        "hex": "a914f45d94733d430261962932e0c847075195916a0487",
        "reqSigs": 1,
        "type": "scripthash",
        "addresses": [
          "2NFXJy8mvz7ZiT4VVN29xPGC38hTygd3AyJ"
        ]
      }
    }
  ]
}
</code></pre>

<p>When I use sendrawtransaction I got </p>

<pre><code>mandatory-script-verify-flag-failed (Script evaluated without error but finished with a false/empty top stack element) (code 16)
</code></pre>

<p>Is my redeem script wrong? Or it's something wrong with the scriptpubkey ?</p>

<bitcoind><script><raw-transaction>
Script evaluated without error but finished with a false/empty top stack element
Andrew
# Script evaluated without error but finished with a false/empty top stack element

(Asked by: username_0 on 2018-11-16)

I'm trying to spend coins from this tx

> <https://tchain.btc.com/ad7a1ed858eecdd146d9c932779aecae4b33f068d29cf794fad6de20f5a5d449>

The scriptpubkey is simple:

```
1 OP_CHECKSEQUENCEVERIFY OP_DROP OP_SHA256 6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b OP_EQUAL

```

SHA256 (1) = 6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b

So, I just need to push **1** to the stack using **OP\_1**

Here is my transaction:

```
bitcoin-cli -testnet decoderawtransaction 020000000149d4a5f520ded6fa94f79cd268f0334baeec9a7732c9d946d1cdee58d81e7aad0000000001510100000001904c96000000000017a914f45d94733d430261962932e0c847075195916a048700000000
{
  "txid": "51060bbaf1b29b2ec3b1bb4eef0d56f61121e4df167768f52e6f67f81321eaf5",
  "hash": "51060bbaf1b29b2ec3b1bb4eef0d56f61121e4df167768f52e6f67f81321eaf5",
  "version": 2,
  "size": 84,
  "vsize": 84,
  "weight": 336,
  "locktime": 0,
  "vin": [
    {
      "txid": "ad7a1ed858eecdd146d9c932779aecae4b33f068d29cf794fad6de20f5a5d449",
      "vout": 0,
      "scriptSig": {
        "asm": "1",
        "hex": "51"
      },
      "sequence": 1
    }
  ],
  "vout": [
    {
      "value": 0.09850000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_HASH160 f45d94733d430261962932e0c847075195916a04 OP_EQUAL",
        "hex": "a914f45d94733d430261962932e0c847075195916a0487",
        "reqSigs": 1,
        "type": "scripthash",
        "addresses": [
          "2NFXJy8mvz7ZiT4VVN29xPGC38hTygd3AyJ"
        ]
      }
    }
  ]
}

```

When I use sendrawtransaction I got

```
mandatory-script-verify-flag-failed (Script evaluated without error but finished with a false/empty top stack element) (code 16)

```

Is my redeem script wrong? Or it's something wrong with the scriptpubkey ?

**Tags:** bitcoind, script, raw-transaction


---

## 1 answers

### Answer by username_1 on 2018-11-16. Score: 2 | Accepted answer

The SHA256 of 1 is `4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a`

```
$ printf "01" | xxd -r -p | openssl sha256
(stdin)= 4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a
$ printf "31" | xxd -r -p | openssl sha256
(stdin)= 6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b

```

You were probably trying to do the SHA256 of the ascii character "1" which has a byte value of `0x31` or `41` in decimal.

> **Comments:**
> **username_0**: oh.. I think this is 99% of all my problems. Thank you  

---

