What is the purpose & functionalities of the LSHIFT & RSHIFT Script OP codes ?

2 Answers 2


In the early versions of bitcoin the software used the openssl bignumber lib to perform left and right shift.

E.g. Look at script.cpp in v0.2.13

For example, The OP_LSHIFT (L595) uses bignum.h (L503) and openssl/bn.h to define << operator and ends up at this definition of lshift:


It seems they were disabled in response to a DoS security concern: https://en.bitcoin.it/wiki/Incidents#CVE-2010-5137


For all intents and purposes, Bitcoin has no such opcodes.

Very early versions of Bitcoin's reference implementation did, until version 0.3.10 (August 2010) when they were disabled together with a number of other opcodes. New opcodes with identical functionality could be re-introduced now with a softfork, but the fact that similar opcodes existed historically wouldn't make that any easier (or harder) - they'd just be new opcodes.

As for what they did: they implemented an operation similar to the >>= and <<= C/C++ style operators, multiplying and dividing by a specified power of two.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.