The starknet_subscribeNewHeads JSON-RPC method has inconsistent parameter format implementations across different Starknet providers:
- Alchemy: Expects array format
["latest"]
- Juno/Madara: Expect object format
{"block_id": "latest"}
- starknet-rs: Currently implements object format only
This causes subscription failures when using starknet-rs with Alchemy, while it works with local full nodes.
✅ Juno & Madara (Object Format - Currently Working with starknet-rs)
Juno:
{
"jsonrpc": "2.0",
"method": "starknet_subscribeEvents",
"params": {
"block_id": "latest"
},
"id": 1
}
Madara:
echo '{"jsonrpc":"2.0","method":"starknet_subscribeNewHeads","params":{"block_id":"latest"},"id":1}' | \
websocat ws://localhost:9944/rpc/v0_8_0
❌ Alchemy (Array Format - Currently Fails with starknet-rs)
Required format:
{
"jsonrpc": "2.0",
"id": 1,
"method": "starknet_subscribeNewHeads",
"params": ["latest"]
}
Error when using object format:
{
"jsonrpc": "2.0",
"id": 1,
"error": {
"code": -32602,
"message": "Invalid params",
"data": {
"reason": "params must be array"
}
}
}
The
starknet_subscribeNewHeadsJSON-RPC method has inconsistent parameter format implementations across different Starknet providers:["latest"]{"block_id": "latest"}This causes subscription failures when using
starknet-rswith Alchemy, while it works with local full nodes.✅ Juno & Madara (Object Format - Currently Working with starknet-rs)
Juno:
{ "jsonrpc": "2.0", "method": "starknet_subscribeEvents", "params": { "block_id": "latest" }, "id": 1 }Madara:
❌ Alchemy (Array Format - Currently Fails with starknet-rs)
Required format:
{ "jsonrpc": "2.0", "id": 1, "method": "starknet_subscribeNewHeads", "params": ["latest"] }Error when using object format:
{ "jsonrpc": "2.0", "id": 1, "error": { "code": -32602, "message": "Invalid params", "data": { "reason": "params must be array" } } }