@tevm/voltaire / evm / Context
Context
Functions
address()
address(Defined in: src/evm/context/0x30_ADDRESS.js:14 ADDRESS opcode (0x30) - Get address of currently executing account Stack: [] => [address] Gas: 2 (GasQuickStep)frame):EvmError|null
Parameters
frame
BrandedFrame
Frame instance
Returns
EvmError | null
Error if any
balance()
balance(Defined in: src/evm/context/0x31_BALANCE.js:27 BALANCE opcode (0x31) - Get balance of an account Stack: [address] => [balance] Gas costs vary by hardfork (EIP-150, EIP-1884, EIP-2929):frame,host):EvmError|null
- Pre-Tangerine Whistle: 20 gas
- Tangerine Whistle (EIP-150): 400 gas
- Istanbul (EIP-1884): 700 gas
- Berlin (EIP-2929): 2600 gas (cold) / 100 gas (warm)
- Cold access: First time address is accessed in transaction (2600 gas)
- Warm access: Subsequent accesses to same address (100 gas)
- Tracking maintained in frame.accessedAddresses Set
Parameters
frame
BrandedFrame
Frame instance
host
BrandedHost
Host interface
Returns
EvmError | null
Error if any
calldatacopy()
calldatacopy(Defined in: src/evm/context/0x37_CALLDATACOPY.js:42 CALLDATACOPY opcode (0x37) - Copy input data in current environment to memory Stack: [destOffset, offset, length] => [] Gas: 3 (GasFastestStep) + memory expansion + copy cost Copies length bytes from calldata[offset:offset+length] to memory[destOffset:destOffset+length]. If offset + i >= calldata.length, remaining bytes are zero-padded.frame):EvmError|null
Parameters
frame
BrandedFrame
Frame instance
Returns
EvmError | null
Error if any
calldataload()
calldataload(Defined in: src/evm/context/0x35_CALLDATALOAD.js:32 CALLDATALOAD opcode (0x35) - Get input data of current environment Stack: [offset] => [data] Gas: 3 (GasFastestStep) Loads 32 bytes from calldata starting at offset. If offset + i >= calldata.length, remaining bytes are zero-padded.frame):EvmError|null
Parameters
frame
BrandedFrame
Frame instance
Returns
EvmError | null
Error if any
calldatasize()
calldatasize(Defined in: src/evm/context/0x36_CALLDATASIZE.js:13 CALLDATASIZE opcode (0x36) - Get size of input data in current environment Stack: [] => [size] Gas: 2 (GasQuickStep)frame):EvmError|null
Parameters
frame
BrandedFrame
Frame instance
Returns
EvmError | null
Error if any
caller()
caller(Defined in: src/evm/context/0x33_CALLER.js:14 CALLER opcode (0x33) - Get caller address Stack: [] => [caller] Gas: 2 (GasQuickStep)frame):EvmError|null
Parameters
frame
BrandedFrame
Frame instance
Returns
EvmError | null
Error if any
callvalue()
callvalue(Defined in: src/evm/context/0x34_CALLVALUE.js:13 CALLVALUE opcode (0x34) - Get deposited value by instruction/transaction responsible for this execution Stack: [] => [value] Gas: 2 (GasQuickStep)frame):EvmError|null
Parameters
frame
BrandedFrame
Frame instance
Returns
EvmError | null
Error if any
codecopy()
codecopy(Defined in: src/evm/context/0x39_CODECOPY.js:42 CODECOPY opcode (0x39) - Copy code running in current environment to memory Stack: [destOffset, offset, length] => [] Gas: 3 (GasFastestStep) + memory expansion + copy cost Copies length bytes from bytecode[offset:offset+length] to memory[destOffset:destOffset+length]. If offset + i >= bytecode.length, remaining bytes are zero-padded.frame):EvmError|null
Parameters
frame
BrandedFrame
Frame instance
Returns
EvmError | null
Error if any
codesize()
codesize(Defined in: src/evm/context/0x38_CODESIZE.js:13 CODESIZE opcode (0x38) - Get size of code running in current environment Stack: [] => [size] Gas: 2 (GasQuickStep)frame):EvmError|null
Parameters
frame
BrandedFrame
Frame instance
Returns
EvmError | null
Error if any
extcodecopy()
extcodecopy(Defined in: src/evm/context/0x3c_EXTCODECOPY.js:57 EXTCODECOPY opcode (0x3c) - Copy an account’s code to memory Stack: [address, destOffset, offset, size] => [] Gas costs include three components:frame,host):EvmError|null
- Access cost: hardfork-dependent (EIP-150, EIP-1884, EIP-2929)
- Copy cost: 3 gas per 32-byte word (rounded up)
- Memory expansion cost: Quadratic expansion cost for new memory
- Pre-Tangerine Whistle: 20 gas access
- Tangerine Whistle (EIP-150): 700 gas access
- Istanbul (EIP-1884): 700 gas access
- Berlin (EIP-2929): 2600 gas (cold) / 100 gas (warm) access
Parameters
frame
BrandedFrame
Frame instance
host
BrandedHost
Host interface
Returns
EvmError | null
Error if any
extcodehash()
extcodehash(Defined in: src/evm/context/0x3f_EXTCODEHASH.js:32 EXTCODEHASH opcode (0x3f) - Get hash of an account’s code Stack: [address] => [hash] Gas costs vary by hardfork (EIP-1884, EIP-2929):frame,host):EvmError|null
- Constantinople-Istanbul: 400 gas
- Istanbul-Berlin: 700 gas (EIP-1884)
- Berlin+ (EIP-2929): 2600 gas (cold) / 100 gas (warm)
- Returns keccak256 hash of account’s code
- Returns 0 for non-existent accounts (instead of empty hash)
- Can be used for code verification without deploying full code
Parameters
frame
BrandedFrame
Frame instance
host
BrandedHost
Host interface
Returns
EvmError | null
Error if any
extcodesize()
extcodesize(Defined in: src/evm/context/0x3b_EXTCODESIZE.js:27 EXTCODESIZE opcode (0x3b) - Get size of an account’s code Stack: [address] => [codeSize] Gas costs vary by hardfork (EIP-150, EIP-1884, EIP-2929):frame,host):EvmError|null
- Pre-Tangerine Whistle: 20 gas
- Tangerine Whistle (EIP-150): 700 gas
- Istanbul (EIP-1884): 700 gas
- Berlin (EIP-2929): 2600 gas (cold) / 100 gas (warm)
- Cold access: First time address is accessed in transaction (2600 gas)
- Warm access: Subsequent accesses to same address (100 gas)
- Tracking maintained in frame.accessedAddresses Set
Parameters
frame
BrandedFrame
Frame instance
host
BrandedHost
Host interface
Returns
EvmError | null
Error if any
gasprice()
gasprice(Defined in: src/evm/context/0x3a_GASPRICE.js:14 GASPRICE opcode (0x3a) - Get price of gas in current environment Stack: [] => [gasPrice] Gas: 2 (GasQuickStep)frame,gasPrice):EvmError|null
Parameters
frame
BrandedFrame
Frame instance
gasPrice
bigint
Transaction gas price
Returns
EvmError | null
Error if any
origin()
origin(Defined in: src/evm/context/0x32_ORIGIN.js:15 ORIGIN opcode (0x32) - Get execution origination address Stack: [] => [origin] Gas: 2 (GasQuickStep)frame,origin):EvmError|null
Parameters
frame
BrandedFrame
Frame instance
origin
AddressType
Transaction origin address
Returns
EvmError | null
Error if any
returndatacopy()
returndatacopy(Defined in: src/evm/context/0x3e_RETURNDATACOPY.js:53 RETURNDATACOPY opcode (0x3e) - Copy output data from the previous call to memory Stack: [destOffset, offset, length] => [] Gas: 3 (GasFastestStep) + memory expansion + copy cost EIP-211: Introduced in Byzantium hardfork Copies length bytes from returnData[offset:offset+length] to memory[destOffset:destOffset+length]. Throws OutOfBounds if offset + length > returnData.length.frame):EvmError|null
Parameters
frame
BrandedFrame
Frame instance
Returns
EvmError | null
Error if any
returndatasize()
returndatasize(Defined in: src/evm/context/0x3d_RETURNDATASIZE.js:15 RETURNDATASIZE opcode (0x3d) - Get size of output data from the previous call Stack: [] => [size] Gas: 2 (GasQuickStep) EIP-211: Introduced in Byzantium hardforkframe):EvmError|null
Parameters
frame
BrandedFrame
Frame instance
Returns
EvmError | null
Error if any
