Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for rpc endpoint eth_callBundle #29862

Closed
monperrus opened this issue May 28, 2024 · 5 comments
Closed

add support for rpc endpoint eth_callBundle #29862

monperrus opened this issue May 28, 2024 · 5 comments

Comments

@monperrus
Copy link

Rationale

It would be useful to add support for a new RPC endpoint eth_callBundle that supports speculatively study of the execution of a sequence of transactions.

What are the use-cases?

  • Research, to study what-if scenarios on past blocks, what if this transaction had come first in the past? (eg what if a white hat counter transaction had been included before the attacker one?)
  • MEV, this is the first historically known usage of eth_callbundle

Known existing implementations:

See a draft implementation at release/1.14...NaliFinance:mev-geth:release/1.14

Implementation of eth_callBundle

eth_callBundle can be used to simulate a bundle of transactions against a specific block number, including simulating a bundle at the top of the next block. The eth_callBundle RPC has the following payload format:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_callBundle",
  "params": [
    {
      txs,               // Array[String], A list of signed transactions to execute in an atomic bundle
      blockNumber,       // String, a hex encoded block number for which this bundle is valid on
      stateBlockNumber,  // String, either a hex encoded number or a block tag for which state to base this simulation on. Can use "latest"
      timestamp,         // (Optional) Number, the timestamp to use for this bundle simulation, in seconds since the unix epoch
    }
  ]
}

example:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_callBundle",
  "params": [
    {
      "txs": ["0x123abc...", "0x456def..."],
      "blockNumber": "0xb63dcd",
      "stateBlockNumber": "latest",
      "timestamp": 1615920932
    }
  ]
}

example response:

{
  "jsonrpc": "2.0",
  "id": "123",
  "result": {
    "bundleGasPrice": "476190476193",
    "bundleHash": "0x73b1e258c7a42fd0230b2fd05529c5d4b6fcb66c227783f8bece8aeacdd1db2e",
    "coinbaseDiff": "20000000000126000",
    "ethSentToCoinbase": "20000000000000000",
    "gasFees": "126000",
    "results": [
      {
        "coinbaseDiff": "10000000000063000",
        "ethSentToCoinbase": "10000000000000000",
        "fromAddress": "0x02A727155aeF8609c9f7F2179b2a1f560B39F5A0",
        "gasFees": "63000",
        "gasPrice": "476190476193",
        "gasUsed": 21000,
        "toAddress": "0x73625f59CAdc5009Cb458B751b3E7b6b48C06f2C",
        "txHash": "0x669b4704a7d993a946cdd6e2f95233f308ce0c4649d2e04944e8299efcaa098a",
        "value": "0x"
      },
      {
        "coinbaseDiff": "10000000000063000",
        "ethSentToCoinbase": "10000000000000000",
        "fromAddress": "0x02A727155aeF8609c9f7F2179b2a1f560B39F5A0",
        "gasFees": "63000",
        "gasPrice": "476190476193",
        "gasUsed": 21000,
        "toAddress": "0x73625f59CAdc5009Cb458B751b3E7b6b48C06f2C",
        "txHash": "0xa839ee83465657cac01adc1d50d96c1b586ed498120a84a64749c0034b4f19fa",
        "value": "0x"
      }
    ],
    "stateBlockNumber": 5221585,
    "totalGasUsed": 42000
  }
}
@rjl493456442
Copy link
Member

Sina is working on an alternative of it, check out #27720 for more information

@s1na
Copy link
Contributor

s1na commented May 28, 2024

Right I believe #27720 should be able to serve this use-case. From what I understand what you're proposing takes already mined transactions as input. eth_simulateV1 does not do that, it takes call args as in eth_call. But that's just a matter of doing eth_getTransactionByHash and passing the fields to eth_simulateV1.

@monperrus
Copy link
Author

Right I believe #27720 should be able to serve this use-case

great!

From what I understand what you're proposing takes already mined transactions as input

any valid transaction can be given as input to eth_callBundle, not only already mined ones.

@fjl
Copy link
Contributor

fjl commented Jun 6, 2024

We will not add eth_callBundle because the standardized alternative eth_simulateV1 is being worked on, and will satisfy the same use cases as callBundle.

@fjl fjl closed this as completed Jun 6, 2024
@monperrus
Copy link
Author

ack.

for the record, the current work on eth_simulateV1 lives at ethereum/execution-apis#484

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants