March 3, 2025
Exploiting eth_call for optimization purposes

Exploiting eth_call for optimization purposes

The Good News

The good news is that eth_call is highly flexible and allows us to execute EVM bytecode directly on the blockchain. This means we can achieve the same result without needing a pre-deployed contract by executing the following:

curl -X POST --data '[
 {"jsonrpc":"2.0","method":"eth_call",
 "params":[{"data": "0x4260005260206000f3"},"0xa95aab"],
 "id":11098795},
 
 {"jsonrpc":"2.0","method":"eth_call",
 "params":[{"data": "0x4260005260206000f3"},"0xa95aac"],
 "id":11098796},
 
 {"jsonrpc":"2.0","method":"eth_call",
 "params":[{"data": "0x4260005260206000f3"},"0xa95aad"],
 "id":11098797},
 
 {"jsonrpc":"2.0","method":"eth_call",
 "params":[{"data": "0x4260005260206000f3"},"0xa95aae"],
 "id":11098798},
 
 {"jsonrpc":"2.0","method":"eth_call",
 "params":[{"data": "0x4260005260206000f3"},"0xa95aaf"],
 "id":11098799}
 ]'  https://node-rpc:8545/`

(This exactly: curl -X POST --data '[{"jsonrpc":"2.0","method":"eth_call","params":[{"data": "0x4260005260206000f3"},"0xa95aab"],"id":11098795},{"jsonrpc":"2.0","method":"eth_call","params":[{"data": "0x4260005260206000f3"},"0xa95aac"],"id":11098796},{"jsonrpc":"2.0","method":"eth_call","params":[{"data": "0x4260005260206000f3"},"0xa95aad"],"id":11098797},{"jsonrpc":"2.0","method":"eth_call","params":[{"data": "0x4260005260206000f3"},"0xa95aae"],"id":11098798},{"jsonrpc":"2.0","method":"eth_call","params":[{"data": "0x4260005260206000f3"},"0xa95aaf"],"id":11098799}]' https://ethereum-rpc.publicnode.com )

The response:

[{"jsonrpc":"2.0","id":11098795,"result":
"0x000000000000000000000000000000000000000000000000000000005f9004b9"},
{"jsonrpc":"2.0","id":11098796,"result":
"0x000000000000000000000000000000000000000000000000000000005f9004c7"},
{"jsonrpc":"2.0","id":11098797,"result":
"0x000000000000000000000000000000000000000000000000000000005f9004c9"},
{"jsonrpc":"2.0","id":11098798,"result":
"0x000000000000000000000000000000000000000000000000000000005f9004d5"},
{"jsonrpc":"2.0","id":11098799,"result":
"0x000000000000000000000000000000000000000000000000000000005f9004d8"}
]

Where we can clearly see the timestamp of each of the requested blocks:

...
11098797 -> 0x05f9004c9 -> 2020-10-21T09:52:21.000Z
11098798 -> 0x05f9004d5 -> 2020-10-21T09:52:09.000Z
..

Leave a Reply

Your email address will not be published. Required fields are marked *