Skip to main content
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: 0x34 Introduced: Frontier (EVM genesis) CALLVALUE pushes the amount of wei sent with the current call onto the stack. This corresponds to msg.value in Solidity.

Specification

Stack Input:
Stack Output:
Gas Cost: 2 (GasQuickStep) Operation:

Behavior

CALLVALUE provides access to the wei amount sent with the current message call. This value is always 0 for STATICCALL and DELEGATECALL. Key characteristics:
  • Returns wei amount (1 ether = 10^18 wei)
  • Always 0 for STATICCALL (no value transfer allowed)
  • Preserved in DELEGATECALL (uses caller’s value)
  • New value for each CALL

Examples

Basic Usage

Payable Function

Deposit Pattern

Gas Cost

Cost: 2 gas (GasQuickStep) Same as other environment context opcodes:
  • ADDRESS (0x30): 2 gas
  • ORIGIN (0x32): 2 gas
  • CALLER (0x33): 2 gas

Common Usage

Minimum Payment

Exact Payment

Value Forwarding

Crowdfunding

Security

Payable vs Non-Payable

Reentrancy with Value

Safe pattern:

Value Conservation

Better pattern:

DELEGATECALL Value Preservation

Implementation

Edge Cases

Zero Value

Maximum Value

Stack Overflow

References