Crate primitives
Expand description
§revm-primitives
Core primitive types and constants for the Ethereum Virtual Machine (EVM) implementation.
This crate provides:
- EVM constants and limits (gas, stack, code size)
 - Ethereum hard fork management and version control
 - EIP-specific constants and configuration values
 - Cross-platform synchronization primitives
 - Type aliases for common EVM concepts (storage keys/values)
 - Re-exports of alloy primitive types for convenience
 
Modules§
- alloy_
primitives  - alloy-primitives
 - constants
 - Global constants for the EVM
 - eip170
 - EIP-170: Contract Code Size Limit
 - eip3860
 - EIP-3860: Limit and Meter Initcode
 - eip4844
 - EIP-4844: Shard Blob Transactions
 - eip7702
 - EIP-7702: Set EOA Account Code
 - eip7823
 - EIP-7823: Set Upper Bounds for MODEXP
 - eip7825
 - EIP-7825: Transaction Gas Limit Cap
 - eip7907
 - EIP-7907: Meter Contract Code Size And Increase Limit (Prague)
 - hardfork
 - map
 - Re-exports of map types and utilities.
 
Macros§
- address
 - Converts a sequence of string literals containing hex-encoded data
into a new 
Addressat compile time. - b256
 - Converts a sequence of string literals containing hex-encoded data
into a new 
B256at compile time. - bytes
 - Converts a sequence of string literals containing hex-encoded data into a
new 
Bytesat compile time. - fixed_
bytes  - Converts a sequence of string literals containing hex-encoded data
into a new 
FixedBytesat compile time. - hex
 - Macro for converting sequence of string literals containing hex-encoded data into an array of bytes.
 
Structs§
- Address
 - An Ethereum address, 20 bytes in length.
 - Bytes
 - Wrapper type around [
bytes::Bytes] to support “0x” prefixed hex strings. - Fixed
Bytes  - A byte array of fixed length (
[u8; N]). - Log
 - A log consists of an address, and some log data.
 - LogData
 - An Ethereum event log object.
 - Once
Lock  - A synchronization primitive which can nominally be written to only once.
 
Enums§
- TxKind
 - The 
tofield of a transaction. Either a target address, or empty for a contract creation. 
Constants§
- BLOCK_
HASH_ HISTORY  - Number of block hashes that EVM can access in the past (pre-Prague)
 - CALL_
STACK_ LIMIT  - EVM call stack limit
 - KECCAK_
EMPTY  - The Keccak-256 hash of the empty string 
"". - ONE_
ETHER  - 1 ether = 10^18 wei
 - ONE_
GWEI  - 1 gwei = 10^9 wei
 - PRECOMPIL
E3  - The address of precompile 3, which is handled specially in a few places
 - SHORT_
ADDRESS_ CAP  - Optimize short address access.
 - STACK_
LIMIT  - EVM interpreter stack limit
 
Functions§
- keccak256
 - Simple interface to the 
Keccak-256hash function. - short_
address  - Returns the short address from Address.
 
Type Aliases§
- B256
 - 32-byte fixed byte-array type.
 - HashMap
 - A 
HashMapusing the default hasher. - HashSet
 - A 
HashSetusing the default hasher. - I128
 - 128-bit signed integer type, consisting of 2, 64-bit limbs.
 - I256
 - 256-bit signed integer type, consisting of 4, 64-bit limbs.
 - Storage
Key  - Type alias for EVM storage keys (256-bit unsigned integers). Used to identify storage slots within smart contract storage.
 - Storage
Value  - Type alias for EVM storage values (256-bit unsigned integers). Used to store data values in smart contract storage slots.
 - U128
 - 128-bit unsigned integer type, consisting of 2, 64-bit limbs.
 - U256
 - 256-bit unsigned integer type, consisting of 4, 64-bit limbs.