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/v1

All API endpoints are prefixed with this base URL

Authentication

Most endpoints require API key authentication

Authorization: Bearer YOUR_API_KEY

API Endpoints

GET/api/v1/blocks/latest

Get 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
}
GET/api/v1/blocks/:number

Get block information by block number

Parameters

number
stringrequired

Block 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
}
GET/api/v1/blocks/:hash

Get block information by block hash

Parameters

hash
stringrequired

Block hash (hex format with 0x prefix)

Response

Complete block object

{
  "block_number": 12345678,
  "hash": "0x1a2b3c...",
  "transactions": [...]
}
GET/api/v1/transactions/:hash

Get complete transaction details including receipt and logs

Parameters

hash
stringrequired

Transaction 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
}
GET/api/v1/transactions

Get paginated list of transactions with filtering options

Parameters

block
string

Filter by block number or hash

address
string

Filter by from/to address

limit
number

Number of transactions to return (max 10000)

offset
number

Pagination offset

Response

Paginated transaction list

{
  "transactions": [...],
  "total_count": 1000000,
  "page_size": 100,
  "page": 1,
  "has_more": true
}
POST/api/v1/transactions

Submit a signed transaction to the network

Parameters

signed_tx
stringrequired

Signed transaction data (hex format)

Response

Transaction hash and submission status

{
  "tx_hash": "0x1a2b3c...",
  "status": "submitted",
  "estimated_confirmation_time": 15
}
GET/api/v1/accounts/:address

Get complete account information including balance, nonce, and code

Parameters

address
stringrequired

Account 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
}
GET/api/v1/accounts/:address/transactions

Get transaction history for an account

Parameters

address
stringrequired

Account address

limit
number

Number of transactions (max 1000)

before
string

Cursor for pagination

Response

Account transaction history

{
  "address": "0xabc123...",
  "transactions": [...],
  "total_count": 156,
  "has_more": false
}
GET/api/v1/contracts/:address

Get smart contract information including ABI, source code, and verification status

Parameters

address
stringrequired

Contract 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
}
GET/api/v1/contracts/:address/events

Get contract events/logs with filtering

Parameters

address
stringrequired

Contract address

event
string

Event signature to filter by

from_block
number

Starting block number

to_block
number

Ending 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..."
      }
    }
  ]
}
POST/api/v1/contracts/verify

Verify and publish smart contract source code

Parameters

address
stringrequired

Contract address

source_code
stringrequired

Solidity source code

compiler_version
stringrequired

Compiler version used

optimization
boolean

Whether optimization was used

Response

Verification result

{
  "success": true,
  "contract_address": "0xabc123...",
  "verification_id": "12345",
  "abi": [...],
  "source_code_verified": true,
  "zk_features_verified": true
}
POST/api/v1/ai/inference

Run AI inference with zero-knowledge proof generation

Parameters

model
stringrequired

AI model identifier (e.g., "bert-base-uncased", "gpt-2")

input
string|objectrequired

Input data for inference

privacy_level
string

Privacy level: "none", "zk-proof", "full"

max_gas
number

Maximum 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
}
GET/api/v1/ai/models

Get list of available AI models with capabilities

Parameters

category
string

Filter by category: "nlp", "vision", "audio", "multimodal"

zk_compatible
boolean

Filter 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
}
POST/api/v1/ai/models/verify

Verify AI model hash and integrity

Parameters

model_hash
stringrequired

SHA-256 hash of the model

model_metadata
object

Model 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
}
GET/api/v1/ai/proofs/:id

Get zero-knowledge proof details for AI inference

Parameters

id
stringrequired

Proof 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
}
POST/api/v1/ai/train

Submit AI model training job to the network

Parameters

dataset_hash
stringrequired

IPFS hash of training dataset

model_config
objectrequired

Model architecture and hyperparameters

privacy_level
string

Training privacy level

max_gas
number

Maximum 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
}
GET/api/v1/defi/pools

Get list of liquidity pools with TVL and APY

Parameters

token_pair
string

Filter by token pair (e.g., "ETH/USDC")

min_tvl
number

Minimum 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
}
POST/api/v1/defi/swap

Execute token swap with AI-powered routing

Parameters

from_token
stringrequired

Source token address

to_token
stringrequired

Destination token address

amount_in
stringrequired

Input amount in wei

slippage
number

Maximum 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
}
GET/api/v1/defi/yields

Get yield farming opportunities with AI predictions

Parameters

min_apy
number

Minimum APY filter

risk_level
string

Risk 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
    }
  ]
}
GET/api/v1/nft/collections

Get NFT collections with metadata and statistics

Parameters

creator
string

Filter by creator address

verified
boolean

Filter 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
}
GET/api/v1/nft/:token_id

Get NFT metadata and ownership information

Parameters

token_id
stringrequired

NFT token ID

contract
string

Contract 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
}
POST/api/v1/nft/mint

Mint new NFT with AI generation and ZK protection

Parameters

collection
stringrequired

Collection contract address

metadata
objectrequired

NFT metadata

ai_generation
boolean

Whether 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
}
GET/api/v1/stats/network

Get 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
}
GET/api/v1/stats/charts/:metric

Get historical data for charting and analytics

Parameters

metric
stringrequired

Metric type: "tvl", "transactions", "gas", "ai_usage", etc.

period
string

Time period: "1h", "24h", "7d", "30d", "1y"

resolution
string

Data 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

🟨

JavaScript/TypeScript

npm install @EmpoorioChain/sdkView Documentation
🐍

Python

pip install EmpoorioChain-sdkView Documentation
🦀

Rust

cargo add EmpoorioChain-sdkView Documentation