http_transport

Creates an HTTP TRANSPORT from an endpoint and optional chain ID. The JSON-config overload adds timeouts, retries, throttling, concurrency, TLS verification, and get_logs page-size controls.

Example

Local

1
-- Build an HTTP transport for a local Anvil node
2
SELECT http_transport('http://127.0.0.1:8545', 31337) AS transport;
Notebook ready in readonly mode.

API reference

Exact signatures with descriptions, requirements, inputs, returns, and examples.

http_transport(VARCHAR, UBIGINT) #

Specify both URL and the trusted chain id used by downstream local validation.

Inputs

Name Type Use
url VARCHAR

HTTP or HTTPS JSON-RPC endpoint. Bare hosts are normalized to URLs.

required positional
chain_id UBIGINT

Trusted caller-declared EVM chain id carried with the transport; no implicit RPC discovery is performed.

required positional

Returns

Name Type
transport TRANSPORT

TRANSPORT JSON. Returns a TRANSPORT-typed JSON object containing type, url, chain_id, and merged HTTP client config.

Guidance

HTTP config fields

The config JSON is merged over built-in defaults and carried inside the transport.

Supported fields are timeout_ms, retry_count, retry_delay_ms, retry_max_delay_ms, deadline_ms, verify_ssl, max_block_range, max_rpc_batch_size, requests_per_second, and max_concurrent.

  • max_block_range controls the block span of each get_logs request; it does not cap the total scan range.
  • max_rpc_batch_size caps the number of requests in each JSON-RPC batch envelope.
  • requests_per_second and max_concurrent control client-side throttling.

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 overloads

http_transport(VARCHAR) #

Infers protocol and HTTP settings; defaults to Ethereum mainnet (chain id 1).

Inputs

Name Type Use
url VARCHAR

HTTP or HTTPS JSON-RPC endpoint. Omitted chain_id defaults to Ethereum mainnet (1).

required positional

Returns

Name Type
transport TRANSPORT

TRANSPORT JSON. Returns a TRANSPORT-typed JSON object containing type, url, chain_id, and merged HTTP client config.

Overload examples

Local SQL

1
SELECT http_transport('https://eth.drpc.org') AS transport;
http_transport(VARCHAR, UBIGINT, JSON) #

Adds an explicit HTTP request policy. max_block_range controls each get_logs page, max_rpc_batch_size caps JSON-RPC envelopes, and rate and concurrency settings govern client-side request scheduling.

Inputs

Name Type Use
url VARCHAR

HTTP or HTTPS JSON-RPC endpoint. Bare hosts are normalized to URLs.

required positional
chain_id UBIGINT

Trusted caller-declared EVM chain id carried with the transport; no implicit RPC discovery is performed.

required positional
config JSON

JSON overrides for timeout_ms, retry_count, retry_delay_ms, retry_max_delay_ms, deadline_ms, verify_ssl, max_block_range, max_rpc_batch_size, requests_per_second, and max_concurrent.

required positional

Returns

Name Type
transport TRANSPORT

TRANSPORT JSON. Returns a TRANSPORT-typed JSON object containing type, url, chain_id, and merged HTTP client config.

Overload examples

Local SQL

1
SELECT http_transport('https://eth.llamarpc.com', 1, json('{"timeout_ms":15000,"max_block_range":1000,"requests_per_second":10,"max_concurrent":4}')) AS transport;

Examples

Local SQL

1
SELECT http_transport('http://127.0.0.1:8545', 31337) AS transport;
Notebook ready in readonly mode.

Related functions

Category and tags

Tag
Client