GithubHelp home page GithubHelp logo

maticgasstation's Introduction

maticgasstation

MaticGasStation Network is a REST API service that provides current gas price recommendations for Polygon PoS and Zkevm transactions. This service offers developers a convenient way to retrieve real-time gas prices and make informed decisions about transaction fees on the Polygon PoS and Zkevm network.

Installation

$ git clone https://github.com/maticnetwork/
$ npm install
  • Prepare .env file & paste following content in .env.sample file into it. You may want to check configuratoin.
touch .env

Example

POS_RPC=<pos rpc url>
ZKEVM_RPC=<zkevm rpc url>
PORT=7000
SAFE=5
STANDARD=15
FAST=30
HISTORY_BLOCKS=15
  • Run service
npm start
  • Run tests
npm tests

Dockerised Setup

Assuming you've docker set up & running,

  • Build docker image with tag mgs
# all commands executed at root of project

docker build . -t mgs
  • Run docker image at port 7000 and name the container
docker run -p 7000 -d --name matic_gas_station mgs
  • Check docker container running
docker ps
  • Check log
docker logs -f matic_gas_station
  • 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

Usage

PoS v1

Request

curl -s localhost:7000/pos/v1

Response

{
	"success": true,
	"data": {
		"safeLow": 129.47556613,
		"standard": 129.47556613,
		"fast": 129.47556613,
		"blockTime": 2,
		"blockNumber": 45068237
	}
}

PoS v2

Request

curl -s localhost:7000/pos

(or)

curl -s localhost:7000/pos/v2

Response

{
	"success": true,
	"data": {
		"safeLow": {
			"maxPriorityFee": 30,
			"maxFee": 189.831563019
		},
		"standard": {
			"maxPriorityFee": 30,
			"maxFee": 189.831563019
		},
		"fast": {
			"maxPriorityFee": 31.931367927,
			"maxFee": 191.762930946
		},
		"estimatedBaseFee": 159.831563019,
		"blockTime": 2,
		"blockNumber": 45068158
	}
}

Zkevm

Request

curl -s localhost:7000/zkevm

Response

{
	"success": true,
	"data": {
		"safeLow": 1.04,
		"standard": 1.04,
		"fast": 1.04,
		"blockTime": 1.5,
		"blockNumber": 2526102
	}
}

Interpretation

Configuration

Field Interpretation
Safe Minimum gas price at which X % of last N tx(s) got accepted
Standard Average gas price at which X % of last N tx(s) got accepted
Fast Highest gas price at which X % of last N tx(s) got accepted
POS_RPC PoS node's endpoint
ZKEVM_PRC Zkevm node's endpoint
Port Accept connections on port
HistoryOfBlocks The last N history of blocks

Response

Field Interpretation
SafeLow Lowest possible recommended gas price
Standard Average gas price seen ( Recommended )
Fast Tx should be included in ~30 sec
BlockTime Observed delay between two recently mined consequtive blocks
BlockNumber Latest considered block in recommendation

Note: All gas prices in Gwei

Support

Our Discord is the best way to reach us โœจ.

Contributing

You are very welcome to contribute, please see contributing guidelines - [Contribute].

Thank you to all the people who already contributed to maticgasstation!

Made with contributors-img.

License

MIT

maticgasstation's People

Contributors

itzmeanjan avatar py-zoid avatar nitinmittal23 avatar krishna9810 avatar brixial avatar himanshupillow avatar sanchaymittal avatar mt-polygon-technology avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.