Skip to content
This repository has been archived by the owner on Aug 10, 2024. It is now read-only.

A public API for providing access to the nano network through your nano node.

License

Notifications You must be signed in to change notification settings

cinderblockgames/nano-public-api

Repository files navigation

Nano Public API

This API sits in front of your Nano node RPC endpoint to provide access to only the public readonly calls available. The API excludes all deprecated calls, control calls, calls that write to the network, and calls that provide information about the node itself.

The calls available against the v23.3 node are listed below:

The API provides a Swagger interface for ad-hoc requests, but it also provides a proxy method that can be used as a replacement for a node in normal interfacing. Basically, instead of providing http://node.example.com:7076 as your RPC endpoint, you would provide https://api.node.example.com/node/proxy and still have access to the methods listed above.

NOTE: Not all API instances will provide access to all of the calls listed above; use https://api.node.exmaple/api/supported_calls or https://api.node.exmaple/api/excluded_calls to verify which calls are supported by the instance you are using.

Docker-Compose Example

version: '3.8'

services:

  node:
    image: 'nanocurrency/nano:V#[.#]'
    networks:
      - nano
    ... clipped for brevity ...
    
  monitor:
    image: 'nanotools/nanonodemonitor:v#'
    networks:
      - traefik
      - nano
    ... clipped for brevity ...
    
  api:
    image: 'cinderblockgames/nano-public-api:V#[.#]_#.#.#'
    environment:
      # optional; port on which to listen; default value provided
      - 'ASPNETCORE_URLS=http://+:2022'
      # optional; url of node rpc; default value provided
      - 'NODE=http://node:7076'
      # optional; opens CORS; default value provided
      - 'DISABLE_CORS=true'
      # optional; specifies which calls to remove from support; default value provided
      - 'EXCLUDED_CALLS=delegators;delegators_count;representatives'
    networks:
      - traefik
      - nano
    deploy:
      mode: replicated
      replicas: 2
      labels:
        - 'traefik.enable=true'
        - 'traefik.docker.network=traefik'
        - 'traefik.http.routers.nano-api.rule=Host(`api.nano.kga.earth`)'
        - 'traefik.http.routers.nano-api.entrypoints=web-secure'
        - 'traefik.http.routers.nano-api.tls'
        - 'traefik.http.services.nano-api.loadbalancer.server.port=2022'

networks:
  traefik:
    external: true
  nano:
    external: true

About

A public API for providing access to the nano network through your nano node.

Resources

License

Stars

Watchers

Forks