kotalco / core-api

Kotal core API
0 stars 0 forks source link

:fire: CORE API SERVER

The Core API provides a powerful interface for managing blockchain resources on Kubernetes, integrating multiple functionalities into a single, cohesive experience. It is the essential tool for deploying and interacting with blockchain nodes and related services.

:open_file_folder: Features

:hammer_and_wrench: Prerequisites

Running the CORE API SERVER against real k8s cluster requires:

:rocket: Running the Core API Server

:floppy_disk: From Source Code

Clone the repository and run the API server with the following command:

go run main.go

NOTE: An actual k8s cluster with kubeconfig should be available in the default directory. For testing with a mock server:

MOCK=true go run main.go

:framed_picture: From Docker Image

Run the API server from a Docker image with the following command:

docker run -p 3000:3000 -e MOCK=true kotalco/core-api:develop

:closed_lock_with_key: Environment Variables

This is a list of the environment variables you need to use the software.

Mandatory Environment Variables (The app will panic if not provided)

Optional Environment Variables

:telephone_receiver: Sample cURL Calls

Create a new node:

curl -X POST -d '{"name": "my-node", "network": "mainnet", "client": "besu"}' -H 'content-type: application/json' localhost:3000/api/v1/ethereum/nodes

Get node by name:

curl localhost:3000/api/v1/ethereum/nodes/my-node

List all nodes:

curl localhost:3000/api/v1/ethereum/nodes

Update node by name:

curl -X PUT -d '{"rpc": true}' -H 'content-type: application/json' localhost:3000/api/v1/ethereum/nodes/my-node

Delete node by name:

curl -X DELETE localhost:3000/api/v1/ethereum/nodes/my-node

:building_construction: BLOCKCHAIN RESOURCES

The Core API is designed as a comprehensive solution for your blockchain infrastructure needs, providing streamlined management capabilities within Kubernetes environments.