# transport

Builds a TRANSPORT containing type, url, and chain_id without contacting the endpoint. Unlike http_transport, it does not add a config object.

Canonical HTML: <https://determica.com/docs/functions/transport>

- Kind: scalar function
- Category: [Clients and state contexts](/docs/category/clients-and-state-contexts.md)
- Tags: Client

Builds a TRANSPORT containing type, url, and chain_id without contacting the endpoint. Unlike http_transport, it does not add a config object.

## Overload 1: transport(VARCHAR, UBIGINT)

```sql
transport(VARCHAR, UBIGINT)
```

Stores the supplied chain_id without calling eth_chainId or comparing it with the endpoint.

- Kind: scalar
- Execution context: Offline
- Behavior: Constructor
- Execution modes: Offline
- Input shape: Scalar Arguments
- Planning contract: Runtime
- Cardinality: One Per Input
- Determinism: Deterministic
- Return shape: Scalar
- Schema stability: Fixed
- Stability: Stable
- Side effects: None documented

### Inputs

- `url` (VARCHAR; required; positional) — HTTP or HTTPS JSON-RPC endpoint. Use a lowercase scheme. Without a scheme, localhost and 127.0.0.1 use http://; other hosts use https://.
- `chain_id` (UBIGINT; required; positional) — Unsigned EVM chain id stored as caller-supplied metadata. transport does not query or verify it.

### Returns

TRANSPORT value

Returns a TRANSPORT value with a lowercase type, the endpoint URL, and chain_id. Bare endpoints receive an http:// or https:// prefix.

- `transport` (TRANSPORT)

TRANSPORT value. Returns a TRANSPORT value with a lowercase type, the endpoint URL, and chain_id. Bare endpoints receive an http:// or https:// prefix.

### Examples

_Local SQL · Local_

```sql
SELECT transport('http://127.0.0.1:8545', 31337) AS transport;
```

## Overload 2: transport(VARCHAR)

```sql
transport(VARCHAR)
```

Sets chain_id to 1 without querying the endpoint. Call transport(url, chain_id) to set a different value.

- Kind: scalar
- Execution context: Offline
- Behavior: Constructor
- Execution modes: Offline
- Input shape: Scalar Arguments
- Planning contract: Runtime
- Cardinality: One Per Input
- Determinism: Deterministic
- Return shape: Scalar
- Schema stability: Fixed
- Stability: Stable
- Side effects: None documented

### Inputs

- `url` (VARCHAR; required; positional) — HTTP or HTTPS JSON-RPC endpoint. Use a lowercase scheme. Without a scheme, localhost and 127.0.0.1 use http://; other hosts use https://.

### Returns

TRANSPORT value

Returns a TRANSPORT value with a lowercase type, the endpoint URL, and chain_id. Bare endpoints receive an http:// or https:// prefix.

- `transport` (TRANSPORT)

TRANSPORT value. Returns a TRANSPORT value with a lowercase type, the endpoint URL, and chain_id. Bare endpoints receive an http:// or https:// prefix.

### Examples

_Local SQL · Local_

```sql
SELECT transport('https://eth.llamarpc.com') AS transport;
```

## Guidance

### Validation

Casting VARCHAR or JSON to TRANSPORT, and creating a CLIENT from a TRANSPORT, reject malformed transport data.

- type must be http or https, url must start with the matching lowercase scheme, and chain_id must be a non-negative integer.
- config, when present, must be an object. Recognized fields must have the required type and range; access_list_provider is rejected.

### transport vs http_transport

- Use http_transport when you need HTTP-specific options like timeout, retry count, rate limits, concurrency, SSL verification, or log pagination limits.
- Use transport for minimal generic transport construction.

## Additional examples

```sql
-- Anvil uses chain id 31337 by default.
SELECT transport('http://127.0.0.1:8545', 31337) AS transport;
```

## Related functions

- [http_transport](/docs/functions/http_transport.md) — Alternative
- [rpc_call](/docs/functions/rpc_call.md) — Usually Before
- [get_block](/docs/functions/get_block.md) — Usually Before
