API Documentation

RESTful endpoints for interacting with the FreshCredit blockchain.

Base URL
https://blockchain.freshcredit.com

Endpoint Details

GET /health

Check if the blockchain node is running and healthy.

Response
"OK"
GET /chain/node-info

Get information about the blockchain node including version, chain height, and peer count.

Response
{
  "name": "FreshCredit Blockchain Node",
  "version": "0.1.0",
  "chain_height": 5,
  "peer_count": 0,
  "status": "synced"
}
GET /chain/block/:number

Retrieve a block by its block number.

Parameters
number - Block number (0 for genesis)
Example
GET /chain/block/0
GET /chain/block/latest

Retrieve the most recent block on the chain.

GET /chain/hash/:hash

Retrieve a block by its hash.

Parameters
hash - 64-character hex block hash
GET /chain/verify/:block_number

Verify a block's integrity including hash validation and signature verification.

Response
{
  "block_number": 1,
  "block_hash": "0bae9605ab...",
  "all_signatures_valid": true,
  "tamper_evident": true,
  "transaction_count": 1
}
POST /chain/transaction

Submit a new transaction to be included in the next block.

Request Body
{
  "user_id": "user-123",
  "report_type": "BlockID",
  "report_hash": "sha256-hash-of-report",
  "report_data": "report-content-here"
}
GET /api/stats

Get blockchain statistics for dashboard integration.

Response
{
  "total_blocks": 5,
  "total_hashes": 4,
  "latest_block": 4,
  "blocks_today": 3,
  "status": "online",
  "service_uptime": "active"
}