# `Ethers.Transaction.Signed`
[🔗](https://github.com/ExWeb3/elixir_ethers/blob/v0.6.12/lib/ethers/transaction/signed.ex#L1)

A struct that wraps a transaction and its signature values.

# `t`

```elixir
@type t() :: %Ethers.Transaction.Signed{
  metadata: Ethers.Transaction.Metadata.t() | nil,
  payload: Ethers.Transaction.t_payload(),
  signature_r: binary(),
  signature_s: binary(),
  signature_y_parity_or_v: non_neg_integer()
}
```

A transaction signature envelope that wraps transaction data with its signature components.

This type supports both Legacy (pre-EIP-155), EIP-155 Legacy, and EIP-1559 transaction formats.
The signature components consist of:
- `signature_r`, `signature_s`: The ECDSA signature values as defined in Ethereum's Yellow Paper
- `signature_y_parity_or_v`: The recovery value that varies by transaction type:
  - For pre-EIP-155 Legacy transactions: v = recovery_id + 27
  - For EIP-155 Legacy transactions: v = recovery_id + chain_id * 2 + 35
  - For EIP-1559 transactions: Just the recovery_id (0 or 1) as specified in EIP-2930

Related EIPs:
- [EIP-155](https://eips.ethereum.org/EIPS/eip-155): Simple replay attack protection
- [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559): Fee market change for ETH 1.0 chain
- [EIP-2930](https://eips.ethereum.org/EIPS/eip-2930): Optional access lists

# `calculate_y_parity_or_v`

```elixir
@spec calculate_y_parity_or_v(
  Ethers.Transaction.t_payload(),
  binary() | non_neg_integer()
) ::
  non_neg_integer()
```

Calculates the y-parity or v value for transaction signatures.

Handles both legacy and EIP-1559 transaction types according to their specifications.

## Parameters
  - `tx` - Transaction struct
  - `recovery_id` - Recovery ID from the signature

## Returns
  - `integer` - Calculated y-parity or v value

# `from_address`

```elixir
@spec from_address(t()) :: {:ok, Ethers.Types.t_address()} | {:error, atom()}
```

Calculates the from address of a signed transaction using its signature.

The from address is inferred from the signature of the transaction rather than being explicitly
specified. This is done by recovering the signer's public key from the signature and then
deriving the corresponding Ethereum address.

## Returns
  - `{:ok, address}` - Successfully recovered from address
  - `{:error, reason}` - Failed to recover address

---

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