Types Reference
Complete reference for Railguard's data types and structures.
This page documents all public types exported by Railguard's crates.
Configuration Types
Config
Root configuration structure, parsed from railguard.toml.
ServerConfig
HTTP server configuration.
UpstreamConfig
Upstream RPC provider configuration.
FirewallConfig
Policy enforcement configuration.
FirewallMode
Enforcement mode.
GlobalLimits
Transaction-level limits.
ContractRule
Per-contract policy rule.
ArgConstraint
Argument value constraint.
Verdict Types
Verdict
Result of policy inspection.
Example:
Receipt Types
Receipt
Structured audit log for a transaction attempt.
Fields:
| Field | Type | Description |
|---|---|---|
id | Uuid | Unique receipt identifier |
timestamp | DateTime<Utc> | When the attempt occurred |
method | String | eth_sendTransaction or eth_sendRawTransaction |
from | Option<Address> | Sender address (if available) |
to | Option<Address> | Destination address |
value | Option<U256> | ETH value in wei |
selector | Option<[u8; 4]> | Function selector from calldata |
verdict | Verdict | Policy decision |
tx_hash | Option<B256> | Transaction hash if forwarded |
latency_us | u64 | Inspection time in microseconds |
JSON-RPC Types
RpcInput
Supports both single and batch requests.
RpcRequest
Single JSON-RPC 2.0 request.
RpcParams
Request parameters (array or object).
RpcResponse
JSON-RPC 2.0 response.
RpcError
JSON-RPC error object.
Standard error codes:
| Code | Meaning |
|---|---|
| -32000 | Railguard policy violation |
| -32600 | Invalid request |
| -32601 | Method not found |
| -32602 | Invalid params |
| -32603 | Internal error |
Policy Engine Types
RuntimePolicy
Compiled policy optimized for fast lookups.
CompiledRule
Pre-compiled rule with parsed selector and types.
Event Types
ProxyEvent
Event sent from proxy to TUI.
Error Types
PolicyError
Policy configuration or parsing error.
DecodeError
Transaction decoding error.
ProxyError
Server or network error.
Re-exported Types
Railguard re-exports commonly used types from its dependencies:
Next Steps
- API Overview — Crate overview and usage
- Configuration — Config file format
- Policy Engine — Inspection logic