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

System instructions enable contracts to interact with external accounts, create new contracts, and manage account lifecycle. These are the most complex EVM opcodes, handling gas forwarding, context preservation, and state modifications.

Instructions

Contract Creation

Message Calls

Account Management

Key Concepts

Gas Forwarding (EIP-150)

63/64 Rule (Tangerine Whistle+): Caller retains 1/64th of remaining gas, forwards up to 63/64:
Pre-Tangerine Whistle: Forward all remaining gas.

Call Variants

Value Transfer Gas Costs

With non-zero value:
  • Base call cost: 700 gas (Tangerine Whistle+)
  • Value transfer: +9,000 gas
  • Stipend to callee: +2,300 gas (free)
  • New account: +25,000 gas (if recipient doesn’t exist)
Without value:
  • Base call cost: 700 gas (Tangerine Whistle+)
  • Access cost: 100 (warm) or 2,600 (cold) gas (Berlin+)

Address Computation

CREATE:
CREATE2:

Security Considerations

Reentrancy

External calls enable reentrancy attacks:
Mitigation: Checks-Effects-Interactions pattern:

CREATE2 Address Collision

CREATE2 enables deterministic addresses but introduces collision risks:
EIP-6780 (Cancun) mitigation: SELFDESTRUCT only deletes if created in same transaction.

CALLCODE Deprecation

CALLCODE is deprecated - use DELEGATECALL instead:

SELFDESTRUCT Changes (EIP-6780)

Pre-Cancun: SELFDESTRUCT deletes code, storage, nonce. Cancun+: SELFDESTRUCT only transfers balance (unless created same tx).

Gas Cost Summary

Call Instructions

Creation Instructions

SELFDESTRUCT

  • Base: 5,000 gas
  • Cold beneficiary: +2,600 gas (Berlin+)
  • New account: +25,000 gas (if beneficiary doesn’t exist)
  • Refund: 24,000 gas (removed in London)

Common Patterns

Safe External Call

Factory Pattern (CREATE2)

Proxy Pattern (DELEGATECALL)

References