Skip to content

Incompatibility: starknet_subscribeNewHeads params format differs between providers (Alchemy uses array, Juno/Madara use object) #786

@0xharryriddle

Description

@0xharryriddle

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"
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions