Skip to content

Commit

Permalink
refactor: rename priority fee gwei to just priority fee. Adjust docs …
Browse files Browse the repository at this point in the history
…acccordingly
  • Loading branch information
Evan-Kim2028 committed Dec 27, 2024
1 parent c70bd4c commit 2fea175
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 16 deletions.
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
## About
This repository provides a user friendly CLI interface for making preconfirmation bids from mev-commit for ETH transfers or blob transactions. Transactions are sent directly to the builder as transaction payloads. Currently a fixed priority fee is used alongside a preconf bid amount.
This repository provides a user friendly CLI interface for making preconfirmation bids from mev-commit for ETH transfers or blob transactions. Additionally a bidder can spin up the docker container and run directly with the example [bidder node docker](https://github.com/primev/bidder_node_docker)

Transactions are sent directly to the builder as transaction payloads. Currently a fixed priority fee is used alongside a preconf bid amount.

If you’re an advanced user, you can still skip the interactive mode by specifying all configurations via environment variables, .env files, or command-line flags.


## Requirements
- funded holesky address
- funded mev-commit address
- mev-commit p2p bidder node (v0.7)
- mev-commit p2p bidder node (v0.8)
- a good websocket endpoint (a publicly available one is set as default, but cannot handle high throughput)

## Installation
Expand All @@ -24,15 +26,16 @@ Ensure that the .env file is filled out with all of the variables.
RPC_ENDPOINT=rpc_endpoint # optional, not needed if `USE_PAYLOAD` is true.
WS_ENDPOINT=ws_endpoint
PRIVATE_KEY=private_key # L1 private key
USE_PAYLOAD=true # sends tx payload direclty to providers.
USE_PAYLOAD=true # sends tx payload direclty to providers (Default is true).
SERVER_ADDRESS="localhost:13524" # address of the server (Default localhost:13524 to run locally)
OFFSET=1 # of blocks in the future to ask for the preconf bid (Default 1 for next block)
NUM_BLOB=0 # blob count of 0 will just send eth transfers (Default 0)
BID_AMOUNT=0.001 # preconf bid amount (Default 0.001 ETH)
PRIORITY_FEE=1 # priority fee in wei (Default 1 gwei)
BID_AMOUNT_STD_DEV_PERCENTAGE=100 # amount of variation in the preconf bid amount (in %) (Default 100%)
DEFAULT_TIMEOUT=15 # default context timeout for the program (Default 15 seconds)
APP_NAME=preconf_bidder # application name for logging purposes
VERSION=0.8.0 # mev-commit version for logging purposes
APP_NAME=preconf_bidder # application name for logging purposes (Default name preconf_bidder)
VERSION=0.8.0 # mev-commit version for logging purposes (Default version v0.8.0)
```
## How to run
Ensure that the mev-commit bidder node is running in the background. A quickstart can be found [here](https://docs.primev.xyz/get-started/quickstart), which will get the latest mev-commit version and start running it with an auto generated private key.
Expand Down
Binary file modified biddercli
Binary file not shown.
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ services:
- PRIVATE_KEY=${PRIVATE_KEY}
- RPC_ENDPOINT=${RPC_ENDPOINT}
- WS_ENDPOINT=${WS_ENDPOINT}
- USE_PAYLOAD=${USE_PAYLOAD:-true} # Use "true" if USE_PAYLOAD is unset or empty
- USE_PAYLOAD=${USE_PAYLOAD:-true}
- SERVER_ADDRESS=${SERVER_ADDRESS}
- OFFSET=${OFFSET}
- NUM_BLOB=${NUM_BLOB}
- BID_AMOUNT=${BID_AMOUNT}
- BID_AMOUNT_STD_DEV_PERCENTAGE=${BID_AMOUNT_STD_DEV_PERCENTAGE}
- DEFAULT_TIMEOUT=${DEFAULT_TIMEOUT}
- PRIORITY_FEE=${PRIORITY_FEE}
networks:
app-network:
external: true
1 change: 1 addition & 0 deletions env.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ OFFSET=1
# 0 blobs means eth transfer. Otehrwise a nonzero blob count will send blobs
NUM_BLOB=0
BID_AMOUNT=0.0025
PRIORITY_FEE=1
BID_AMOUNT_STD_DEV_PERCENTAGE=200
DEFAULT_TIMEOUT=15
APP_NAME=preconf_bidder
Expand Down
20 changes: 10 additions & 10 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const (
FlagAppName = "app-name"
FlagVersion = "version"

FlagPriorityFeeGwei = "priority-fee-gwei"
FlagPriorityFee = "priority-fee"
)

// promptForInput prompts the user for input and returns the entered string
Expand Down Expand Up @@ -202,7 +202,7 @@ func main() {
fmt.Println(" --ws-endpoint The WebSocket endpoint for your Ethereum node")
fmt.Println(" --rpc-endpoint The RPC endpoint if not using payload")
fmt.Println(" --bid-amount The amount to bid (in ETH), default 0.001")
fmt.Println(" --priority-fee-gwei The priority fee in gwei, default 1")
fmt.Println(" --priority-fee The priority fee in wei, default 1")
fmt.Println(" --bid-amount-std-dev-percentage Std dev percentage of bid amount, default 100.0")
fmt.Println(" --num-blob Number of blob transactions to send, default 0 makes the tx an eth transfer")
fmt.Println(" --default-timeout Default client context timeout in seconds, default 15")
Expand All @@ -223,7 +223,7 @@ func main() {
privateKeyHex := getOrDefault(c, FlagPrivateKey, "PRIVATE_KEY", "") // No default, required
offset := getOrDefaultUint64(c, FlagOffset, "OFFSET", 1)
bidAmount := getOrDefaultFloat64(c, FlagBidAmount, "BID_AMOUNT", 0.001)
priorityFeeGwei := getOrDefaultUint64(c, FlagPriorityFeeGwei, "PRIORITY_FEE_GWEI", 1)
priorityFee := getOrDefaultUint64(c, FlagPriorityFee, "PRIORITY_FEE", 1)
stdDevPercentage := getOrDefaultFloat64(c, FlagBidAmountStdDevPercentage, "BID_AMOUNT_STD_DEV_PERCENTAGE", 100.0)
numBlob := getOrDefaultUint(c, FlagNumBlob, "NUM_BLOB", 0)
defaultTimeoutSeconds := getOrDefaultUint(c, FlagDefaultTimeout, "DEFAULT_TIMEOUT", 15)
Expand Down Expand Up @@ -288,7 +288,7 @@ func main() {
fmt.Printf(" - Server Address: %s\n", serverAddress)
fmt.Printf(" - Use Payload: %v\n", usePayload)
fmt.Printf(" - Bid Amount: %f ETH\n", bidAmount)
fmt.Printf(" - Priority Fee: %d gwei\n", priorityFeeGwei)
fmt.Printf(" - Priority Fee: %d wei\n", priorityFee)
fmt.Printf(" - Standard Deviation: %f%%\n", stdDevPercentage)
fmt.Printf(" - Number of Blobs: %d\n", numBlob)
fmt.Printf(" - Default Timeout: %d seconds\n", defaultTimeoutSeconds)
Expand All @@ -311,7 +311,7 @@ func main() {
"offset", offset,
"usePayload", usePayload,
"bidAmount", bidAmount,
"priorityFeeGwei", priorityFeeGwei,
"priorityFee", priorityFee,
"stdDevPercentage", stdDevPercentage,
"numBlob", numBlob,
"privateKeyProvided", privateKeyHex != "",
Expand Down Expand Up @@ -388,10 +388,10 @@ func main() {
if numBlob == 0 {
// Perform ETH Transfer
amount := big.NewInt(1e15)
signedTx, blockNumber, err = ee.SelfETHTransfer(wsClient, authAcct, amount, offset, big.NewInt(int64(priorityFeeGwei)))
signedTx, blockNumber, err = ee.SelfETHTransfer(wsClient, authAcct, amount, offset, big.NewInt(int64(priorityFee)))
} else {
// Execute Blob Transaction
signedTx, blockNumber, err = ee.ExecuteBlobTransaction(wsClient, authAcct, int(numBlob), offset, big.NewInt(int64(priorityFeeGwei)))
signedTx, blockNumber, err = ee.ExecuteBlobTransaction(wsClient, authAcct, int(numBlob), offset, big.NewInt(int64(priorityFee)))
}

if signedTx == nil {
Expand Down Expand Up @@ -522,9 +522,9 @@ func main() {
Value: "0.8.0",
},
&cli.Int64Flag{
Name: FlagPriorityFeeGwei,
Usage: "Priority fee in gwei",
EnvVars: []string{"PRIORITY_FEE_GWEI"},
Name: FlagPriorityFee,
Usage: "Priority fee in wei",
EnvVars: []string{"PRIORITY_FEE"},
Value: 1,
},
},
Expand Down

0 comments on commit 2fea175

Please sign in to comment.