This page is a placeholder. All examples on this page are currently AI-generated and are not correct. This documentation will be completed in the future with accurate, tested examples.
Overview
Opcode: 0xa0
Introduced: Frontier (EVM genesis)
LOG0 emits a log entry with no indexed topics. Only the event data (non-indexed parameters) is logged, making it useful for simple event tracking where filtering by topics is not needed.
Specification
Stack Input:
Stack Output:
Gas Cost: 375 + (8 × data_length) + memory_expansion_cost
Operation:
Behavior
LOG0 pops offset and length from the stack, reads data from memory, and appends a log entry:
- Offset: Starting position in memory (256-bit value)
- Length: Number of bytes to read from memory (256-bit value)
- Data: Bytes read from memory, padded with zeros if beyond allocated memory
- Topics: Empty array (0 indexed parameters)
Memory Expansion
If the data range extends beyond current memory allocation, memory expands to word boundaries:
Static Call Protection
LOG0 cannot execute in static call context (EIP-214):
Examples
Empty Log
Log with Data
Solidity Event with No Topics
Non-Indexed Event Parameters
Gas Cost
Base Cost: 375 gas
Data Cost: 8 gas per byte
Memory Expansion: Proportional to new memory range
Examples:
- Empty: 375 gas
- 1 byte: 375 + 8 = 383 gas
- 32 bytes: 375 + 256 = 631 gas
- 64 bytes: 375 + 512 + 3 (memory expansion) = 890 gas
Edge Cases
Zero-Length Log
Large Data
Out of Bounds Memory
Stack Underflow
Out of Gas
Common Usage
Simple State Changes
Unindexed Data Logging
Status Events
Security
Cannot Block On-Chain Filtering
Since LOG0 has no topics, external systems cannot efficiently filter by indexed parameters. This is intentional—use LOG1-LOG4 when filtering capability is needed.
Static Call Context Restrictions
LOG0 reverts in view/pure functions or during staticcall operations:
Memory Boundaries
LOG0 reads memory up to offset + length. Uninitialized memory is zero-filled:
Implementation
Testing
Test Cases
References