ethers-provider-flashbots-bundle icon indicating copy to clipboard operation
ethers-provider-flashbots-bundle copied to clipboard

Carrier-tx extension

Open lmanini opened this issue 4 years ago • 0 comments

Hey all, creating my first PR for the repo: finalized the first version of the carrier-tx extension for the provider. With these changes, users will be able to use the publish method to submit a bundle through the public mempool, which can only be decrypted by a target validator, chosen by the user.

Please note that currently:

  1. publish() only returns a Promise<TransactionResponse> for the carrier transaction: I would like for this method to also return some details about the bundle, but I'm not sure how to implement this.
  2. publish() requires the user to pass it, among other things, a potentially empty TransactionRequest to use as the carrier transaction: this object will be populated with default values if any of the following fields ['to', 'value', 'gasLimit', 'gasPrice', 'nonce'] are missing (I would love to be able to calculate the exact gasLimit for the carrier transaction, but found discording resources online noting different gas costs for every non-zero byte in a transaction's data field, anyone know what we could use?)
  3. As per the spec, the carrier's data field begins with a MEV Prefix which I have set to 0x0123 as a placeholder, until a proper prefix is agreed upon.

This extension has also been tested with a small script and I'm able to fully recreate the FlashbotsBundle passed as an argument to the publish() method. Will not include it in this PR as I feel it doesn't regard this repo, will be happy to share the script if anyone wants to try for themselves.

I'm also attaching a small file to showcase how one would use the extension. carrierTx-demo.txt

Please let me know if any aspect of this is not clear to you, any doubts you may have, or if you would like further explanation on any aspect of this extension.

PS: all names have been selected solely by me, will gladly change them if we find better alternatives!

lmanini avatar Aug 20 '21 15:08 lmanini