Skip to content

An attempt to use probabilistic programming (Pyro) to infer how much gas one needs to pay, to get one's transaction accepted in the next block with 50% certainty.

Notifications You must be signed in to change notification settings

hannespfeiffer/Ethereum-transaction-acceptance-estimation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ethereum transaction acceptance estimation

An attempt to use probabilistic programming (Pyro) to infer how much one needs to pay for gas, to get one's transaction of at least $2000 of a stable coin (USDT, USDC, DAI) accepted in the next block with 50% certainty. Note: code was written pre-EIP1559

Disclaimer: This repo should not be seen as rigorous, production-ready code; moreso a simple study of probabilistic programming. The code was mostly adapted from one of Pyro's examples (link in notebook).

Ethereum transactions and the Mempool

blocks

Given transaction event observations of 4 blocks (transactions entering the Mempool and transactions getting confirmed/stuck), we try to infer, how high the gas price would need to be, in order for a transaction to be accepted with 50% probability. The probability of getting accepted is modeled via a sigmoid function (logistic regression). This probability is used to sample from a Bernoulli distribution. As starting points for the priors, several parameter settings were explored, mainly using the (proprietarily computed by API provider) confidence levels of the same API which gives us the transactions events, which start at 70% and go up to 99%.

Results for block 12108388:

image

Both graphs show the prior and posterior(s). The first graph shows the prior gas price distribution, at which's mean (the API provider guessed) ~70% of transactions should be accepted and our posterior gas price distribution, at which's mean (we inferred) 50% should be accepted. The second graph visualizes how the posterior evolves through seeing more data. Blue is less data and green is more data.

About

An attempt to use probabilistic programming (Pyro) to infer how much gas one needs to pay, to get one's transaction accepted in the next block with 50% certainty.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published