# `Arcadic.Transport.Bolt`
[🔗](https://github.com/baselabs/arcadic/blob/baselabs_arcadic-v4.0.1/lib/arcadic/transport/bolt.ex#L7)

Runs Cypher queries, transactions, and cursors over native Bolt v4.

Use `setup/1` to build the transport options. It returns the pool in
`:bolt` and the corresponding stream connection options in `:bolt_opts`.
Pass both options to `Arcadic.connect/3`. `start_link/1` returns only
the pool reference.

Supports the query hot path (`execute/4`), native fun-based transactions
(`transaction/3`), and a `RETURN 1` health check (`ready?/1`). Server admin
(create/drop/list database) is an HTTP/server operation, not a Bolt one — those
callbacks return `{:error, %Arcadic.Error{reason: :not_supported}}`; use an HTTP
conn for admin.

> **Read/write semantics differ from the HTTP transport.** Bolt has no `/query`
> vs `/command` endpoint split, so `Arcadic.query/4` on a Bolt conn does NOT
> enforce read-only — the HTTP transport's non-idempotent rejection is the
> ArcadeDB `/query` endpoint's server-side behavior, which Bolt lacks. arcadic is
> statement-agnostic by design (params-only; it never parses statement
> semantics), so a write issued through `query/4` on Bolt executes. Use
> `command/4` for writes on Bolt.

# `setup`

```elixir
@spec setup(keyword()) :: {:ok, keyword()} | {:error, term()}
```

Start a Bolt pool AND return the `transport_options` for a Conn in one call, so
the pool (`:bolt`, for execute/transaction/ready?) and the per-stream connect opts
(`:bolt_opts`, for query_stream) cannot drift to different hosts/credentials. Accepts
the same opts as `start_link/1`, including `:scheme` / `:ssl_opts` for TLS (see there).

    {:ok, topts} = Arcadic.Transport.Bolt.setup(hostname: h, port: p, username: "root", password: pw)
    conn = Arcadic.connect(url, db, auth: {"root", pw}, transport: Arcadic.Transport.Bolt, transport_options: topts)

    {:ok, topts} = Arcadic.Transport.Bolt.setup(scheme: "bolt+s", ssl_opts: [cacertfile: "/ca.pem"], hostname: h, port: p, username: "root", password: pw)

# `start_link`

```elixir
@spec start_link(keyword()) :: {:ok, pid()} | {:error, term()}
```

Start a native Bolt pool. Opts: `:hostname`, `:port` (default 7687),
`:username`, `:password`, `:scheme`, `:ssl_opts`, `:connect_timeout`,
`:versions` (Bolt 4.4–4.1), and DBConnection pool options. `:uri` is rejected.

## Transport security (`:scheme`)

- `"bolt"` (default) — plaintext. ArcadeDB's Bolt is plaintext unless the server is
  configured with `arcadedb.bolt.ssl` + a keystore.
- `"bolt+s"` — TLS, **secure by default**: the server certificate is verified against the
  OS trust store (`verify_peer`). Pass `ssl_opts: [cacertfile: "/path/ca.pem"]` to trust a
  private CA. To opt out of verification, pass `ssl_opts: [verify: :verify_none]` explicitly
  — this encrypts but does NOT authenticate the peer (MITM-able: an attacker on the Bolt
  path can present any certificate and every param/row flows to it), so it is a deliberate
  caller opt-in, never a silent default.

---

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