<p>I was not sure how it would work there but it is in fact basic arithmetic, we have this <code>x^2 + x = 6</code> then we substract 6 from both sides <code>x^2 + x - 6 = 6 - 6</code> then we simplify <code>x^2 + x - 6 = 0</code></p>

CC BY-SA 4.0
2019-12-01T08:58:48.447Z
2019-12-01T08:58:48.447Z
Saxtheowl
<p>I am doing some tutorial and in this chapter we are suppose to reproduce the Script scripting language</p>

<p>I am struggling to understand one of the exercises, here it is:</p>

<pre><code>Create a ScriptSig that can unlock this ScriptPubKey:
767695935687
</code></pre>

<p>and the answer is 0x52 so that :</p>

<pre><code>&gt;&gt;&gt; from script import Script
&gt;&gt;&gt; script_pubkey = Script([0x76, 0x76, 0x95, 0x93, 0x56, 0x87])
&gt;&gt;&gt; script_sig = Script([0x52])
&gt;&gt;&gt; combined_script = script_sig + script_pubkey
&gt;&gt;&gt; print(combined_script.evaluate(0))
</code></pre>

<p>and that <code>OP_2 or 52 will satisfy the equation x² + x – 6 = 0.</code></p>

<p>I guess I get the whole part execution except when the OP_6 is pushed on the stack, how does it become negative ?</p>

CC BY-SA 4.0
2019-12-01T08:15:33.167Z
It doesn't. The script implements "x^2 + x = 6". The last opcode is OP_EQUAL. Of course, the script cannot work because it uses the disabled opcode OP_MUL.
Pieter Wuille
<script><sequence>
How does a constant opcode become negative in Script
Saxtheowl
# How does a constant opcode become negative in Script

(Asked by: username_0 on 2019-12-01)

I am doing some tutorial and in this chapter we are suppose to reproduce the Script scripting language

I am struggling to understand one of the exercises, here it is:

```
Create a ScriptSig that can unlock this ScriptPubKey:
767695935687

```

and the answer is 0x52 so that :

```
>>> from script import Script
>>> script_pubkey = Script([0x76, 0x76, 0x95, 0x93, 0x56, 0x87])
>>> script_sig = Script([0x52])
>>> combined_script = script_sig + script_pubkey
>>> print(combined_script.evaluate(0))

```

and that `OP_2 or 52 will satisfy the equation x² + x – 6 = 0.`

I guess I get the whole part execution except when the OP\_6 is pushed on the stack, how does it become negative ?

**Tags:** script, sequence

> **Comments:**
> **username_1**: It doesn't. The script implements "x^2 + x = 6". The last opcode is OP_EQUAL. Of course, the script cannot work because it uses the disabled opcode OP_MUL.  

---

## 1 answers

### Answer by username_0 on 2019-12-01. Score: 0 | Accepted answer

I was not sure how it would work there but it is in fact basic arithmetic, we have this `x^2 + x = 6` then we substract 6 from both sides `x^2 + x - 6 = 6 - 6` then we simplify `x^2 + x - 6 = 0`


---

