@pulsadev/flashbots
v0.1.0
Published
Flashbots bundle builder — private transactions, MEV protection, bundle simulation, MEV-Share. Zero dependencies.
Downloads
51
Readme
@pulsadev/flashbots
Flashbots bundle builder — private transactions, MEV protection, bundle simulation, MEV-Share. Zero dependencies.
Send transactions privately, build MEV bundles, simulate execution. No ethers, no viem required.
Features
- Private transactions — send via Flashbots Protect, MEV Blocker, or any builder
- Bundle submission —
eth_sendBundlewith multiple txs, atomic execution - Bundle simulation —
eth_callBundleto preview results before submission - Bundle stats —
flashbots_getBundleStatsV2for tracking - MEV-Share —
mev_sendBundlefor MEV revenue sharing - Cancel private tx — cancel pending private transactions
- Built-in builder registry — Flashbots, Titan, rsync, MEV Blocker
- Zero dependencies — ~7 KB bundled, ESM + CJS, pure TypeScript
Install
npm install @pulsadev/flashbotsQuick Start
Send private transaction (MEV protected)
import { sendProtectedTransaction } from '@pulsadev/flashbots'
const txHash = await sendProtectedTransaction(signedTx)
// Sent via Flashbots Protect — not visible in public mempoolSend bundle
import { createBundle, sendBundle, simulateBundle } from '@pulsadev/flashbots'
const bundle = createBundle(
[signedTx1, signedTx2],
targetBlockNumber,
)
// Simulate first
const sim = await simulateBundle(bundle, currentBlock)
if (sim.success) {
const result = await sendBundle(bundle)
console.log('Bundle hash:', result.bundleHash)
}MEV-Share bundle
import { createMevShareBundle, sendMevShareBundle } from '@pulsadev/flashbots'
const bundle = createMevShareBundle([signedTx], blockNumber, blockNumber + 5n)
const result = await sendMevShareBundle(bundle)Use different builders
import { sendBundle, getBuilders, getBundleRelays } from '@pulsadev/flashbots'
const relays = getBundleRelays(1) // All Ethereum bundle relays
for (const relay of relays) {
await sendBundle(bundle, relay.rpcUrl) // Send to all builders
}API
Transactions
| Function | Description |
|----------|-------------|
| sendProtectedTransaction(signedTx, rpcUrl?) | Send via Flashbots Protect RPC |
| sendPrivateTransaction(signedTx, options?, rpcUrl?) | Send private tx with options |
| cancelPrivateTransaction(txHash, rpcUrl?) | Cancel pending private tx |
Bundles
| Function | Description |
|----------|-------------|
| createBundle(txs, blockNumber, options?) | Create a bundle |
| sendBundle(bundle, relayUrl?) | Submit bundle to relay |
| simulateBundle(bundle, stateBlock, relayUrl?) | Simulate bundle execution |
| getBundleStats(bundleHash, blockNumber, relayUrl?) | Get bundle status |
MEV-Share
| Function | Description |
|----------|-------------|
| createMevShareBundle(txs, block, maxBlock?) | Create MEV-Share bundle |
| sendMevShareBundle(bundle, relayUrl?) | Submit to MEV-Share |
Builder Registry
| Function | Description |
|----------|-------------|
| getBuilders(chainId) | All builders for a chain |
| getBundleRelays(chainId) | Bundle-supporting relays |
| getPrivateTxRelays(chainId) | Private tx relays |
| getProtectRpc(chainId) | Flashbots Protect RPC URL |
License
MIT © Yuto Nakamura
