Skip to content

starfishlabs/oasis-evm-web3-gateway

 
 

Repository files navigation

oasis-evm-web3-gateway

ci-lint ci-test codecov

Web3 Gateway for Oasis Emerald EVM.

Building and Testing

Prerequisites

  • Go (at least version 1.17.3).
  • PostgreSQL (at least version 13.3).

Additionally, for testing:

Build

To build the binary run:

go build

Test

To run tests:

Start PostgreSQL (for testing Postgres Docker container can be used):

docker run --rm --name postgres -e POSTGRES_PASSWORD=postgres -p 5432:5432 postgres:13.3-alpine

In a separate terminal, start an Oasis development network:

export OASIS_EMERALD_VERSION=6.0.0
export OASIS_NET_RUNNER=<path-to-oasis-core-artifacts>/oasis-net-runner
export OASIS_NODE=<path-to-oasis-core-artifacts>/oasis-node
export OASIS_EMERALD_PARATIME=<path-to-emerald-paratime>/emerald-paratime
export OASIS_NODE_DATADIR=/tmp/oasis-evm-gateway-tests

./tests/tools/spinup-oasis-stack.sh

Run tests:

go test ./...

Running the Gateway on Testnet/Mainnet

The gateway connects to an Emerald enabled Oasis Paratime Client Node.

Set up the config file (e.g. gateway.yml) appropriately:

runtime_id: <emerald_paratime_id>
node_address: "unix:<path-to-oasis-node-unix-socket>"
enable_pruning: false
pruning_step: 100000

log:
  level: debug
  format: json

database:
  host: <postgresql_host>
  port: <postgresql_port>
  db: <postgresql_db>
  user: <postgresql_user>
  password: <postgresql_password>
  dial_timeout: 5
  read_timeout: 10
  write_timeout: 5
  max_open_conns: 0

gateway:
  chain_id: <emerald_chain_id>
  http:
    host: <gateway_listen_interface>
    port: <gateway_listen_port>
  ws:
    host: <gateway_listen_interface>
    port: <gateway_listen_websocket_port>
  method_limits:
    get_logs_max_rounds: 100

Note: all configuration settings can also be set via environment variables. For example to set the database password use:

DATABASE__PASSWORD: <postgresql_password>

environment variable.

Start the gateway by running the oasis-evm-web3-gateway binary:

oasis-evm-web3-gateway --config gateway.yml

Credits

Parts of the code heavily based on go-ethereum.

About

The web3 gateway for Oasis EVM

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 98.7%
  • Shell 1.3%