API Overview

Complete documentation for Bunkercoin's HTTP, P2P, and CLI interfaces. The API is designed for both programmatic integration and manual operation in radio-constrained environments.

Interface Overview

Bunkercoin provides three primary interfaces for interaction:

RESTful API for network communication and real-time monitoring

  • Port: 10000 (fixed)

  • Protocol: HTTP/1.1 (no TLS required)

  • Format: JSON request/response

  • Features: Server-Sent Events for real-time updates

Direct TCP communication for efficient peer synchronization

  • Port: 7000 (configurable)

  • Protocol: TCP with JSON messaging

  • Features: Persistent connections, real-time block propagation

Command-line interface for local operations and node management

  • Binary: bunkercoin

  • Configuration: File-based with sensible defaults

  • Features: Wallet management, node operation, transaction creation

Quick Start Examples

Start a Mining Node

Create and Send Transaction

Monitor Node via HTTP

Radio-Optimized Design

All APIs are designed with radio constraints in mind:

Bandwidth Efficiency

  • Compact JSON: Minimal overhead in all responses

  • Incremental sync: Only transfer necessary data

  • Binary alternatives: Bincode serialization available

Intermittent Connectivity

  • Stateless HTTP: No persistent session requirements

  • Atomic operations: All API calls complete independently

  • Graceful degradation: Partial failures don't affect system

Manual Operation

  • Human-readable formats: JSON and hex encoding throughout

  • Voice-friendly: All data can be transmitted verbally if needed

  • Error tolerance: Robust handling of malformed requests

Integration Patterns

Blockchain Explorer

Radio Bridge Integration

Peer Discovery

Error Handling

All APIs use consistent error handling patterns:

HTTP Status Codes

Code
Meaning
Usage

200

Success

Normal operation

400

Bad Request

Invalid transaction or block

404

Not Found

Unknown endpoint

500

Server Error

Internal node error

Error Response Format

CLI Error Handling

  • Exit codes: Standard Unix exit codes for script integration

  • Error messages: Human-readable descriptions

  • Graceful degradation: Partial failures don't stop execution

Security Considerations

HTTP Interface Security

  • No authentication: All endpoints are public (suitable for radio networks)

  • Rate limiting: Not implemented (trusted network assumption)

  • Input validation: Cryptographic verification of all blockchain data

P2P Protocol Security

  • Message validation: All peer messages cryptographically verified

  • Connection limits: Bounded number of concurrent connections

  • Malicious peer protection: Invalid data discarded without affecting node

CLI Security

  • Local access only: CLI operates on local data directory

  • File permissions: Wallet files use standard Unix permissions

  • Private key handling: Keys stored in plaintext (operator responsibility)

Performance Characteristics

HTTP Interface

  • Concurrent requests: Handles multiple simultaneous connections

  • Memory usage: Bounded by blockchain size (grows linearly)

  • Response time: Sub-second for all standard operations

P2P Protocol

  • Connection overhead: ~1KB per active peer connection

  • Throughput: Limited by network bandwidth, not protocol

  • Latency: Direct TCP provides minimal protocol overhead

CLI Operations

  • Startup time: ~100ms for simple operations

  • Disk I/O: Atomic file operations for safety

  • Memory footprint: <10MB for typical operations

Future API Enhancements

Planned Features

  • WebSocket support: Real-time bidirectional communication

  • GraphQL endpoint: Complex queries and subscriptions

  • gRPC interface: High-performance binary protocol

  • OpenAPI specification: Formal API documentation

Radio-Specific Enhancements

  • Compression support: gzip/deflate for bandwidth conservation

  • Batch operations: Multiple transactions in single request

  • Delta synchronization: Incremental blockchain updates

  • Voice encoding: Audio-friendly data representation

Last updated