This document provides detailed information about the Vernachain API endpoints, request/response formats, and authentication methods.
All API requests require an API key to be included in the header:
X-API-Key: your_api_key_here
Rate limits:
http://localhost:8000/api/v1
http://localhost:8001/api/v1
ws://localhost:8000/ws
GET /node/status
Response:
{
"node_id": "string",
"version": "string",
"peers_count": 0,
"is_syncing": false,
"latest_block": 0,
"uptime": 0
}
GET /node/peers
Response:
{
"peers": [
{
"node_id": "string",
"address": "string",
"port": 0,
"last_seen": "timestamp"
}
]
}
GET /blocks/{block_id}
Response:
{
"index": 0,
"hash": "string",
"previous_hash": "string",
"timestamp": "timestamp",
"transactions": [],
"validator": "string",
"signature": "string"
}
GET /transactions/{tx_hash}
Response:
{
"hash": "string",
"from": "string",
"to": "string",
"value": "number",
"timestamp": "timestamp",
"block_hash": "string",
"status": "string"
}
POST /transactions
Request:
{
"from": "string",
"to": "string",
"value": "number",
"data": "string",
"signature": "string"
}
GET /wallets/{address}/balance
Response:
{
"address": "string",
"balance": "number",
"staked": "number",
"nonce": 0
}
GET /wallets/{address}/transactions
Parameters:
limit
(optional): Number of transactions to returnoffset
(optional): Pagination offsetstatus
(optional): Transaction status filterPOST /contracts/deploy
Request:
{
"bytecode": "string",
"abi": "string",
"constructor_args": "string",
"sender": "string",
"signature": "string"
}
POST /contracts/{address}/call
Request:
{
"function": "string",
"args": "string",
"sender": "string",
"signature": "string"
}
GET /contracts/{address}
Response:
{
"address": "string",
"creator": "string",
"created_at": "timestamp",
"abi": "string",
"bytecode": "string"
}
POST /bridge/transfer
Request:
{
"from_chain": "string",
"to_chain": "string",
"token": "string",
"amount": "number",
"recipient": "string",
"signature": "string"
}
GET /bridge/transfers/{tx_hash}
Response:
{
"hash": "string",
"status": "string",
"from_chain": "string",
"to_chain": "string",
"amount": "number",
"timestamp": "timestamp"
}
Connect to WebSocket endpoint:
ws://localhost:8000/ws
{
"type": "subscribe",
"channels": [
"blocks",
"transactions",
"validators"
]
}
{
"type": "block",
"data": {
"index": 0,
"hash": "string",
"transactions": []
}
}
{
"type": "transaction",
"data": {
"hash": "string",
"from": "string",
"to": "string",
"value": "number"
}
}
{
"type": "validator",
"data": {
"address": "string",
"action": "string",
"stake": "number"
}
}
All API errors follow this format:
{
"error": {
"code": "string",
"message": "string",
"details": {}
}
}
Common Error Codes:
400
: Bad Request401
: Unauthorized403
: Forbidden404
: Not Found429
: Too Many Requests500
: Internal Server ErrorFor endpoints that return lists, use these query parameters:
limit
: Number of items per page (default: 10, max: 100)offset
: Number of items to skip (default: 0)order
: Sort order (asc/desc)Response format includes pagination metadata:
{
"data": [],
"pagination": {
"total": 0,
"limit": 0,
"offset": 0,
"has_more": false
}
}
Response headers include rate limit information:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 99
X-RateLimit-Reset: 1635724800