On April 10, 2024, MEV Blocker Private RPC started charging a fee paid by the builders. The accounting processes are seeded through the MEVBlockerFeeTill contract deployed on Ethereum Mainnet at 0x08Cd77fEB3fB28CC1606A91E0Ea2f5e3EABa1A9a.
The billing process is achieved through calling the bill
method on this contract (restricted to onlyBiller
).
The data supplied to the billing method is aggregated by the following:
Dune Queries:
Cf. https://github.com/cowprotocol/dune-queries/tree/main/mevblocker/fees
- Mainnet: https://etherscan.io/address/0x08Cd77fEB3fB28CC1606A91E0Ea2f5e3EABa1A9a
- Testnet: https://sepolia.etherscan.io/address/0xF1436859a0F04A827b79F8c92736F6331ebB64A1
This project has two primary functions - billing and drafting which can be run as described in the docker section below.
Both functions require the following common environment variables be set:
# Address of billing contract.
BILLING_CONTRACT_ADDRESS
# For communication with EVM node and transaction broadcasting.
RPC_URL
# Used to link users to transaction in block explorer.
SCAN_URL
as well as the following secrets
# Used for Dune Query execution.
DUNE_API_KEY
# Used to sign transactions executions on the billing contract.
BILLER_PRIVATE_KEY
# API Key for slack notifcations
SLACK_TOKEN
# Channel to post success results in slack.
SLACK_CHANNEL
Can be executed by anyone listed as a "biller" on the MEVBlockerFeeTill contract linked above. Requires two additional environment variables:
# Dune QueryId of Payments Due every week
BILLING_QUERY=4005800
# Dune QueryId for computing the monthly fee value.
FEE_QUERY=4002039
Technically both the draft and fine functions are restricted (by the contract) to onlyOwner
, so in order to execute these, one will have to install the Zodiac Roles Module on the owner (Safe) account of the contract and give access to the Biller Account
. Instructions to enable and configure the specific roles can be found below.
Assuming the roles are appropriately confugured this program requires the following additional environment variables:
# A 32-byte hex string associated to the configured zodiac roles.
ZODIAC_ROLE_KEY
# Dune Query ID for detecting unpaid bills.
PAYMENT_QUERY=4016152
# Minimum fine to charge for drafting (in ETH)
FINE_MIN=0.001
# Minimum account balance required to stay connected to the network. (in ETH)
BOND_THRESHOLD=10
Notes on:
-
FINE_MIN
: The program dynamically computes the fine as the execution cost of drafting & fining, but always fines charges at least theFINE_MIN
. If set to zero, the program will always use dynamically evaluated fines. The value ofFINE_MIN
changes the way that participants might "play the game". For example, If the fine is 25$, users would be more inclined to pay their own bills, but at gas costs they might just top up their balances once a year and let this program draft them. -
BOND_THRESHOLD
: This is the balance that must be held by the user inside the contract to remain connected to the transaction flow. Currently the default is 10 ETH. -
BOND_MAP
: There is currently only one participant who has a "redirected" billing address. That is the account billed is different than the account who provided the bond and who pays the bills.
- Navigate to the Apps section of the Owner Safe
- Find the Zodiac Module (appUrl=https://zodiac.gnosisguild.org/)
- [Requires Safe Transaction] Add the Roles Modifier Module. Here is a sample sepolia transaction
- [Requires Safe Transaction] Define the role that can execute both
draft
andfine
on theMevBlockerTill
contract. For this you can use cowanator's fork of the safe-roles CLI tool. Instructions are in the linked pull request of @cowanator's fork. Runningyarn apply mb-draft eth:0x76F7a89C1eb4502b911CF58f7Aa7c2A1dA844F80
there will redirect you back to the safe roles. Here is a sample sepolia transaction - [Requires Safe Transaction] Assign Roles Add the EOA account you would like to execute the
draft
andfine
function. This can be done from within the safe Zodiac app. This project's test suite used the biller account for this purpose (so that only one key needs to ) Here is a sample seplolia transaction - Celebrate - You just installed and configured a Zodiac Role Modifier!
# Install
yarn
# Copy and fill environment variables
cp .env.sample .env
Some values are filled, but others require secrets (DUNE_API_KEY
, BILLER_PRIVATE_KEY
for billing and ZODIAC_ROLE_KEY
for drafting).
Run the Script:
# Billing: Requires `BILLER_PRIVATE_KEY`
yarn main billing
# Drafting: If no module is configured will simply post draft status
yarn main drafting
Build
docker build -t mb-billing .
where PROGRAM
is one of {billing, drafting}.
Run
# Local:
docker run --rm --env-file .env mb-billing $PROGRAM
# Published Image:
docker run --rm --env-file .env ghcr.io/cowdao-grants/mb-billing:main $PROGRAM
where PROGRAM
is one of {billing, drafting}.