API Documentation
RESTful endpoints for interacting with the FreshCredit Substrate blockchain.
Base URL
https://blockchain.freshcredit.com
Endpoint Details
GET
/health
Check if the Substrate node is running and healthy.
Response
{
"status": "healthy",
"block_height": 12345,
"is_syncing": false,
"peers": 3
}
GET
/stats
Get blockchain statistics including block height and total anchored hashes.
Response
{
"block_height": 12345,
"total_hashes": 1000,
"is_syncing": false,
"peers": 3
}
GET
/hash/:hash
Verify if a hash is anchored on the blockchain and retrieve its metadata.
Parameters
hash - 64-character hex hashResponse (if found)
{
"verified": true,
"hash": "abc123...",
"user_id": "user-123",
"report_type": "BlockID",
"block_number": 12345,
"timestamp": "2024-01-15T10:30:00Z"
}
Response (if not found)
{
"verified": false,
"hash": "abc123...",
"message": "Hash not found on chain"
}
GET
/user/:user_id/hashes
Get all hashes anchored by a specific user.
Parameters
user_id - User identifierResponse
{
"user_id": "user-123",
"hashes": [
{
"hash": "abc123...",
"report_type": "BlockID",
"block_number": 12345,
"timestamp": "2024-01-15T10:30:00Z"
}
],
"total": 1
}
POST
/anchor
Anchor a new hash on the blockchain via the FreshCredit pallet.
Request Body
{
"user_id": "user-123",
"report_type": "BlockID",
"report_data": "data-to-hash-and-anchor"
}
Response
{
"success": true,
"hash": "abc123...",
"block_number": 12346,
"extrinsic_hash": "0x..."
}
Substrate Integration
The FreshCredit blockchain is built on Substrate (Polkadot SDK) with a custom pallet for hash anchoring.
1
REST API - Use the endpoints above for most integrations
2
subxt (Rust) - For direct Substrate integration, use the subxt crate
3
Polkadot.js - Browser-based interaction via Polkadot.js Apps
Contact us for direct WebSocket RPC access for enterprise integrations.