Home

Awesome

Subway

Substrate JSON RPC Gateway.

This is a generalized JSON RPC proxy server with features specifically designed for Substrate RPC and Ethereum RPC.

alt text

Getting Started

Pull vendors: git submodule update --init --recursive

Quick start: cargo run -- --config configs/config.yml

This will run a proxy server with config.yml as the configuration file.

Run with RUSTFLAGS="--cfg tokio_unstable" to enable tokio-console

Environment Variables

In addition, you can refer env variables in config.yml by using following syntax:

Features

Subway is build with middleware pattern.

Middlewares

Method Middlewares

Additional features

Benchmarks

To run all benchmarks:

cargo bench

It's also possible to run individual benchmarks by:

cargo bench --bench bench ws_round_trip

Validate Middleware

This middleware will intercept all method request/responses and compare the result directly with healthy endpoint responses. This is useful for debugging to make sure the returned values are as expected. You can enable validate middleware on your config file.

middlewares:
  methods:
    - validate

NOTE: Keep in mind that if you place validate middleware before inject_params you may get false positive errors because the request will not be the same.

Ignored methods can be defined in extension config:

extensions:
  validator:
    ignore_methods:
      - system_health
      - system_name
      - system_version
      - author_pendingExtrinsics