Arithmetic operations in Bitcoin (OP_ADD, etc) 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
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.