haraldrudell / ethereum

An api gateway in Golang for Ethereum by Harald Rudell

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

github.com/haraldrudell/ethereum

Features

  • Fetching block number and block Unix time stamp from Ethereum mainnet via Infura API v3
  • Command-line and REST server invocation
  • Implementing protocol: JSON-RPC v2
  • Clever declarative JSON parsing
  • Code architected by concern: endpoint and per api processig using shared functions
  • REST server logs requests per second once per second

Command-Line Interface

go run cmd/infmain/infmain.go

infmain 0.0.1 Retrieve data from Ethereum via Infura
Last block number: 6,732,013 time stamp: 2018-11-18 22:28:59 -0800 PST

Docker

  • docker build --tag infura/haraldrudell:latest .
  • docker run --interactive --tty --publish 8000:8000 --name this --rm infura/haraldrudell:latest
  • browse to http://127.0.0.1:8000

docker run --interactive --tty --publish 8000:8000 --name this --rm infura/haraldrull:latest

2018/11/19 06:25:29 Listening at ':8000': ^C to exit…
2018/11/19 06:25:30 First tick - 1 s
2018/11/19 06:26:05 Requests per second: 1

Requirements

  • Go 1.11 modules

Load Test

go get -u github.com/tsenart/vegeta
echo 'GET http://localhost:8000' | /Users/foxyboy/go/bin/vegeta attack -duration 10s

About

An api gateway in Golang for Ethereum by Harald Rudell


Languages

Language:Go 94.0%Language:Dockerfile 6.0%