Logo

What is HydraDX and how do you connect to it via RPC?

Key Takeaways

  • HydraDX is a Polkadot parachain focused on decentralized liquidity, now called Hydration.
  • The network uses Substrate-based technology and supports both HTTP and WebSocket RPC connections.
  • Public RPC endpoints are available but may have rate limits; dedicated nodes offer better reliability.
  • OnFinality provides scalable RPC API and dedicated node infrastructure for HydraDX.
  • When integrating, use the correct chain ID and ensure your library supports Substrate-based chains.
  • Always verify endpoint security and consider using multiple providers for redundancy.
  • For production dApps, a dedicated node or premium RPC service is recommended to avoid throttling.

What is HydraDX?

HydraDX, now officially rebranded as Hydration, is a decentralized finance (DeFi) protocol operating as a parachain on the Polkadot network. Its core innovation is the Omnipool, a single liquidity pool that aggregates all assets, allowing traders to swap between any pair without needing separate liquidity pools. This design reduces fragmentation, improves capital efficiency, and lowers slippage compared to traditional AMMs.

The protocol also supports single-sided liquidity provisioning, meaning users can provide liquidity with just one asset instead of a pair. This lowers the barrier for liquidity providers and simplifies the process. Additionally, HydraDX features dollar-cost averaging (DCA) trading, Hydrated Farms for yield, and over-the-counter (OTC) trading capabilities.

  • Built on Substrate, benefiting from Polkadot's shared security and interoperability.
  • Native token: HDX (also referred to as Hydration).
  • Key use cases: swapping, liquidity provision, yield farming, treasury management.

HydraDX RPC Endpoints Overview

To interact with the HydraDX network programmatically, you need an RPC (Remote Procedure Call) endpoint. RPC endpoints allow your application to read blockchain data (e.g., account balances, transaction history) and submit transactions. HydraDX supports both HTTP and WebSocket protocols, enabling real-time updates and efficient data streaming.

Public RPC endpoints are available for development and testing, but they often come with rate limits and no uptime guarantees. For production applications, a reliable RPC provider like OnFinality offers dedicated endpoints with higher throughput, better latency, and 24/7 support.

  • HTTP endpoint: typically https://rpc.hydradx.cloud or similar public URLs.
  • WebSocket endpoint: wss://rpc.hydradx.cloud for real-time subscriptions.
  • Chain ID: HydraDX uses chain ID 0x (or specific parachain ID 2034).
CriterionWhat to checkWhy it matters
Endpoint TypeHTTP or WebSocketHTTP for simple queries, WebSocket for real-time events.
Rate LimitsRequests per second (RPS)Public endpoints may throttle; dedicated nodes avoid this.
Uptime SLAGuaranteed availabilityCritical for dApps requiring constant connectivity.
SecurityTLS/SSL, authenticationPrevents man-in-the-middle attacks and unauthorized access.

How to Connect to HydraDX Using RPC

Connecting to HydraDX via RPC is straightforward with the right tools. Most developers use libraries like Polkadot.js, ethers (with Substrate adapters), or custom Substrate clients. Below is a basic example using Polkadot.js to connect to a HydraDX node.

First, install the required package: npm install @polkadot/api. Then, create an API instance pointing to the RPC endpoint. Replace the URL with your chosen provider's endpoint.

  • Example code snippet: const { ApiPromise, WsProvider } = require('@polkadot/api'); const provider = new WsProvider('wss://rpc.hydradx.cloud'); const api = await ApiPromise.create({ provider });
  • Ensure your endpoint supports the required methods: chain_getBlock, system_accountNextIndex, etc.
  • For transaction submission, use the signer interface from Polkadot.js or a wallet extension.

Choosing an RPC Provider for HydraDX

When selecting an RPC provider for HydraDX, consider factors like reliability, scalability, and cost. Public endpoints are free but may be unreliable under load. Commercial providers like OnFinality offer tiered plans with dedicated nodes, higher rate limits, and global load balancing.

OnFinality supports HydraDX as part of its Polkadot network coverage, providing both shared and dedicated RPC endpoints. Their infrastructure is optimized for Substrate-based chains, ensuring low latency and high availability. For developers building on Hydration, using a professional RPC service reduces operational overhead and improves user experience.

  • OnFinality offers free tier for testing, paid plans for production.
  • Dedicated nodes provide full control over node configuration and resources.
  • Multi-region deployment reduces latency for global users.

Best Practices for HydraDX RPC Integration

To ensure a smooth integration with HydraDX, follow these best practices. First, always use WebSocket for real-time applications to receive push notifications for new blocks and events. Second, implement retry logic and fallback endpoints to handle temporary failures. Third, monitor your RPC usage to avoid hitting rate limits.

Additionally, consider using a load balancer if you have multiple endpoints. For high-traffic dApps, a dedicated node from OnFinality provides the most consistent performance. Finally, keep your library versions updated to benefit from the latest features and security patches.

  • Use WebSocket for subscriptions (e.g., balance changes, new blocks).
  • Implement exponential backoff for failed requests.
  • Cache frequently accessed data (e.g., account info) to reduce RPC calls.
  • Test your integration on testnet before mainnet deployment.

Troubleshooting Common HydraDX RPC Issues

Developers may encounter issues when connecting to HydraDX RPC endpoints. Common problems include connection timeouts, authentication errors, and unsupported methods. Below are solutions to frequent issues.

If you receive a 'Connection refused' error, verify the endpoint URL and ensure your firewall allows outbound connections to the required ports (9944 for WebSocket, 9933 for HTTP). For rate limit errors, reduce your request frequency or upgrade to a premium plan.

  • Timeout: Increase timeout settings in your client library.
  • Method not found: Check that the endpoint supports the specific RPC method (e.g., state_getStorage).
  • Invalid chain ID: Ensure you are connecting to the correct network (HydraDX mainnet vs testnet).

Frequently Asked Questions

What is the official HydraDX RPC endpoint?

The official public RPC endpoint for HydraDX is wss://rpc.hydradx.cloud for WebSocket and https://rpc.hydradx.cloud for HTTP. However, these are public endpoints with rate limits. For production, consider using a provider like OnFinality.

Does HydraDX support WebSocket connections?

Yes, HydraDX supports WebSocket connections for real-time data streaming. Use the wss:// protocol with the appropriate endpoint.

How do I get a dedicated HydraDX node?

You can get a dedicated HydraDX node through OnFinality's dedicated node service. Visit the dedicated node page to configure and deploy a node tailored to your needs.

What libraries can I use to interact with HydraDX?

The most common library is Polkadot.js, which provides full support for Substrate-based chains like HydraDX. Other options include Substrate API Sidecar or custom clients using the Substrate RPC interface.

Is HydraDX the same as Hydration?

Yes, HydraDX has rebranded to Hydration. The network and token (HDX) remain the same. Documentation and endpoints may still use the old name.

hydradx rpchydration rpchydradx endpointhydradx node
RPC Knowledge Base

Related RPC details

Background

Nunca te preocupes por la infraestructura nuevamente

OnFinality elimina la carga pesada de DevOps para que puedas construir de forma más inteligente y rápida.

Comenzar