Giter Site home page Giter Site logo

drone's Introduction

Drone

Drone is an API caching layer application for the Hive blockchain. It is built using Rust with Actix Web, and its primary purpose is to cache and serve API requests for a specific set of methods. While Drone is not meant to be a Jussi replacement, it aims to improve API node performance.

Features

  • Written in Rust for optimal performance and reliability.
  • Actix Web for high-performance, asynchronous HTTP handling.
  • LRU cache with time-based expiration to store API responses.
  • Multiple API endpoints support for seamless request handling with HAF apps.
  • Caching support for select Hive API methods to reduce strain on API nodes.

Cached API Methods

Due to the speed of the blockchain and ease of access, only certain API methods are available for caching by default. This is editable by the node operator if they see the need for it.

  • block_api.get_block
  • condenser_api.get_block
  • account_history_api.get_transaction
  • condenser_api.get_transaction
  • condenser_api.get_ops_in_block
  • condenser_api.get_block_range
  • block_api.get_block_range

Endpoints

The application has the following two primary endpoints:

GET /: Health check endpoint that returns the application status, version, and operator message in JSON format. POST /: API call endpoint that takes the JSON-RPC request, caches the response (if supported), and returns the response data.

Configuration

Drone comes with pre-determined settings, however, you will have to edit ENDPOINT settings in config.json before starting the application (or building the Docker image)

PORT: The port on which the application will listen for incoming connections (default: 8999).
HOSTNAME: The hostname/IP address the application will bind to (default: "0.0.0.0").
CACHE_TTL: Time-to-live for cache entries (default: 300 seconds).
CACHE_COUNT: Maximum number of entries the cache can hold (default: 250).
OPERATOR_MESSAGE: Customizable message from the operator (default: "Drone by Deathwing").
HAF_ENDPOINT: HAF Endpoint that Drone can connect to relay HAF related API calls.
HAFAH_ENDPOINT: HAFAH Endpoint that Drone can connect to relay HAFAH related API calls.
HIVEMIND_ENDPOINT: Hivemind Endpoint that Drone can connect to relay Hivemind related API calls.
MIDDLEWARE_CONNECTION_THREADS: Specifies the number of HTTP connections to Hive endpoints kept alive (default: 8).

Usage

Native

To start the application after altering necessary configuration parameters such as HAF_ENDPOINT execute the following command:

cargo run --release

If you are advanced and have knowledge about Rust, you can also build the binary using cargo build --release and then run it using ./target/release/drone.

Docker (Recommended)

You can use docker-compose to build and run Drone.

docker-compose up --build -d

drone's People

Contributors

deathwingtheboss avatar dependabot[bot] avatar rishi556 avatar shmoogleosukami avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.