Skip to content

a quick way to calculate gas costs for a bunch of accounts

Notifications You must be signed in to change notification settings

banteg/gas-costs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gas costs

a quick way to calculate gas costs for a bunch of accounts, which works locally and privately against your ethereum client.

install

uv venv
uv pip sync requirements.txt

how to use it

create an input file addresses.txt with one address on each line, then run to pull data from block 10,000,000 till head.

python gas_costs.py addresses.txt 10000000

the script will save both per-transaction and per-account reports in the reports folder, with a block range in the name so you know where to pick up from next time.

the per-account file can be used for sending gas reimbursements.

another script called safe_costs.py accepts a list of gnosis safe addresses as input and outputs the costs incurred by accounts who called execTransaction, including failed ones.

how it works

  1. find all outgoing transactions using trace_filter using batches of 100,000 blocks.
  2. fetch all receipts using jsonrpc batches and calc gasUsed * effectiveGasPrice.

everything is fetched in parallel and by the time traces are finished, receipts are usually finished too.

About

a quick way to calculate gas costs for a bunch of accounts

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages