This guide explains how to access Ligma RPC through NOWNodes. It covers endpoint structure, API key authentication, and example calls for developers integrating Ligma into their applications.
What is Ligma RPC?
Ligma RPC is a remote procedure call interface for interacting with the Ligma blockchain network. It allows developers to query blockchain data, submit transactions, and interact with smart contracts without running a full node.
NOWNodes provides access to Ligma RPC endpoints, enabling applications to connect to the Ligma network through a managed service.
NOWNodes Ligma RPC Endpoint
To use Ligma RPC via NOWNodes, you will need an API key from your NOWNodes account. The endpoint typically follows a pattern that includes your API key.
The base endpoint structure is:
https://ligma.nownodes.io/{API_KEY}Authentication and API Key
NOWNodes uses API keys to authenticate requests. You can obtain an API key by signing up for a NOWNodes account and generating a key in the dashboard.
Include your API key in the endpoint URL as shown above. Keep your API key secure and do not expose it in client-side code.
Making RPC Requests
Ligma RPC supports standard JSON-RPC methods. You can send requests using HTTP POST with a JSON body.
Example request to get the latest block number:
curl -X POST https://ligma.nownodes.io/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'Common Ligma RPC Methods
The following methods are commonly used when interacting with the Ligma network via RPC. Note that method availability may depend on the network's current implementation.
- eth_blockNumber: Returns the latest block number.
- eth_getBalance: Returns the balance of an address.
- eth_getTransactionByHash: Returns details of a transaction by hash.
- eth_call: Executes a message call without creating a transaction.
- eth_sendRawTransaction: Submits a signed transaction.
Example: Checking an Address Balance
To check the balance of an address, use the eth_getBalance method with the address and block parameter.
curl -X POST https://ligma.nownodes.io/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_getBalance","params":["0xAddressHere","latest"],"id":1}'Rate Limits and Usage Considerations
NOWNodes may apply rate limits based on your plan. Refer to your NOWNodes account dashboard or documentation for specific limits.
For high-volume applications, consider implementing request caching and error handling to manage RPC usage efficiently.
Troubleshooting
If you encounter errors, verify that your API key is correct and included in the URL. Ensure your request body is valid JSON and that the method name is correct.
Common HTTP errors include 401 Unauthorized (invalid API key) and 429 Too Many Requests (rate limit exceeded).