> ## Documentation Index
> Fetch the complete documentation index at: https://voltaire.tevm.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# EntryPoint

> ERC-4337 entry point contract address type

# EntryPoint

EntryPoint is a branded [Address](/primitives/address) type representing the ERC-4337 entry point contract. The entry point is the central coordinator for account abstraction, validating and executing user operations submitted by bundlers.

## Overview

The EntryPoint contract is the singleton that handles all user operations. It validates signatures, executes operations, and manages gas accounting and paymaster interactions. Voltaire provides constants for both v0.6 and v0.7 entry point addresses.

```typescript theme={null}
import { EntryPoint, ENTRYPOINT_V06, ENTRYPOINT_V07 } from '@tevm/voltaire/primitives/EntryPoint';

// Use v0.7 entry point
const entryPoint = EntryPoint.from(ENTRYPOINT_V07);
console.log(EntryPoint.toHex(entryPoint));
// "0x0000000071727de22e5e9d8baf0edac6f37da032"

// Use v0.6 entry point (legacy)
const legacyEntryPoint = EntryPoint.from(ENTRYPOINT_V06);
console.log(EntryPoint.toHex(legacyEntryPoint));
// "0x5ff137d4b0fdcd49dca30c7cf57e578a026d2789"
```

## Type Definition

```typescript theme={null}
import type { AddressType } from '../Address/AddressType.js';
import type { brand } from '../../brand.js';

export type EntryPointType = AddressType & { readonly [brand]: "EntryPoint" };
```

EntryPoint is a branded Address type. TypeScript enforces type safety through a unique Symbol brand, preventing mixing with other addresses while maintaining compatibility with Address operations.

## API Reference

### Constructors

#### from

Create EntryPoint from address input.

```typescript theme={null}
function from(
  value: number | bigint | string | Uint8Array | AddressType
): EntryPointType
```

<Tabs>
  <Tab title="From hex string">
    ```typescript theme={null}
    import { EntryPoint } from '@tevm/voltaire/primitives/EntryPoint';

    const entryPoint = EntryPoint.from("0x0000000071727De22E5E9d8BAf0edAc6f37da032");
    ```
  </Tab>

  <Tab title="From constant">
    ```typescript theme={null}
    import { EntryPoint, ENTRYPOINT_V07 } from '@tevm/voltaire/primitives/EntryPoint';

    const entryPoint = EntryPoint.from(ENTRYPOINT_V07);
    ```
  </Tab>
</Tabs>

### Converters

#### toHex

Convert EntryPoint to hex string.

```typescript theme={null}
function toHex(
  entryPoint: number | bigint | string | Uint8Array | AddressType
): string
```

```typescript theme={null}
import { EntryPoint, ENTRYPOINT_V07 } from '@tevm/voltaire/primitives/EntryPoint';

const hex = EntryPoint.toHex(ENTRYPOINT_V07);
console.log(hex);
// "0x0000000071727de22e5e9d8baf0edac6f37da032"
```

### Comparisons

#### equals

Check if two EntryPoint addresses are equal.

```typescript theme={null}
function equals(
  entryPoint1: number | bigint | string | Uint8Array | AddressType,
  entryPoint2: number | bigint | string | Uint8Array | AddressType
): boolean
```

```typescript theme={null}
import { EntryPoint, ENTRYPOINT_V06, ENTRYPOINT_V07 } from '@tevm/voltaire/primitives/EntryPoint';

console.log(EntryPoint.equals(ENTRYPOINT_V06, ENTRYPOINT_V07));
// false

const addr = "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789";
console.log(EntryPoint.equals(ENTRYPOINT_V06, addr));
// true
```

## Constants

### ENTRYPOINT\_V06

Entry point v0.6.0 address: `0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789`

Original ERC-4337 entry point. Supports separate gas limit fields.

```typescript theme={null}
import { ENTRYPOINT_V06 } from '@tevm/voltaire/primitives/EntryPoint';
```

### ENTRYPOINT\_V07

Entry point v0.7.0 address: `0x0000000071727De22E5E9d8BAf0edAc6f37da032`

Latest ERC-4337 entry point. Uses packed gas limits for reduced calldata size.

```typescript theme={null}
import { ENTRYPOINT_V07 } from '@tevm/voltaire/primitives/EntryPoint';
```

## Entry Point Responsibilities

The EntryPoint contract handles:

1. **Validation**: Verifies user operation signatures and nonces
2. **Gas accounting**: Tracks pre-verification, verification, and execution gas
3. **Paymaster interaction**: Validates paymaster approval and handles gas sponsorship
4. **Execution**: Calls the account contract with the operation calldata
5. **Event emission**: Logs successful operations for indexing

## Version Differences

### v0.6.0

* Separate `callGasLimit` and `verificationGasLimit` fields
* Separate `maxFeePerGas` and `maxPriorityFeePerGas` fields
* Standard UserOperation struct

### v0.7.0

* Packed gas limits: `accountGasLimits` (bytes32)
* Packed fees: `gasFees` (bytes32)
* PackedUserOperation struct
* Reduced calldata size (lower bundler costs)

## Usage Patterns

### Submitting User Operations

```typescript theme={null}
import { UserOperation } from '@tevm/voltaire/primitives/UserOperation';
import { EntryPoint, ENTRYPOINT_V07 } from '@tevm/voltaire/primitives/EntryPoint';

const userOp = UserOperation.from({
  sender: "0x742d35Cc6634C0532925a3b844Bc9e7595f251e3",
  nonce: 0n,
  initCode: "0x",
  callData: "0x...",
  callGasLimit: 100000n,
  verificationGasLimit: 200000n,
  preVerificationGas: 50000n,
  maxFeePerGas: 1000000000n,
  maxPriorityFeePerGas: 1000000000n,
  paymasterAndData: "0x",
  signature: "0x",
});

// Hash for signing
const userOpHash = UserOperation.hash(userOp, ENTRYPOINT_V07, 1);
```

### Multi-Chain Support

```typescript theme={null}
import { EntryPoint, ENTRYPOINT_V07 } from '@tevm/voltaire/primitives/EntryPoint';

// Same entry point address across all chains
const mainnetEntry = EntryPoint.from(ENTRYPOINT_V07);
const optimismEntry = EntryPoint.from(ENTRYPOINT_V07);

console.log(EntryPoint.equals(mainnetEntry, optimismEntry));
// true
```

## Related Types

* [EntryPoint (Effect)](https://voltaire-effect.tevm.sh/primitives/entry-point) - Effect.ts integration with Schema validation
* [UserOperation](/primitives/user-operation) - User operation structure (v0.6)
* [PackedUserOperation](/primitives/packed-user-operation) - Packed user operation (v0.7)
* [Paymaster](/primitives/paymaster) - Gas sponsorship address
* [Bundler](/primitives/bundler) - Operation bundler address
* [Address](/primitives/address) - Base address type

## References

* [ERC-4337 Specification](https://eips.ethereum.org/EIPS/eip-4337)
* [Entry Point v0.6](https://github.com/eth-infinitism/account-abstraction/tree/v0.6.0)
* [Entry Point v0.7](https://github.com/eth-infinitism/account-abstraction/tree/v0.7.0)
