Skip to content

usexfg/xfgapi

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

XFGAPI - Fuego L1 Blockchain API Suite

REST API layer over the Fuego network & wallet RPCs with multi-language client SDKs for easy integration.

πŸš€ Features

  • REST API Gateway - Node.js gateway translates REST calls to Fuego RPC endpoints
  • Multi-Language Support - Client SDKs for 10+ programming languages
  • OpenAPI Specification - API documentation with Swagger/OpenAPI 3.0
  • Production Ready - Privacy-focused server with comprehensive security analysis

πŸ“¦ Available Client SDKs

Language Client Directory Description
JavaScript/Node.js clients/javascript/ Browser and Node.js compatible client
Python clients/python/ Python client with requests library
Go clients/go/ Go client with full type safety
Java clients/java/ Java client with Maven/Gradle support
C# (.NET) clients/csharp/ .NET client with NuGet package
PHP clients/php/ PHP client with Composer support
Ruby clients/ruby/ Ruby client with Gem support
Kotlin clients/kotlin/ Kotlin client for Android/JVM
Swift 5 clients/swift5/ Swift client for iOS/macOS
Rust clients/rust/ Rust client with Cargo support

πŸ—οΈ Architecture

  • Gateway REST base: http://localhost:8787/v1
  • Underlying services:
    • Core RPC: CORE_RPC_URL (default http://127.0.0.1:8181)
    • Wallet RPC: WALLET_RPC_URL (default http://127.0.0.1:8070)
    • Wallet auth (optional): WALLET_RPC_USER, WALLET_RPC_PASSWORD

πŸš€ Quick Start

1. Start the Gateway Server

The gateway server is located in gateway/ directory.

cd gateway
npm install
CORE_RPC_URL=http://127.0.0.1:8181 \
WALLET_RPC_URL=http://127.0.0.1:8070 \
WALLET_RPC_USER=rpcuser \
WALLET_RPC_PASSWORD=rpcpass \
PORT=8787 \
node server.js

Prerequisites: Start fuegod and xfgwalletd servers locally.

2. Test the API

Test the gateway with these example requests:

Node Information

curl http://localhost:8787/v1/node/info

Node Height

curl http://localhost:8787/v1/node/height

Wallet Balance

curl http://localhost:8787/v1/wallet/balance

Wallet Transfer

curl -X POST http://localhost:8787/v1/wallet/transfer \
  -H 'Content-Type: application/json' \
  -d '{
    "destinations": [{"address": "fire...", "amount": 1000000}],
    "payment_id": "",
    "mixin": 0,
    "unlock_time": 0,
    "messages": [],
    "ttl": 0
  }'

πŸ“š Using Client SDKs

JavaScript/Node.js Client

Navigate to clients/javascript/ and follow the README:

cd clients/javascript
npm install

Python Client

Navigate to clients/python/ and follow the README:

pip install requests

Other Languages

Each client SDK has its own directory with specific installation and usage instructions:

πŸ“– API Documentation

OpenAPI Specification

The complete API specification is available at openapi/fuego-openapi.yaml.

Import into your favorite API client:

  • Postman: Import the OpenAPI YAML file
  • Insomnia: Import the OpenAPI YAML file
  • Swagger UI: Use the YAML file with Swagger UI
  • VS Code: Use the REST Client extension

Generate New SDKs

Use the SDK generation script to create clients for additional languages:

cd openapi
./generate_sdks.sh

πŸ”’ Security & Privacy

Privacy-Focused Server

A privacy-enhanced version of the gateway server is available at gateway/server-privacy.js.

Security Analysis

Comprehensive privacy and security analysis is documented in privacy-security/privacy-analysis.md.

πŸ”— Explorer Integration

Integration tools for blockchain explorers are available in explorer-integration/:

  • Migration scripts for existing explorers
  • Integration documentation
  • Setup guides

🏭 Production Deployment

Ubuntu Server Deployment

For production deployment on Ubuntu servers, we provide comprehensive guides and automated setup:

πŸš€ Quick Setup (Automated)

# Download and run the automated setup script
curl -fsSL https://raw.githubusercontent.com/ColinRitman/xfgapi/main/scripts/ubuntu-setup.sh | bash

πŸ“– Manual Setup Guide

For detailed manual setup instructions, see docs/UBUNTU-DEPLOYMENT.md.

πŸ› οΈ What the Setup Includes

  • Nginx reverse proxy with SSL/TLS termination
  • PM2 process management for automatic restarts
  • Let's Encrypt SSL certificates with auto-renewal
  • UFW firewall configuration
  • Rate limiting and security headers
  • Health monitoring and logging
  • Fail2ban protection against brute force attacks

Docker Deployment

For containerized deployments, use the provided Docker configuration:

# Build and run with Docker Compose
docker-compose up -d

Environment Variables

Variable Description Default
CORE_RPC_URL Core RPC server URL http://127.0.0.1:8181
WALLET_RPC_URL Wallet RPC server URL http://127.0.0.1:8070
WALLET_RPC_USER Wallet RPC username (optional)
WALLET_RPC_PASSWORD Wallet RPC password (optional)
PORT Gateway server port 8787
NODE_ENV Node.js environment production
CORS_ORIGIN CORS allowed origins *

Production Checklist

  • βœ… SSL/TLS encryption configured
  • βœ… Reverse proxy (Nginx) setup
  • βœ… Process management (PM2) configured
  • βœ… Firewall rules applied
  • βœ… Rate limiting enabled
  • βœ… Security headers configured
  • βœ… Monitoring and logging setup
  • βœ… Backup strategy implemented
  • βœ… Health checks automated

πŸ“„ License

This project is licensed under the terms specified in the LICENSE file.

🀝 Contributing

Contributions are welcome! Please see the contributing guidelines for more information.


Repository: https://github.com/ColinRitman/xfgapi

About

OpenAPI client(s) for Fuego L1 blockchain privacy banking network

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 24.7%
  • Java 22.4%
  • PHP 21.0%
  • Ruby 9.4%
  • Swift 9.0%
  • Kotlin 7.8%
  • Other 5.7%