eth_subscribe("logs")
JSON-RPC method allows developers to subscribe to real-time updates about new event logs on the Hyperliquid EVM blockchain. The application will receive notifications whenever new logs matching the filter are emitted, making it essential for monitoring smart contract events and building reactive dApps.
Get your own node endpoint todayStart for free and get your app to production levels immediately. No credit card required.You can sign up with your GitHub, X, Google, or Microsoft account.
Parameters
- subscription type (string, required): Keyword identifying the type of event to subscribe to,
logs
in this case - filter object (object, optional): The event filter options
address
— the contract address from which the logs should be fetched. It can be a single address or an array of addressestopics
— an array of DATA topics. The event topics for which the logs should be fetched. It can be a single topic or an array of topics
Response
The method returns a subscription ID that can be used to identify and manage the subscription.Response structure
Initial subscription response:subscription
— the subscription ID
address
— the contract address from which the event originatedtopics
— an array of 32-byte data fields containing indexed event parametersdata
— the non-indexed data that was emitted along with the eventblockNumber
— the block number in which the event was includedtransactionHash
— the hash of the transaction that triggered the eventtransactionIndex
— the integer index of the transaction within the block’s list of transactionsblockHash
— the hash of the block in which the event was includedlogIndex
— the integer identifying the index of the event within the block’s list of eventsremoved
— boolean value indicating if the event was removed due to a chain reorganization
Usage example
Basic implementation
Note that subscriptions require a WebSocket connection. Install WebSocket cat for testing:
wscat
JavaScript implementation - Monitor ERC-20 transfers
Python implementation - Monitor multiple events
Advanced filtering with topic combinations
Use cases
Theeth_subscribe("logs")
method is essential for applications that need to:
- Monitor token transfers: Track ERC-20/ERC-721 transfers in real-time
- DEX activity tracking: Monitor swaps, liquidity additions, and removals on decentralized exchanges
- Smart contract events: React to specific contract events as they occur
- DeFi protocol monitoring: Track lending, borrowing, and liquidation events
- Wallet activity alerts: Notify users of incoming/outgoing transactions
- NFT marketplace activity: Monitor mints, sales, and transfers of NFTs
- Bridge monitoring: Track cross-chain bridge deposits and withdrawals
- Governance tracking: Monitor voting and proposal events in DAOs
- Price oracle updates: Track price feed updates from oracle contracts
- Security monitoring: Detect suspicious contract interactions in real-time