API Reference
OmbraChain expune un REST API public pe https://api.ombra-net.com pentru explorare chain, query state, broadcast tx-uri.
Interactive explorer
Sau deschide direct: api-explorer/
Endpoint-uri principale
Chain
| Method | Path | Descriere |
|---|---|---|
| GET | /api/chain/height | Block height curent |
| GET | /api/chain/genesis | Block #0 (genesis) |
| GET | /api/chain/block/{index} | Block by index |
| GET | /api/chain/block/hash/{hash} | Block by hash |
| GET | /api/chain/blocks?from=&to= | Range bulk (max 100) |
| GET | /api/chain/peers | Lista peer-uri conectate |
| GET | /api/chain/network | Info network (PeerID, addresses) |
Transactions
| Method | Path | Descriere |
|---|---|---|
| POST | /api/chain/tx | Broadcast tx semnată |
| GET | /api/chain/tx/{hash} | Tx by hash |
| GET | /api/chain/mempool | Mempool curent |
| GET | /api/address/{addr}/txs?limit= | Tx history per address |
Accounts
| Method | Path | Descriere |
|---|---|---|
| GET | /api/address/{addr} | Balance + nonce |
| GET | /api/address/{addr}/balance | Doar balance |
Mining
| Method | Path | Descriere |
|---|---|---|
| GET | /api/miners | Lista mineri activi |
| GET | /api/miners/by-address/{addr} | MinerNFT pentru adresă |
| GET | /api/miners/{nftId} | MinerNFT detail |
| GET | /api/tasks/pending | Task-uri în mempool |
| GET | /api/tasks/{taskId} | Task status + result |
Stats
| Method | Path | Descriere |
|---|---|---|
| GET | /api/stats/supply | Total supply + burn + emisie |
| GET | /api/stats/validators | Validator stats (last 1000 blocks) |
| GET | /api/stats/tps | Tx-uri per secundă (avg, peak) |
Exemple
Get current height
curl https://api.ombra-net.com/api/chain/height
# → {"height": 9523}
Get block #9000
curl https://api.ombra-net.com/api/chain/block/9000
Response (v2 fork+):
{
"index": 9000,
"timestamp": 1715990000,
"prevHash": "abc...",
"hash": "def...",
"proposer": "5bb...",
"txRoot": "...",
"stateRoot": "...",
"tokensBurned": "10000",
"tokensConsumed": "850000",
"txs": [...],
"attestations": [
{
"validatorAddress": "abc...",
"signature": "...",
"publicKey": "..."
}
]
}
Broadcast transfer
curl -X POST https://api.ombra-net.com/api/chain/tx \
-H "Content-Type: application/json" \
-d '{
"tx": {
"type": "TRANSFER",
"from": "...",
"to": "...",
"amount": "1000000",
"fee": "10000",
"nonce": 42,
"timestamp": 1715990000,
"publicKey": "..."
},
"signature": "..."
}'
# → {"txHash": "..."}
Rate limits
| Tier | Requests / sec | Burst |
|---|---|---|
| Public (no key) | 10 | 30 |
| API key (free) | 100 | 300 |
| API key (pro) | 1000 | 3000 |
API key disponibil prin email la team@ombra-net.com (manual approval în MVP).
Header pentru rate limit info:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 87
X-RateLimit-Reset: 1715990060
CORS
API permite CORS de la orice origin (*) pentru GET requests. POST tx requests permise doar din origin-uri whitelisted (în roadmap — momentan *).
WebSocket
Pentru subscribe live la evenimente:
const ws = new WebSocket("wss://api.ombra-net.com/ws");
ws.send(JSON.stringify({ type: "subscribe", topic: "new_block" }));
ws.onmessage = (e) => {
const block = JSON.parse(e.data);
console.log("New block:", block.index);
};
Topics disponibile:
new_block— fiecare bloc finalizatnew_tx— fiecare tx în mempooladdress:{addr}— tx-uri care implică o adresă specificătask:{taskId}— update-uri status task AI
Official SDKs
TypeScript — @ombrachain/sdk
npm install @ombrachain/sdk
import { OmbraClient, Wallet } from "@ombrachain/sdk";
const client = new OmbraClient({ endpoint: "https://api.ombra-net.com" });
const { height } = await client.chain.getHeight();
const wallet = Wallet.generate();
const { hash } = await client.send({ wallet, to: "...", amount: 1_000_000n, fee: 10_000n });
Detalii complete: SDK TypeScript guide.
Python — ombrachain
pip install ombrachain
from ombrachain import OmbraClient, Wallet
client = OmbraClient("https://api.ombra-net.com")
height = client.chain.get_height()["height"]
wallet = Wallet.generate()
result = client.send(wallet, to="...", amount=1_000_000, fee=10_000)
Detalii complete: SDK Python guide.
Go / Rust (roadmap)
Pot fi adăugate dacă vine demand. Deschideți issue pe GitHub.