# eth\_subscribe

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

This method will use `10` [Compute Units](https://docs.validationcloud.io/v1/about/billing).

***

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

## **Parameters**

`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:

* **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.

`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/120/ethereum/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" %}

<pre class="language-bash"><code class="lang-bash">wscat -c wss:///mainnet.berachain.validationcloud.io/v1/wss/&#x3C;YOUR_API_KEY_HERE>
# wait for connection

# example request
<strong>{"jsonrpc":  "2.0",  "id":  1,  "method":"eth_subscribe","params":["newHeads"]}
</strong>
# example result
{"jsonrpc":"2.0","result":"0x4327e562d202d98983a2ee341409f09e","id":1}
</code></pre>

{% endtab %}

{% tab title="testnet" %}

<pre class="language-bash"><code class="lang-bash">wscat -c wss:///bepolia.berachain.validationcloud.io/v1/wss/&#x3C;YOUR_API_KEY_HERE>
# wait for connection

# example request
<strong>{"jsonrpc":  "2.0",  "id":  1,  "method":"eth_subscribe","params":["newHeads"]}
</strong>
# example result
{"jsonrpc":"2.0","result":"0x4327e562d202d98983a2ee341409f09e","id":1}
</code></pre>

{% endtab %}
{% endtabs %}
