When processing an eth_call batch request we could group it and create a multicall from it before passing it along, we'd then need to parse the response back to the jsonrpc batch format.
One thing to note is that this can only work by grouping by the point in time the call will run on.
example request/response format:
curl -sS http://localhost:3000/?app=carneiro \
-H 'content-type: application/json' \
--data '[
{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_call",
"params": [
{
"to": "<contract>",
"data": "0x18160ddd"
},
"latest"
]
},
{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_call",
"params": [
{
"to": "<contract>",
"data": "0x18160ddd"
},
"latest"
]
},
{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_call",
"params": [
{
"to": "<contract>",
"data": "0x18160ddd"
},
"latest"
]
},
{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_call",
"params": [
{
"to": "<contract>",
"data": "0x18160ddd"
},
"latest"
]
},
{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_call",
"params": [
{
"to": "<contract>",
"data": "0x18160ddd"
},
"latest"
]
}
]
' | jq
response:
[
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x00000000000000000000000000000000000000000000000000ffffffffffffff"
},
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x00000000000000000000000000000000000000000000000000ffffffffffffff"
},
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x00000000000000000000000000000000000000000000000000ffffffffffffff"
},
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x00000000000000000000000000000000000000000000000000ffffffffffffff"
},
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x00000000000000000000000000000000000000000000000000ffffffffffffff"
}
]
When processing an eth_call batch request we could group it and create a multicall from it before passing it along, we'd then need to parse the response back to the jsonrpc batch format.
One thing to note is that this can only work by grouping by the point in time the call will run on.
example request/response format:
response: