揭秘 Flashbot:保護您的以太坊交易並利用 MEV(最大可提取價值)

本文為機器翻譯
展示原文

介紹

在不斷發展的以太坊領域,礦工(現為驗證者)對區塊內交易的納入具有一定程度的影響力。這種影響力可以用來獲取額外的價值,通常以犧牲普通用戶為代價。這種現象被稱為最大可提取價值 (MEV)。Flashbots 作為一種解決方案應運而生,旨在減輕 MEV 的影響並讓用戶更好地控制自己的交易。

Đây là cách có thể bảo vệ blockchain Ethereum khỏi bị thao túng

什麼是 Flashbots?

Flashbots Transparency Report — February 2021 - The Flashbots Ship - The  Flashbots Collective

Flashbots 是一家研究和開發組織,致力於減輕最大可提取價值 (MEV) 的負面外部性,並避免 MEV 可能對以太坊等有狀態區塊鏈造成的生存風險。我們的主要重點是通過三管齊下的方法為 MEV 實現無需許可透明可持續的生態系統:

使用Flashbots的好處

增強交易速度: Flashbots 交易通常比公共內存池中滯留的交易更快地獲得納入,從而加快了確認速度。

MEV 保護:通過繞過公共內存池,Flashbots 可以保護您的交易免受可能試圖操縱交易以謀取私利的 MEV 機器人的攻擊。

靈活性: Flashbots 允許用戶指定他們願意向區塊構建者提供的最大 MEV 份額,從而確保透明度。

誰應該考慮使用 Flashbots?

雖然 Flashbots 具有諸多優勢,但它主要針對特定​​的用戶群體:

在 JavaScript 中使用 Flashbots Protect

先決條件:

一步步:

  1. 項目設置:

  2. 安裝依賴項:

  3. 創建 JavaScript 文件:

  4. 導入庫

    const ethers = require("ethers.js");const { FlashbotsBundleProvider,} = require("@flashbots/ethers-provider-bundle");
  5. 定義交易細節:

     // Standard json rpc provider directly from ethers.js. You can use Infura, Alchemy, or your own node.const provider = new ethers.providers.JsonRpcProvider({url: ETHEREUM_RPC_URL,});// `authSigner` is an Ethereum private key that does NOT store funds and is NOT your bot's primary key.// This is an identifying key for signing payloads to establish reputation and whitelistingconst authSigner = new ethers.Wallet("0x0000000000000000000000000000000000000000000000000000000000000000");// Flashbots provider requires passing in a standard provider and an auth signerconst flashbotsProvider = await FlashbotsBundleProvider.create(provider,authSigner);
  6. 創建交易:

     const transaction = {from: signer.address,to: signer.address,value: "0x42",gasPrice: BigNumber.from(99).mul(1e9),gasLimit: BigNumber.from(21000),};
  7. 發送交易:

     const res = await flashbotsProvider.sendPrivateTransaction({transaction,signer,},{maxBlockNumber: (await provider.getBlockNumber()) + 5, // only allow tx to be included for the next 5 blocks},);
  8. 檢查已發送交易的狀態:

     const waitRes = await res.wait();if (waitRes === FlashbotsTransactionResolution.TransactionIncluded) {console.log("Private transaction successfully included on-chain.");} else if (waitRes === FlashbotsTransactionResolution.TransactionDropped) {console.log("Private transaction was not included in a block and has been removed from the system.",);}

更多文檔: https://docs.flashbots.net/flashbots-protect

結論

總之,Flashbots 代表了以太坊交易處理的革命性進步,提供了增強的隱私性、效率和安全性。通過繞過公共內存池並促進與礦工的直接互動,Flashbots 使用戶能夠以前所未有的速度和隱私性執行交易,徹底改變了我們與去中心化應用程序互動的方式。隨著以太坊生態系統的不斷發展,Flashbots 將在塑造區塊鏈技術的未來方面發揮關鍵作用,使用戶和開發人員都能在去中心化金融、數字所有權等領域開啟新的可能性。

感謝閱讀 Verichains!免費訂閱以接收新帖子並支持我的工作。

來源
免責聲明:以上內容僅為作者觀點,不代表Followin的任何立場,不構成與Followin相關的任何投資建議。
喜歡
收藏
評論