synor/sdk/shared/schemas/mining.json
Gulshan Yadav 59a7123535 feat(sdk): implement Phase 1 SDKs for Wallet, RPC, and Storage
Implements comprehensive SDK support for three core services across
four programming languages (JavaScript/TypeScript, Python, Go, Rust).

## New SDKs

### Wallet SDK
- Key management (create, import, export)
- Transaction signing
- Message signing and verification
- Balance and UTXO queries
- Stealth address support

### RPC SDK
- Block and transaction queries
- Chain state information
- Fee estimation
- Mempool information
- WebSocket subscriptions for real-time updates

### Storage SDK
- Content upload and download
- Pinning operations
- CAR file support
- Directory management
- Gateway URL generation

## Shared Infrastructure

- JSON Schema definitions for all 11 services
- Common type definitions (Address, Amount, UTXO, etc.)
- Unified error handling patterns
- Builder patterns for configuration

## Package Updates

- JavaScript: Updated to @synor/sdk with module exports
- Python: Updated to synor-sdk with websockets dependency
- Go: Added gorilla/websocket dependency
- Rust: Added base64, urlencoding, multipart support

## Fixes

- Fixed Tensor Default trait implementation
- Fixed ProcessorType enum casing
2026-01-27 00:46:24 +05:30

195 lines
5.9 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://synor.io/schemas/mining.json",
"title": "Synor Mining SDK",
"description": "Mining pool connection, block templates, and hashrate management",
"$defs": {
"MiningConfig": {
"type": "object",
"allOf": [{ "$ref": "common.json#/$defs/SynorConfig" }],
"properties": {
"stratumUrl": {
"type": "string",
"format": "uri",
"description": "Stratum protocol endpoint"
},
"workerName": { "type": "string" }
}
},
"PoolConfig": {
"type": "object",
"properties": {
"url": { "type": "string", "format": "uri" },
"username": { "type": "string" },
"password": { "type": "string" },
"workerName": { "type": "string" },
"algorithm": { "$ref": "#/$defs/MiningAlgorithm" }
},
"required": ["url", "username"]
},
"MiningAlgorithm": {
"type": "string",
"enum": ["sha256d", "scrypt", "ethash", "randomx", "kawpow", "synor-pow"]
},
"StratumConnection": {
"type": "object",
"properties": {
"id": { "type": "string" },
"poolUrl": { "type": "string" },
"connected": { "type": "boolean" },
"difficulty": { "type": "number" },
"extranonce1": { "type": "string" },
"extranonce2Size": { "type": "integer" },
"connectedAt": { "$ref": "common.json#/$defs/Timestamp" }
},
"required": ["id", "connected"]
},
"BlockTemplate": {
"type": "object",
"properties": {
"previousBlockHash": { "$ref": "common.json#/$defs/BlockHash" },
"height": { "type": "integer" },
"version": { "type": "integer" },
"bits": { "type": "string" },
"target": { "type": "string" },
"curTime": { "$ref": "common.json#/$defs/Timestamp" },
"coinbaseValue": { "$ref": "common.json#/$defs/Amount" },
"transactions": {
"type": "array",
"items": { "$ref": "#/$defs/TemplateTransaction" }
},
"merkleRoot": { "type": "string" },
"nonceRange": { "type": "string" }
},
"required": ["previousBlockHash", "height", "target", "coinbaseValue"]
},
"TemplateTransaction": {
"type": "object",
"properties": {
"data": { "type": "string" },
"txid": { "$ref": "common.json#/$defs/TxHash" },
"fee": { "$ref": "common.json#/$defs/Amount" },
"weight": { "type": "integer" }
},
"required": ["data", "txid", "fee"]
},
"MinedWork": {
"type": "object",
"properties": {
"jobId": { "type": "string" },
"extranonce2": { "type": "string" },
"nonce": { "type": "string" },
"nTime": { "type": "string" },
"hash": { "type": "string" }
},
"required": ["jobId", "extranonce2", "nonce", "nTime"]
},
"SubmitResult": {
"type": "object",
"properties": {
"accepted": { "type": "boolean" },
"blockHash": { "$ref": "common.json#/$defs/BlockHash" },
"difficulty": { "type": "number" },
"rejectReason": { "type": "string" }
},
"required": ["accepted"]
},
"Hashrate": {
"type": "object",
"properties": {
"current": { "type": "number", "description": "Hashes per second" },
"average1h": { "type": "number" },
"average24h": { "type": "number" },
"unit": {
"type": "string",
"enum": ["H/s", "KH/s", "MH/s", "GH/s", "TH/s", "PH/s"]
}
},
"required": ["current", "unit"]
},
"MiningStats": {
"type": "object",
"properties": {
"hashrate": { "$ref": "#/$defs/Hashrate" },
"sharesAccepted": { "type": "integer" },
"sharesRejected": { "type": "integer" },
"blocksFound": { "type": "integer" },
"uptime": { "$ref": "common.json#/$defs/Duration" },
"efficiency": { "type": "number", "minimum": 0, "maximum": 100 },
"lastShareAt": { "$ref": "common.json#/$defs/Timestamp" }
},
"required": ["hashrate", "sharesAccepted", "sharesRejected"]
},
"TimePeriod": {
"type": "string",
"enum": ["hour", "day", "week", "month", "all"]
},
"Earnings": {
"type": "object",
"properties": {
"period": { "$ref": "#/$defs/TimePeriod" },
"amount": { "$ref": "common.json#/$defs/Amount" },
"blocks": { "type": "integer" },
"shares": { "type": "integer" },
"estimatedDaily": { "$ref": "common.json#/$defs/Amount" }
},
"required": ["period", "amount"]
},
"MiningDevice": {
"type": "object",
"properties": {
"id": { "type": "string" },
"name": { "type": "string" },
"type": {
"type": "string",
"enum": ["cpu", "gpu", "asic", "fpga"]
},
"vendor": { "type": "string" },
"model": { "type": "string" },
"hashrate": { "$ref": "#/$defs/Hashrate" },
"temperature": { "type": "number" },
"fanSpeed": { "type": "integer", "minimum": 0, "maximum": 100 },
"power": { "type": "number", "description": "Watts" },
"enabled": { "type": "boolean" }
},
"required": ["id", "name", "type"]
},
"DeviceConfig": {
"type": "object",
"properties": {
"enabled": { "type": "boolean" },
"intensity": { "type": "integer", "minimum": 0, "maximum": 100 },
"powerLimit": { "type": "integer" },
"coreClockOffset": { "type": "integer" },
"memoryClockOffset": { "type": "integer" },
"fanSpeed": { "type": "integer", "minimum": 0, "maximum": 100 }
}
},
"ListDevicesResponse": {
"type": "object",
"properties": {
"devices": {
"type": "array",
"items": { "$ref": "#/$defs/MiningDevice" }
},
"totalHashrate": { "$ref": "#/$defs/Hashrate" }
},
"required": ["devices"]
}
}
}