AptosAptos Network's breakthrough technology and seamless user experience are now available on QuickNode.

Start building today!     

Contents

eth_subscribe RPC Method

Parameters:

  1. subscription name - String - The type of event you want to subscribe to (i.e., newHeads, logs, newPendingTransactions). This method supports the following subscription types:
    newHeads - It fires a notification each time a new header is appended to the chain, including chain reorganizations
    logs - It returns logs that are included in new imported blocks and match the given filter criteria
    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
  2. 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:

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

Code Examples:

wscat -c wss://sample-endpoint-name.network.quiknode.pro/token-goes-here/ \ 
# wait for connection 
{"id":1,"jsonrpc":"2.0","method":"eth_subscribe","params":["newHeads"]}
Ready to get started? Create a free account