<p>You are not supposed to be using the output scripts of the outputs created in the transaction but rather the output script of the output that is being spent. What you are using is the output script of the output in that transaction.</p>

<p>Rather you should click the <code>output</code> link next to the input and get the output script from the referenced output that the link takes you to.</p>

CC BY-SA 3.0
2017-11-29T06:53:59.810Z
2017-11-29T06:53:59.810Z
Ava Chow
<p>I'm trying to understand how Script validates transactions. </p>

<p>I have taken this transaction as an example <a href="https://blockchain.info/fr/tx/55e5bbdba33050bbe6584e896b4a20575cf3fe3f29114467f17f67f6b172eb73" rel="nofollow noreferrer">55e5bbdba33050bbe6584e896b4a20575cf3fe3f29114467f17f67f6b172eb73</a></p>

<p>When showing the scripts, we can see as input</p>

<pre><code>ScriptSig: PUSHDATA(72)[3045022100c70904b2925a6822fd3dc2d236bcba1fa1518fdfdadbda8f25a89a339879c82a02200bd7ca7d502d46ebc6fbc97f51af3d0ab4f290d73931ada9abb76fb1b6d3b55b01] 
PUSHDATA(65)[043fd05d2490b2b8496da3b8498f1aee08634c43eef40aa58b66e36271632571d6dbda0ec7fb6fcec09409597e38e3b968648ed10ad6402647bb6143f0f9f09b3f]
</code></pre>

<p>And output : </p>

<pre><code>DUP HASH160 PUSHDATA(20)[57d713220076f8298b54e9eea84d2e1dde62e4a1] EQUALVERIFY CHECKSIG
</code></pre>

<p>So, from what I understood, if these script bits are run one after another, the result should be true (<strong>please correct me if I'm already mistaken at that point</strong>).</p>

<p>I have used <a href="http://bitcoin-script-debugger.visvirial.com/" rel="nofollow noreferrer">an online Script debugger</a> but these bits did not return a success. </p>

<p>Has anyone an explanation on why I couldn't get this right ? </p>

CC BY-SA 3.0
2017-11-29T09:17:28.797Z
taking the pubkey hash from the previous tx (6fe066d1be6359dba98e7f00f3f45707e0bd07ad), I can see the stack pushes the sig (3045022100c70904b...), then the pubkey (043fd05d2490b2b...). On top goes "OP_DUP", and there are two pubkeys. Good. This duplicated pubkey is hashed (6fe066d1be6359...), and OP_EQUALVERIFY'd. Good, they are the same. The user "is allowed" to spend the funds... Then only sig and pubkey remain, and OP_CHECKSIG returns "NULL" - so a failed stack. I did the same with one of my "old" tx, and it failed as well... At a different step (OP_HASH160) - amybe contact the author...
pebwindkraft
CC BY-SA 3.0
2017-11-29T09:28:43.090Z
when you choose the "empty" button, and provide only sig and pubkey, it verifies to "RESULT OK". But then again, change the keys or hashes (even giving a non-hex char), it still returns ok... there might be s.th. going wrong with the page, or I'm missing something terribly.
pebwindkraft
<script>
Why does this script return an error ?
Arthur Attout
# Why does this script return an error ?

(Asked by: username_0 on 2017-11-28)

I'm trying to understand how Script validates transactions.

I have taken this transaction as an example [55e5bbdba33050bbe6584e896b4a20575cf3fe3f29114467f17f67f6b172eb73](https://blockchain.info/fr/tx/55e5bbdba33050bbe6584e896b4a20575cf3fe3f29114467f17f67f6b172eb73)

When showing the scripts, we can see as input

```
ScriptSig: PUSHDATA(72)[3045022100c70904b2925a6822fd3dc2d236bcba1fa1518fdfdadbda8f25a89a339879c82a02200bd7ca7d502d46ebc6fbc97f51af3d0ab4f290d73931ada9abb76fb1b6d3b55b01] 
PUSHDATA(65)[043fd05d2490b2b8496da3b8498f1aee08634c43eef40aa58b66e36271632571d6dbda0ec7fb6fcec09409597e38e3b968648ed10ad6402647bb6143f0f9f09b3f]

```

And output :

```
DUP HASH160 PUSHDATA(20)[57d713220076f8298b54e9eea84d2e1dde62e4a1] EQUALVERIFY CHECKSIG

```

So, from what I understood, if these script bits are run one after another, the result should be true (**please correct me if I'm already mistaken at that point**).

I have used [an online Script debugger](http://bitcoin-script-debugger.visvirial.com/) but these bits did not return a success.

Has anyone an explanation on why I couldn't get this right ?

**Tags:** script

> **Comments:**
> **username_1**: taking the pubkey hash from the previous tx (6fe066d1be6359dba98e7f00f3f45707e0bd07ad), I can see the stack pushes the sig (3045022100c70904b...), then the pubkey (043fd05d2490b2b...). On top goes "OP_DUP", and there are two pubkeys. Good. This duplicated pubkey is hashed (6fe066d1be6359...), and OP_EQUALVERIFY'd. Good, they are the same. The user "is allowed" to spend the funds... Then only sig and pubkey remain, and OP_CHECKSIG returns "NULL" - so a failed stack. I did the same with one of my "old" tx, and it failed as well... At a different step (OP_HASH160) - amybe contact the author...  
> **username_1**: when you choose the "empty" button, and provide only sig and pubkey, it verifies to "RESULT OK". But then again, change the keys or hashes (even giving a non-hex char), it still returns ok... there might be s.th. going wrong with the page, or I'm missing something terribly.  

---

## 1 answers

### Answer by username_2 on 2017-11-29. Score: 1 | Accepted answer

You are not supposed to be using the output scripts of the outputs created in the transaction but rather the output script of the output that is being spent. What you are using is the output script of the output in that transaction.

Rather you should click the `output` link next to the input and get the output script from the referenced output that the link takes you to.


---

