Ethereum: Op_return Max Bytes Clifification
The Ethereum community has been buzzing for the use of op_return opcodes for months and one concept has caused curiosity – maximum bytes allowed by these opcodes. Specifically, it is a question of how it is possible that an unregistered transaction can transfer up to 80 any byte in its data.
In order to understand this phenomenon, we must dive into the world of the Ethereum scripting language and opcodes. Here is a disorder:
What is op_return?
Op_return is a special type of OPCode transaction, which introduced Ethereum in 2014 as part of the beacon chain update (now known as Polkadot). It allows developers to send data such as images or other files without saving them to a blockchain.
Op_return Opcode itself
Opcode op_return has a specific structure:
`
FunctionName (data) {
Return {op: 0x00, i: index, only: length, useful load}
}
`
Here is what each parameter represents:
FunctionName
: Name of function that makes this transaction. In the case of op_return, this is simply a surveillance symbol for all data.
Data
: the actual data to be sent (in this example it is an empty field).
Index
alength ': These are used by the Ethereum virtual machine (EVM) to determine which part of the data must be included in the transaction.
- Useful load: We will place our 80 any bytes here. EVM will store these bytes on the blockchain until they are performed.
How it works
Here is an example:
- The developer defines a function with the op_return Opcode as this:
`
Function of Opreturn (Data) {
Return {op: 0x00, i: 0, only: 80, useful load: data}
}
`
- They send a transaction
opreturn
to a node that performs the function and stores the returned value (in this case 80 bytes).
- When the node performs the transaction, it checks the parameter
Payload
, which contains 80-bait data.
Why up to 80 bytes?
So why can’t we just send any bytes in our OP_return transactions? The answer lies in the way the Ethereum scripting language works. EVM has a limited amount of memory and storage space for data on transactions determined by the I
(index) parameter.
The Payload
parameter contains poleonly ', which determines the number of bytes to be stored in the blockchain. If we try to include more than 80 bytes in our useful load, EVM simply ignores them.
Conclusion
In short, Op_return Opcodes of Ethereum allows you to send any data without storing them in the blockchain using the name of the function of the representative symbol and including theIi
-limited value (in this case up to 80 bytes). This allows developers to send a large amount of data in a compact format, making it easier to use and more efficiently than traditional storage solutions.
Although this concept may seem complicated at first glance, understanding how it works, it can help you better appreciate the strength and flexibility of the Ethereum scripting language.