请教大佬 Flashbots 关于矿工小费的问题

image.png

我在 goerli 测试网用 flashbots 发出两笔交易,其中一笔 0.1 eth 是给矿工的小费,另一笔 0.02 是转账给别人的。按照我的理解,接受转账的人理应收到 0.02 eth, 另外 0.1 eth 给矿工,但是实际却收到了 0.12 eth, 有没有大佬帮忙解释一下。

nonce = w3.eth.get_transaction_count(sender.address)
tx1: TxParams = {
    "to": receiverAddress,
    "value": Web3.toWei(0.02, "ether"),
    "gas": 21000,
    "maxFeePerGas": Web3.toWei(200, "gwei"),
    "maxPriorityFeePerGas": Web3.toWei(50, "gwei"),
    "nonce": nonce,
    "chainId": CHAIN_ID,
    "type": 2,
}
tx1_signed = sender.sign_transaction(tx1)

tx2: TxParams = {
    "to": receiverAddress,
    "value": Web3.toWei(0.1, "ether"),
    "gas": 21000,
    "maxFeePerGas": Web3.toWei(200, "gwei"),
    "maxPriorityFeePerGas": Web3.toWei(50, "gwei"),
    "nonce": nonce + 1,
    "chainId": CHAIN_ID,
    "type": 2,
}

bundle = [
    {"signed_transaction": tx1_signed.rawTransaction},
    {"signer": sender, "transaction": tx2},
]

# keep trying to send bundle until it gets mined
while True:
    block = w3.eth.block_number
    # send bundle targeting next block
    print(f"Sending bundle targeting block {block+1}")
    send_result = w3.flashbots.send_bundle(bundle, target_block_number=block + 1)
    send_result.wait()
    try:
        receipts = send_result.receipts()
        print(f"\nBundle was mined in block {receipts[0].blockNumber}\a")
        break
    except TransactionNotFound:
        print(f"Bundle not found in block {block+1}")
`
请先 登录 后评论

2 个回答

浪荡人
请先 登录 后评论
浪荡人
请先 登录 后评论
  • 2 关注
  • 0 收藏,2042 浏览
  • 浪荡人 提出于 2022-09-14 18:54