# `EEVM.Transaction.Validator`
[🔗](https://github.com/mw2000/eevm/blob/v0.1.0/lib/eevm/transaction/validator.ex#L1)

Transaction pre-execution validation.

Performs envelope and sender checks in deterministic order against current
state and block context, returning `:ok` or the first `{:error, reason}`.

Given an `EEVM.Config` instead of a bare `EEVM.HardforkConfig`, the checks
honour its simulation switches (see `EEVM.Config`).

# `check`

```elixir
@spec check(
  EEVM.TxEnv.t(),
  EEVM.Database.t(),
  EEVM.BlockEnv.t(),
  EEVM.HardforkConfig.t() | EEVM.Config.t()
) :: :ok | {:error, EEVM.Error.transaction_validation_error(), map()}
```

Like `validate/4`, but a failure also carries the values the rule
compared, as `{:error, reason, details}`; `EEVM.TransactionError` lists
them per reason.

# `validate`

```elixir
@spec validate(EEVM.TxEnv.t(), EEVM.Database.t(), EEVM.BlockEnv.t()) ::
  :ok | {:error, EEVM.Error.transaction_validation_error()}
```

Validate under the default hardfork; see `validate/4`.

# `validate`

```elixir
@spec validate(
  EEVM.TxEnv.t(),
  EEVM.Database.t(),
  EEVM.BlockEnv.t(),
  EEVM.HardforkConfig.t() | EEVM.Config.t()
) :: :ok | {:error, EEVM.Error.transaction_validation_error()}
```

Run the pre-execution checks in order and return the first failure.
Error reasons are listed in `EEVM.Error`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
