eth_subscribe
Polygon API - If successful this returns the subscription id. Subscriptions are creates with a regular RPC call with eth_subscribe as method and the subscription name as first parameter.

Parameters

  1. 1.
    subscription name
  2. 2.
    optional arguments (see below)

Returns

If successful this returns the subscription id.
​

Example

NOTE: eth_unsubscribe requests cannot be replicated in the composer tool

Request

Curl
Postman
1
curl https://polygon-mainnet.g.alchemyapi.io/v2/your-api-key \
2
-X POST \
3
-H "Content-Type: application/json" \
4
-d '{"jsonrpc":"2.0","id": 1, "method": "eth_subscribe", "params": ["newHeads", {"includeTransactions": true}]}'
Copied!
1
URL: https://polygon-mainnet.g.alchemyapi.io/v2/your-api-key
2
RequestType: POST
3
Body:
4
{
5
"jsonrpc":"2.0",
6
"method":"eth_subscribe",
7
"params":["newHeads", {"includeTransactions": true}],
8
"id":1
9
}
Copied!

Result

1
{
2
"id": 1,
3
"jsonrpc": "2.0",
4
"result": "0x9cef478923ff08bf67fde6c64013158d"
5
}
Copied!
Last modified 18d ago