> For the complete documentation index, see [llms.txt](https://docs.ebs.ezat.io/ebs-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ebs.ezat.io/ebs-documentation/services/rpc/supported-networks/binance-smart-chain/eth_subscribe.md).

# eth\_subscribe

eth\_subscribe RPC Method

**Parameters:**

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

&#x20;    *newHeads* - It fires a notification each time a new header is appended to the chain, including chain reorganizations\
&#x20;    *logs* - It returns logs that are included in new imported blocks and match the given filter criteria\
&#x20;    *newPendingTransactions* - It 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

*data* - object - (optional) The 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

**Returns:**

*result* - The 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](/ebs-documentation/services/rpc/supported-networks/binance-smart-chain/eth_unsubscribe.md)

**Code Examples:**

```
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
  "method": "eth_subscribe",
  "params": ["newHeads"],
  "id": 1,
  "jsonrpc": "2.0"
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://api.ebs.ezat.io/core/api/v1.0/rpc/bsc/mainnet?x-api-key-id=API-KEY-ID&x-api-key=API-KEY", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
```
