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:0x60Introduced: Frontier (EVM genesis)PUSH1 pushes a 1-byte immediate value from the bytecode onto the stack. The 1 byte immediately following the opcode is read and zero-padded to 256 bits.
value = read_bytes(pc + 1, 1) // Big-endianstack.push(value)pc += 2
Behavior
PUSH1 reads 1 byte from bytecode starting at position pc + 1, interprets it as a big-endian unsigned integer, and pushes the result onto the stack.Key characteristics:
Reads exactly 1 byte following opcode
Big-endian byte order (most significant byte first)
Zero-padded to 256 bits if less than 32 bytes
InvalidOpcode if insufficient bytecode remaining
PC advances by 2 (opcode + data)
Examples
Basic Usage
import { handler_0x60_PUSH1 } from '@tevm/voltaire/evm/stack/handlers';import { createFrame } from '@tevm/voltaire/evm/Frame';// Bytecode with PUSH1const bytecode = new Uint8Array([ 0x60, // PUSH1 0x01 // 1 byte: 01]);const frame = createFrame({ bytecode, pc: 0, stack: [], gasRemaining: 1000n});const err = handler_0x60_PUSH1(frame);console.log(frame.stack); // [0x0100000000000000000000000000000000000000000000000000000000000000n]console.log(frame.pc); // 2console.log(frame.gasRemaining); // 997n (3 gas consumed)
Solidity Compilation
contract Example { // Function selectors use PUSH4 function transfer() public { // PUSH4 0xa9059cbb (4-byte selector) }}