# `BSV.ChainHash`
[🔗](https://github.com/Bittoku/bsv_sdk_elixir/blob/main/lib/bsv/chain_hash.ex#L1)

A 32-byte hash used for block and transaction identifiers in Bitcoin.
Hex display follows Bitcoin convention (byte-reversed).

# `t`

```elixir
@type t() :: %BSV.ChainHash{bytes: &lt;&lt;_::256&gt;&gt;}
```

# `from_bytes`

```elixir
@spec from_bytes(&lt;&lt;_::256&gt;&gt;) :: t()
```

Create a ChainHash from 32 raw bytes.

# `from_hex`

```elixir
@spec from_hex(String.t()) :: {:ok, t()} | {:error, String.t()}
```

Create a ChainHash from a hex string (byte-reversed, Bitcoin convention).

# `from_hex!`

```elixir
@spec from_hex!(String.t()) :: t()
```

Create a ChainHash from hex, raising on error.

# `to_bytes`

```elixir
@spec to_bytes(t()) :: &lt;&lt;_::256&gt;&gt;
```

Get raw 32 bytes.

# `to_hex`

```elixir
@spec to_hex(t()) :: String.t()
```

Convert to hex string (byte-reversed).

---

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