I’m a PhD student in Syracuse University in Blockchain security area, and now working on the Ethereum Mempool Attack Detection&Defence. Very excited joining in the fellowship and make some contribution to the Ethereum Portocol.
After Thanksgiving holiday, we started our work again!
In this work, We designed a system module on top of the geth mempool implementation, further more, there will be extension on OpenEthereum etc.
For the Defence, we have the first type of the
We add restriction to transaction admission and eviction policies.
Mitigation schemes: We add Four transaction-eviction rules over the underlying txpool:
ED1) Discard Future tx when txpool is full.
For instance, Here is the initial state, the pending pool is full with the existing txs with nonce n~n+m. Then, a new tx comes and wants to be added to the pending pool. So the rule is that if the new tx's nonce is not in the range of [n,n+m+1], the adding action will be denied.
ED2) txpool is full, discard this tx because it will evict other valid tx(s) and it will cause an overdraft.
For instance, the initial state is that the pending pool is full with the valid txs, and for Alice, who owned 40 Gwei has already sent three valid txs:
<tx1> Nonce 0, gas price 10 Gwei,
<tx2> Nonce 1, gas price 10 Gwei,
<tx3> Nonce 2, gas price 10 Gwei,
and they were successfully included in the pending pool. Now Alice wants to send a new tx: Nonce 2, gas price 30 Gwei. That will cause the eviction of the previous tx with nonce 2 sent from Alice. And now we find that after the eviction, the total of gas price is 10+10+30 = 50 Gwei > 40 Gwei which she owned. This situation is called overdraft, and the rules we added will discard this.
ED3) txpool is full, discard this tx that will change other vaild tx(s) to future.
For instance, consider two pending transaction tx1 of nonce n+1 and tx2 of nonce n+2. If tx1 is evicted, it makes tx2 a future transaction. Such an eviction is prohibited by ED3.
Furthermore, how to make a valid previous tx become a future tx?
There are two people, Alice and Bob. They both sent two txs to the pending pool before:
<tx1> Nonce 0, sent by Alice, gas price 10 Gwei,
<tx2> Nonce 1, sent by Alice, gas price 10 Gwei,
<tx3> Nonce 0, sent by Bob, gas price 10 Gwei,
<tx4> Nonce 1, sent by Bob, gas price 10 Gwei,
And the pool is full, now Bob sends a tx with Nonce 2, gas price 20 Gwei. So, if his arriving tx will evict <tx1> before, this will cause the tx2 to become a future tx.
ED4) discard this tx becuase it will replace itself and then cause overdraft.
It's a much similar situation with ED2, the only difference is that when the new transaction come in, the pending pool is not full, so that, the new tx doesn’t need to evict any previous valid txs.