user17107: How do arithmetic operations work in Bitcoin? If I have:
 5
 OP_1ADD

it is obvious that I will get 6 on stack. But what if I have to make OP_1ADD on "02c34538fc933799d972f55752d318c0328ca2bacccd5c7482119ea9da2df70a2f"?
 "02c34538fc933799d972f55752d318c0328ca2bacccd5c7482119ea9da2df70a2f"
 OP_1ADD


user13163: Short answer: arithmetic on large numbers will cause the script to fail.
Long answer:
Script arithmetic is limited to 32-bit arithmetic.
You can find the code for arithmetic operations in script.cpp, in the function EvalScript, where the opcodes are evaluated using CScriptNum in [script.h](https://github.com/bitcoin/bitcoin/blob/master/src/script.h].
The numeric limit is enforced through the constant nMaxNumSize.
The CScriptNum constructor shows that numbers larger than 32 bits throw an exception, resulting in failure of the script.

17107: <p>How do arithmetic operations work in Bitcoin? If I have:</p>

<pre><code> 5
 OP_1ADD
</code></pre>

<p>it is obvious that I will get 6 on stack. But what if I have to make OP_1ADD on "02c34538fc933799d972f55752d318c0328ca2bacccd5c7482119ea9da2df70a2f"?</p>

<pre><code> "02c34538fc933799d972f55752d318c0328ca2bacccd5c7482119ea9da2df70a2f"
 OP_1ADD
</code></pre>
 13163: <p>Short answer: arithmetic on large numbers will cause the script to fail.</p>

<p>Long answer:</p>

<p>Script arithmetic is limited to 32-bit arithmetic.</p>

<p>You can find the code for arithmetic operations in <a href="https://github.com/bitcoin/bitcoin/blob/master/src/script.cpp" rel="nofollow">script.cpp</a>, in the function <code>EvalScript</code>, where the opcodes are evaluated using <code>CScriptNum</code> in [script.h](<a href="https://github.com/bitcoin/bitcoin/blob/master/src/script.h]" rel="nofollow">https://github.com/bitcoin/bitcoin/blob/master/src/script.h]</a>.</p>

<p>The numeric limit is enforced through the constant <code>nMaxNumSize</code>.</p>

<p>The CScriptNum constructor shows that numbers larger than 32 bits throw an exception, resulting in failure of the script.</p>
