Opcode is a term used in Ethereum to refer to the bytecode that is executed by the Ethereum Virtual Machine. This bytecode is used to encode data and store it on the blockchain.
The opcode consists of a set of instructions that are used by the EVM to execute a contract or program.
The opcode is divided into two parts: the opcode itself, and the operand. The opcode is the set of instructions that are executed by the EVM, while the operand is the data that is used by those instructions.
In order for a contract or program to be executed on the Ethereum blockchain, it must first be compiled into bytecode. This bytecode can then be stored on the blockchain and executed by the EVM.
The opcodes that are available in Ethereum are divided into two categories: gas-consuming and gas-free. Gas-consuming opcodes are those that require gas in order to be executed, while gas-free opcodes do not require gas.
The most common gas-consuming opcodes are those that perform mathematical operations, such as ADD, MUL, and DIV. Other gas-consuming opcodes include those that interact with storage, such as SLOAD and SSTORE.
Gas-free opcodes include those that push data onto the stack, such as PUSH1 and PUSH32. Gas-free opcodes also include jump instructions, such as JUMP and JUMPI.
In general, gas-consuming opcodes are more expensive to execute than gas-free opcodes. This is because they require more processing power and consume more gas.
As a result, contracts and programs that make use of gas-consuming opcodes tend to be more expensive to execute than those that make use of gas-free opcodes.