GuardianLabs / polygon-dash

Miner watch dashboard for Polygon
0 stars 3 forks source link

Simple transaction pre-confirmation algorithm #36

Open ichorid opened 10 months ago

ichorid commented 10 months ago

The algorithm estimates how long a transaction must wait until it is accepted into a block. The estimation is based on its mempool popularity, gas fees, etc. In time, we will be able to analyze the historical mempool data and find better strategies.

Accurate estimation of the likelihood that transaction will be accepted (or not) within the next X blocks.
The estimation is expressed in confidence from 0% to 100%. The estimation is by design conservative.

For the first version, we want the simplest solution possible.

Algorithm Details

The algorithm will be developed incrementally in phases.

Phase 1. Simple Algorithm based on Gas Estimate of pending transactions

We closely monitor the network for pending transactions and record those into our local database with a timestamp. Each new transaction goes into the “pending” list. We also monitor the blocks to mark some pending transactions as “final.” When marked as “final,” they are removed from the pending list. The pending transactions are sorted/ranked according to their priority in the block. Gray transactions are all pending transactions, and blue transactions are transactions that (we estimate) will be selected for the next block. When a user requests if some transaction X has priority, we answer High if it is in the estimated selected subset and Low if not.

image

Similar Projects and Links

BlockCypher - Bitcoin confidence factor

https://www.blockcypher.com/dev/bitcoin/#confidence-factor

https://eprint.iacr.org/2012/248.pdf

ichorid commented 10 months ago

@grimadas , please elaborate the algorithm details here