# eth\_subscribe

Returns an object with data about the sync status or false.

This method will use `20` [Compute Units](../../about/billing).

***

## **Reference:** [**Here**](https://ethereum.org/en/developers/tutorials/using-websockets/#eth-subscribe)

## **Parameters**

1. `subscription name` - **string** - The type of event you want to subscribe to (i.e., newHeads, logs, pendingTransactions, newPendingTransactions). This method supports the following subscription types:

* **pendingTransactions** - Returns full transactions that are sent to the network, marked as **pending**, and are sent from or to a certain address.\\
* **newPendingTransactions** - Returns the hash for all transactions that are added to the pending state and are signed with a key that is available in the node.\\
* **newHeads** - Fires a notification each time a new header is appended to the chain, including chain reorganizations.\\
* **logs** - Returns logs that are included in new imported blocks and match the given filter criteria.

2. `data - object -` (Optional) - Arguments such as an address, multiple addresses, and topics. Note, only logs that are created from these addresses or match the specified topics will return logs.

```json
params: [
  "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675",
]
```

## Returns

`result - string` - Hex encoded subscription ID. This ID will be attached to all received events and can also be used to cancel the subscription using [eth\_unsubscribe](https://app.gitbook.com/o/cJtxpQ7oeewtoIgMb5kv/s/F3uvE671dWWOTAu9svnI/~/changes/198/mezo/execution-api/eth_unsubscribe).

```json
// Result
{"id":1,"result":"0x9a52eeddc2b289f985c0e23a7d8427c8","jsonrpc":"2.0"}

//Example
{
      "jsonrpc":"2.0",
      "method":"eth_subscription",
      "params":{
          "result":{
          "blockHash":null,
          "blockNumber":null,
          "from":"0xa36452fc31f6f482ad823cd1cf5515177d57667f",
          "gas":"0x1adb0",
          "gasPrice":"0x7735c4d40",
          "hash":"0x50bff0736c713458c92dd1848d12f3354149be1363123dae35e94e0f2a9d56bf",
"input":"0xa9059cbb0000000000000000000000000d0707963952f2fba59dd06f2b425ace40b492fe0000000000000000000000000000000000000000000015b1111266cfca100000",
          "nonce":"0x0",
          "to":"0xea38eaa3c86c8f9b751533ba2e562deb9acded40",
          "transactionIndex":null,
          "value":"0x0",
          "v":"0x26",
          "r":"0x195c2c1ed126088e12d290aa93541677d3e3b1d10f137e11f86b1b9227f01e3b",
          "s":"0x60fc4edbf1527832a2a36dbc1e63ed6193a6eee654472fbebbf88ef1750b5344"},
          "subscription":"0x9a52eeddc2b289f985c0e23a7d8427c8"
      }
  }
```

{% tabs %}
{% tab title="mainnet" %}
```bash
wscat -c wss:///mainnet.mezo.validationcloud.io/v1/wss/<YOUR_API_KEY_HERE>
# wait for connection
{"jsonrpc":  "2.0",  "id":  1,  "method":"eth_subscribe","params":["newHeads"]}
# responses
{"jsonrpc":"2.0","result":"0x4327e562d202d98983a2ee341409f09e","id":1}
```
{% endtab %}
{% endtabs %}

