Skip to content

Add eth_sendPrivateTransaction support (closes #40)#62

Merged
koko1123 merged 1 commit into
mainfrom
feat/send-private-tx
Jun 10, 2026
Merged

Add eth_sendPrivateTransaction support (closes #40)#62
koko1123 merged 1 commit into
mainfrom
feat/send-private-tx

Conversation

@koko1123

@koko1123 koko1123 commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

What

Implements MEV-Share's eth_sendPrivateTransaction on flashbots.Relay per #40: submit a single private transaction with configurable searcher hints.

  • SendPrivateTxOpts: raw signed tx, optional max_block_number (omitted = relay default of current+25), optional TxPreferences (fast mode, calldata/contract_address/logs/function_selector hint flags, builder list)
  • Wire format matches the MEV-Share spec: preferences.fast + preferences.privacy.{hints,builders}; the privacy object is omitted when no hints/builders are set
  • New parseTxHashResult for the bare-string result shape (bundle methods return an object)
  • Reuses the existing X-Flashbots-Signature authenticated request path

Tests

Param-builder tests (minimal, full preferences, fast-only) with exact-JSON assertions, and result-parser tests (success, RPC error, null result). Pass on 0.16.0 and 0.17.0-dev.

Sets up MevShareClient.sendTransaction for #34.

Closes #40

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added support for sending private transactions with customizable privacy preferences, including hint options (calldata, contract address, logs, function selector), builder selection, fast mode, and inclusion block targeting.

MEV-Share private transaction submission on flashbots.Relay: single
transaction with hint preferences (calldata, contract_address, logs,
function_selector), builder selection, fast mode, and an optional max
inclusion block. Auth uses the existing X-Flashbots-Signature path.

The result parser handles the bare tx-hash string result shape, unlike
bundle responses which wrap an object.
@vercel

vercel Bot commented Jun 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
eth-zig Ready Ready Preview, Comment Jun 10, 2026 2:04pm

Request Review

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 09091de8-c619-4958-b405-a73ff078eb72

📥 Commits

Reviewing files that changed from the base of the PR and between d07f3b8 and a47d11e.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • src/flashbots.zig

📝 Walkthrough

Walkthrough

This PR adds MEV-Share's eth_sendPrivateTransaction capability to the Flashbots Relay client, enabling submission of single private transactions with configurable privacy hint preferences and builder selection. It introduces new request and response types, a public relay method, JSON-RPC parameter builders, response parsing, and comprehensive unit tests.

Changes

MEV-Share Private Transaction Submission

Layer / File(s) Summary
Request and response types
src/flashbots.zig
SendPrivateTxOpts defines transaction bytes, optional max block number, and optional TxPreferences with hint flags (calldata, contract_address, logs, function_selector) and optional builders list. SendPrivateTxResult contains the returned transaction hash.
Relay method and JSON-RPC implementation
src/flashbots.zig
Relay.sendPrivateTransaction constructs JSON-RPC params, sends an authenticated Flashbots-signed HTTP request, and parses the response. buildSendPrivateTxParams hex-encodes the transaction, conditionally emits maxBlockNumber, and generates a preferences object with fast flag and optional privacy sub-object containing hints and/or builders. parseTxHashResult validates the JSON-RPC response shape and extracts the hex transaction-hash string into SendPrivateTxResult.
Tests and changelog
src/flashbots.zig, CHANGELOG.md
Unit tests assert minimal JSON output, full preferences with privacy.hints and privacy.builders, fast-only omission of the privacy object, and response parsing success/error paths. Changelog documents the new eth_sendPrivateTransaction capability with hint preferences and builder selection.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A little hop through MEV-Share's gate,
Where privacy preferences now dictate,
Hints and builders configured just right,
Private txs bundled and out of sight! 🌙

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add eth_sendPrivateTransaction support' clearly and concisely describes the main change in the PR, which adds MEV-Share support for eth_sendPrivateTransaction to the flashbots.Relay.
Linked Issues check ✅ Passed All objectives from issue #40 are met: SendPrivateTxOpts and SendPrivateTxResult types are implemented with correct fields, TxPreferences struct includes all required hint flags and builders list, wire format follows MEV-Share spec with proper preferences/privacy structure, X-Flashbots-Signature auth is reused, and tests validate the implementation.
Out of Scope Changes check ✅ Passed All changes are directly scoped to issue #40: CHANGELOG.md documents the new feature, src/flashbots.zig implements the required types and sendPrivateTransaction method with supporting helpers and tests. No extraneous modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/send-private-tx

Warning

Review ran into problems

🔥 Problems

Stopped waiting for pipeline failures after 30000ms. One of your pipelines takes longer than our 30000ms fetch window to run, so review may not consider pipeline-failure results for inline comments if any failures occurred after the fetch window. Increase the timeout if you want to wait longer or run a @coderabbit review after the pipeline has finished.


Comment @coderabbitai help to get the list of available commands and usage tips.

@koko1123 koko1123 merged commit d272b7b into main Jun 10, 2026
14 checks passed
@koko1123 koko1123 deleted the feat/send-private-tx branch June 10, 2026 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

eth_sendPrivateTransaction support (MEV-Share private txs)

1 participant