API Reference
Complete REST API documentation for integrating with the EmpoorioChain blockchain platform. Access blocks, transactions, accounts, and smart contracts programmatically.
Quick Start
Base URL
https://api.empooriochain.io/v1All API endpoints are prefixed with this base URL
Authentication
Most endpoints require API key authentication
Authorization: Bearer YOUR_API_KEYAPI Endpoints
/api/v1/blocks/latestGet the latest block information with full transaction details
Response
Complete block object with transactions, receipts, and metadata
{
"block_number": 12345678,
"hash": "0x1a2b3c...",
"parent_hash": "0x9f8e7d...",
"timestamp": 1638360000,
"miner": "0xabc123...",
"difficulty": "0x1a2b3c",
"total_difficulty": "0x123456",
"size": 12345,
"gas_used": 8000000,
"gas_limit": 12000000,
"base_fee_per_gas": "20000000000",
"transactions_root": "0x...",
"state_root": "0x...",
"receipts_root": "0x...",
"logs_bloom": "0x...",
"extra_data": "0x...",
"transactions": [
{
"hash": "0x...",
"type": 2,
"chain_id": 1,
"nonce": 42,
"block_hash": "0x...",
"block_number": 12345678,
"transaction_index": 0,
"from": "0x...",
"to": "0x...",
"value": "1000000000000000000",
"gas_price": "20000000000",
"max_fee_per_gas": "40000000000",
"max_priority_fee_per_gas": "2000000000",
"gas": 21000,
"input": "0x",
"r": "0x...",
"s": "0x...",
"v": "0x25",
"access_list": []
}
],
"ai_inferences": 23,
"zk_proofs_generated": 15
}/api/v1/blocks/:numberGet block information by block number
Parameters
numberBlock number (decimal) or "latest", "earliest", "pending"
Response
Complete block object
{
"block_number": 12345678,
"hash": "0x1a2b3c...",
"timestamp": 1638360000,
"transactions_count": 145,
"gas_used": 8000000,
"ai_operations": 23
}/api/v1/blocks/:hashGet block information by block hash
Parameters
hashBlock hash (hex format with 0x prefix)
Response
Complete block object
{
"block_number": 12345678,
"hash": "0x1a2b3c...",
"transactions": [...]
}/api/v1/transactions/:hashGet complete transaction details including receipt and logs
Parameters
hashTransaction hash (hex format with 0x prefix)
Response
Transaction object with receipt and execution details
{
"hash": "0x1a2b3c...",
"type": 2,
"chain_id": 1,
"nonce": 42,
"block_hash": "0x...",
"block_number": 12345678,
"transaction_index": 0,
"from": "0xabc123...",
"to": "0xdef456...",
"value": "1000000000000000000",
"gas_price": "20000000000",
"max_fee_per_gas": "40000000000",
"max_priority_fee_per_gas": "2000000000",
"gas": 21000,
"gas_used": 21000,
"cumulative_gas_used": 21000,
"effective_gas_price": "20000000000",
"input": "0x",
"status": true,
"logs": [
{
"address": "0x...",
"topics": ["0x...", "0x...", "0x..."],
"data": "0x...",
"block_number": 12345678,
"transaction_hash": "0x...",
"transaction_index": 0,
"block_hash": "0x...",
"log_index": 0,
"removed": false
}
],
"contract_address": null,
"ai_inference_used": false,
"zk_proof_verified": false
}/api/v1/transactionsGet paginated list of transactions with filtering options
Parameters
blockFilter by block number or hash
addressFilter by from/to address
limitNumber of transactions to return (max 10000)
offsetPagination offset
Response
Paginated transaction list
{
"transactions": [...],
"total_count": 1000000,
"page_size": 100,
"page": 1,
"has_more": true
}/api/v1/transactionsSubmit a signed transaction to the network
Parameters
signed_txSigned transaction data (hex format)
Response
Transaction hash and submission status
{
"tx_hash": "0x1a2b3c...",
"status": "submitted",
"estimated_confirmation_time": 15
}/api/v1/accounts/:addressGet complete account information including balance, nonce, and code
Parameters
addressAccount address (hex format with 0x prefix)
Response
Complete account state information
{
"address": "0xabc123...",
"balance": "1000000000000000000",
"nonce": 42,
"code": "0x608060405234801561001057600080fd5b50d380156100...",
"code_hash": "0x123456...",
"storage_root": "0x789abc...",
"transaction_count": 156,
"is_contract": true,
"contract_creator": "0xdef456...",
"creation_block": 12345600,
"ai_model_deployed": true,
"zk_enabled": true,
"last_activity": 1638360000
}/api/v1/accounts/:address/transactionsGet transaction history for an account
Parameters
addressAccount address
limitNumber of transactions (max 1000)
beforeCursor for pagination
Response
Account transaction history
{
"address": "0xabc123...",
"transactions": [...],
"total_count": 156,
"has_more": false
}/api/v1/contracts/:addressGet smart contract information including ABI, source code, and verification status
Parameters
addressContract address
Response
Complete contract information
{
"address": "0xabc123...",
"creator": "0xdef456...",
"creation_tx": "0x123456...",
"creation_block": 12345600,
"abi": [
{
"inputs": [],
"name": "runInference",
"outputs": [{"name": "", "type": "string"}],
"stateMutability": "nonpayable",
"type": "function"
}
],
"source_code": "pragma solidity ^0.8.0; contract AIContract { ... }",
"compiler_version": "v0.8.19+commit.7dd6d404",
"optimization_used": true,
"optimization_runs": 200,
"license": "MIT",
"is_verified": true,
"verification_date": 1638360000,
"ai_model_hash": "0x789abc...",
"zk_enabled": true,
"privacy_level": "full",
"function_count": 12,
"event_count": 5
}/api/v1/contracts/:address/eventsGet contract events/logs with filtering
Parameters
addressContract address
eventEvent signature to filter by
from_blockStarting block number
to_blockEnding block number
Response
Contract events and logs
{
"contract_address": "0xabc123...",
"events": [
{
"event": "InferenceCompleted",
"signature": "0x123456...",
"topics": ["0x...", "0x...", "0x..."],
"data": "0x...",
"block_number": 12345678,
"transaction_hash": "0x...",
"log_index": 0,
"timestamp": 1638360000,
"decoded_data": {
"request_id": "123",
"result": "Hello, world!",
"zk_proof": "0x..."
}
}
]
}/api/v1/contracts/verifyVerify and publish smart contract source code
Parameters
addressContract address
source_codeSolidity source code
compiler_versionCompiler version used
optimizationWhether optimization was used
Response
Verification result
{
"success": true,
"contract_address": "0xabc123...",
"verification_id": "12345",
"abi": [...],
"source_code_verified": true,
"zk_features_verified": true
}/api/v1/ai/inferenceRun AI inference with zero-knowledge proof generation
Parameters
modelAI model identifier (e.g., "bert-base-uncased", "gpt-2")
inputInput data for inference
privacy_levelPrivacy level: "none", "zk-proof", "full"
max_gasMaximum gas limit for execution
Response
Inference result with ZK proof
{
"request_id": "req_123456",
"model": "bert-base-uncased",
"result": {
"output": "Hello, world! [MASK] is great.",
"confidence": 0.95,
"tokens": [101, 102, 103, ...]
},
"zk_proof": {
"proof": "0x1a2b3c...",
"public_inputs": ["0x...", "0x..."],
"verification_key": "0x...",
"verified": true
},
"gas_used": 150000,
"execution_time": 245,
"privacy_guaranteed": true,
"timestamp": 1638360000
}/api/v1/ai/modelsGet list of available AI models with capabilities
Parameters
categoryFilter by category: "nlp", "vision", "audio", "multimodal"
zk_compatibleFilter for ZK-compatible models only
Response
Available AI models list
{
"models": [
{
"id": "bert-base-uncased",
"name": "BERT Base Uncased",
"category": "nlp",
"description": "Bidirectional Encoder Representations from Transformers",
"parameters": 110000000,
"zk_compatible": true,
"gas_cost_per_inference": 120000,
"accuracy": 0.92,
"supported_tasks": ["classification", "tokenization", "embedding"],
"version": "1.0.0",
"last_updated": 1638360000
},
{
"id": "gpt-2-small",
"name": "GPT-2 Small",
"category": "nlp",
"description": "Generative Pre-trained Transformer 2",
"parameters": 117000000,
"zk_compatible": true,
"gas_cost_per_inference": 200000,
"supported_tasks": ["generation", "completion"],
"version": "1.1.0"
}
],
"total_count": 25,
"zk_compatible_count": 18
}/api/v1/ai/models/verifyVerify AI model hash and integrity
Parameters
model_hashSHA-256 hash of the model
model_metadataModel metadata for verification
Response
Model verification result
{
"model_hash": "0x1a2b3c...",
"verified": true,
"model_info": {
"name": "BERT Base",
"version": "1.0.0",
"parameters": 110000000,
"zk_ready": true
},
"verification_proof": "0x...",
"timestamp": 1638360000
}/api/v1/ai/proofs/:idGet zero-knowledge proof details for AI inference
Parameters
idProof ID or inference request ID
Response
ZK proof details and verification data
{
"proof_id": "proof_123456",
"inference_id": "req_789012",
"proof_type": "groth16",
"curve": "bn254",
"proof_data": {
"a": ["0x...", "0x..."],
"b": [["0x...", "0x..."], ["0x...", "0x..."]],
"c": ["0x...", "0x..."]
},
"public_inputs": ["0x...", "0x...", "0x..."],
"verification_key": "0x...",
"verified": true,
"verification_time": 45,
"gas_used_verification": 50000,
"timestamp": 1638360000
}/api/v1/ai/trainSubmit AI model training job to the network
Parameters
dataset_hashIPFS hash of training dataset
model_configModel architecture and hyperparameters
privacy_levelTraining privacy level
max_gasMaximum gas for training
Response
Training job submission result
{
"job_id": "train_123456",
"status": "queued",
"estimated_completion": 3600,
"gas_estimate": 5000000,
"dataset_verified": true,
"zk_enabled": true,
"queue_position": 3,
"timestamp": 1638360000
}/api/v1/defi/poolsGet list of liquidity pools with TVL and APY
Parameters
token_pairFilter by token pair (e.g., "ETH/USDC")
min_tvlMinimum TVL filter
Response
Liquidity pools information
{
"pools": [
{
"id": "pool_123",
"token0": {
"symbol": "ETH",
"address": "0x...",
"decimals": 18
},
"token1": {
"symbol": "USDC",
"address": "0x...",
"decimals": 6
},
"reserve0": "1000000000000000000",
"reserve1": "2000000000",
"total_supply": "1414213562373095048",
"tvl": "4000000000000000000",
"volume_24h": "500000000000000000",
"fees_24h": "2500000000000000",
"apy": 12.5,
"fee_tier": 0.3,
"is_ai_powered": true,
"zk_protected": true
}
],
"total_tvl": "50000000000000000000",
"total_pools": 156
}/api/v1/defi/swapExecute token swap with AI-powered routing
Parameters
from_tokenSource token address
to_tokenDestination token address
amount_inInput amount in wei
slippageMaximum slippage tolerance (percentage)
Response
Swap execution result
{
"swap_id": "swap_123456",
"route": [
{
"pool_id": "pool_123",
"token_in": "0x...",
"token_out": "0x...",
"amount_in": "1000000000000000000",
"amount_out": "1990000000",
"fee": "10000000"
}
],
"total_amount_in": "1000000000000000000",
"total_amount_out": "1990000000",
"price_impact": 0.5,
"gas_estimate": 150000,
"ai_optimized": true,
"zk_verified": true
}/api/v1/defi/yieldsGet yield farming opportunities with AI predictions
Parameters
min_apyMinimum APY filter
risk_levelRisk level: "low", "medium", "high"
Response
Yield farming opportunities
{
"opportunities": [
{
"protocol": "EmpoorioYield",
"pool": "ETH-USDC",
"apy": 15.5,
"tvl": "10000000000000000000",
"risk_level": "medium",
"rewards": ["EMP", "ETH"],
"lock_period": 30,
"ai_prediction": {
"confidence": 0.85,
"predicted_apy_30d": 16.2,
"risk_score": 3.2
},
"zk_protected": true
}
],
"ai_recommendations": [
{
"pool_id": "pool_456",
"reason": "High confidence prediction with low risk",
"expected_return": 14.8
}
]
}/api/v1/nft/collectionsGet NFT collections with metadata and statistics
Parameters
creatorFilter by creator address
verifiedFilter for verified collections only
Response
NFT collections list
{
"collections": [
{
"address": "0xabc123...",
"name": "AI Art Collection",
"symbol": "AIART",
"creator": "0xdef456...",
"description": "AI-generated artwork collection",
"image": "ipfs://...",
"total_supply": 10000,
"floor_price": "1000000000000000000",
"volume_24h": "5000000000000000000",
"verified": true,
"ai_generated": true,
"zk_protected": true,
"royalty_fee": 5,
"traits": ["color", "style", "complexity"]
}
],
"total_collections": 1250
}/api/v1/nft/:token_idGet NFT metadata and ownership information
Parameters
token_idNFT token ID
contractContract address (if not in URL)
Response
NFT metadata and details
{
"token_id": "123",
"contract_address": "0xabc123...",
"owner": "0xdef456...",
"metadata": {
"name": "AI Portrait #123",
"description": "AI-generated portrait",
"image": "ipfs://Qm...",
"attributes": [
{
"trait_type": "Background",
"value": "Blue",
"rarity": 15.5
},
{
"trait_type": "Style",
"value": "Impressionist",
"rarity": 8.2
}
]
},
"ai_generated": true,
"zk_proof": "0x...",
"creation_timestamp": 1638360000,
"last_transfer": 1638360000,
"transfer_count": 3
}/api/v1/nft/mintMint new NFT with AI generation and ZK protection
Parameters
collectionCollection contract address
metadataNFT metadata
ai_generationWhether to use AI generation
Response
Minting transaction result
{
"token_id": "123",
"transaction_hash": "0x...",
"contract_address": "0x...",
"metadata_uri": "ipfs://...",
"ai_generated": true,
"zk_proof_generated": true,
"gas_used": 250000,
"timestamp": 1638360000
}/api/v1/stats/networkGet comprehensive network statistics and health metrics
Response
Network statistics overview
{
"block_height": 12345678,
"total_transactions": 250000000,
"active_addresses_24h": 45000,
"total_value_locked": "50000000000000000000000",
"gas_used_24h": "5000000000000000000",
"average_gas_price": "20000000000",
"network_hashrate": "1000000000000000000",
"active_validators": 150,
"total_stake": "100000000000000000000000",
"ai_inferences_24h": 50000,
"zk_proofs_generated_24h": 25000,
"uptime_percentage": 99.95,
"last_updated": 1638360000
}/api/v1/stats/charts/:metricGet historical data for charting and analytics
Parameters
metricMetric type: "tvl", "transactions", "gas", "ai_usage", etc.
periodTime period: "1h", "24h", "7d", "30d", "1y"
resolutionData resolution: "1m", "5m", "1h", "1d"
Response
Time-series data for the requested metric
{
"metric": "tvl",
"period": "30d",
"resolution": "1d",
"data": [
{
"timestamp": 1638360000,
"value": "45000000000000000000000"
},
{
"timestamp": 1638446400,
"value": "47000000000000000000000"
}
],
"change_24h": 4.5,
"change_7d": 12.3
}Official SDKs
Get started quickly with our official SDKs for popular programming languages