This document provides detailed information about the available endpoints, including examples in Python and JavaScript.

Base URL

The base URL for all API endpoints is:

<http://71.38.118.217:3001>

Best Practices: CORS Proxy Server

It is recommended to set up a CORS (Cross-Origin Resource Sharing) proxy server within your project to handle HTTP endpoints over the web (HTTPS). This approach provides several benefits:

  1. Security: It allows you to control access to your API and prevent unauthorized cross-origin requests.
  2. HTTPS support: You can easily add HTTPS support to your API, even if the underlying service doesn't support it.
  3. Rate limiting: You can implement rate limiting to protect your API from abuse.
  4. Logging and monitoring: A proxy server allows you to log requests and monitor API usage more effectively.

To implement a CORS proxy server, you can use libraries like http-proxy-middleware for Node.js or flask-cors for Python.

Endpoints

1. Block Info

Endpoint: /api/block-info

Description: Retrieves information about the latest block.

Response:

{
  "height": 2722341,
  "hash": "55f2fa748383aa57f69f5ad128516436f8a4dcb7f54f8d05a15b492b79cec575"
}

Python Example:

import requests

response = requests.get("<http://71.38.118.217:3001/api/block-info>")
data = response.json()
print(f"Block Height: {data['height']}")
print(f"Block Hash: {data['hash']}")

JavaScript Example: