Gas Price Recommender for Matic Network
- Make sure you've
npm
,nodejs
&make
installed - Prepare
.env
file & paste following content into it. You may want to check
pushd mgs
touch .env
Note: For
RPC
field, use websocket endpoint of Bor Node
SAFELOW=30
STANDARD=60
FAST=90
FASTEST=100
RPC=wss://<domain>
BUFFERSIZE=500
HOST=0.0.0.0
PORT=7000
- Install dependencies
popd
make install
- Run service
make run
Assuming you've docker daemon up & running,
- Build docker image
# all commands executed at root of project
make build_docker
- Create
.env
file at root of project - Run docker container
# exposes port 7000 on HOST,
# while expecting PORT field
# was untouched in .env
make run_docker
- Check docker container running
docker ps
- Check log
docker logs matic_gas_station -f # while following
- Stop container
docker stop matic_gas_station
- Restart container
docker restart matic_gas_station
- Remove container
docker rm matic_gas_station
- Remove image
docker rmi -f matic_gas_station
Note: Log rotation is enabled, max log file size 8MB, max log file count 4. For changing this see
Makefile
.
Send HTTP GET request
curl -s localhost:7000 | jq
You'll receive
{
"safeLow": 2,
"standard": 3.020000001,
"fast": 5,
"fastest": 3870.208681652,
"blockTime": 2,
"blockNumber": 15854458
}
Field | Interpretation |
---|---|
SafeLow | Minimum gas price at which X % of last N tx(s) got accepted |
Standard | -- do -- |
Fast | -- do -- |
Fastest | -- do -- |
RPC | Bor node's websocket endpoint URL |
BufferSize | Last N tx(s) considered when recommending |
Host | Run HTTP server on interface address |
Port | Accept connections on port |
Field | Interpretation |
---|---|
SafeLow | Lowest possible recommended gas price |
Standard | Average gas price seen ( Recommended ) |
Fast | Tx should be included in ~30 sec |
Fastest | Targeted towards traders, super fast inclusion possibility |
BlockTime | Observed delay between two recently mined consequtive blocks |
BlockNumber | Latest considered block in recommendation |
Note: All gas prices in
Gwei