The Ethereum Gas Price Extractor is a Go program designed to extract a sample of gas price values from successful Ethereum transactions for every block using the Etherscan and Infura APIs. Gas price values are an essential aspect of Ethereum transactions as they determine the fee paid to miners for processing transactions on the network. This tool provides valuable insights into the varying gas prices within the Ethereum blockchain.
To run this program, ensure you have the following installed:
- Go programming language (version 1.14 or higher)
- Three or more Etherscan API keys to access their API services and run the program smoothly.
- Three or more Infura API keys to access their Ethereum node API continuously.
- Clone this repository to your local machine:
git clone https://github.com/dileepaj/eth-data-collection.git
cd block-data-collection
- Install the required Go packages:
go mod download
- Make sure you have obtained the API keys from Etherscan and Infura.
- Create .env file with INFURA_API_KEYS= your Infura API keys only separated by commas and ETHERSCAN_KEYS= your Ethersacn API keys only separated by commas.
- Run the Ethereum Gas Price Extractor program:
go run main.go
The program will connect to the Infura Ethereum node and use the Etherscan API to start extracting gas price samples from successful transactions.
The extracted gas price values will be stored in separate CSV files, one file for each block, in the 'block-data-collection' The files, will be named using the block number, for example: '1345678.csv', '1345679.csv', etc.
Timestamp | Gas Price (Gwei) |
---|---|
Jun-11-27 ... | 100 |
Jun-11-27 ... | 95 |
Jun-11-27 ... | 110 |
Jun-11-27 ... | 105 |
... | ... |
You can modify 'gasDataCollector.go' file to customize the behavior of the Ethereum Gas Price Extractor.
Contributions are welcome! If you find any bugs or have ideas for improvements, feel free to open an issue or submit a pull request.
This project is licensed under the GNU General Public License (GPL). Feel free to modify and use the codebase according to your requirements.