DOCS / OPERATIONS / JSON-RPC API

JSON-RPC API

ShardoChain exposes a full JSON-RPC 2.0 surface for transaction submission, state queries, and explorer endpoints. Two endpoints coexist: the Go API at :8545 (full-featured, public-facing) and the Rust node's embedded RPC at :8547 (direct mempool access, higher throughput).

Endpoints

PortServiceUse case
8545Go API JSON-RPCPublic clients, supports CORS, metrics-instrumented
8547Rust embedded RPCHigh-TPS submission, direct mempool
8080REST + Explorer UI/api/v1/explorer/* for stats, blocks, accounts
8546WebSocketReal-time subscriptions (block, tx, log)
9090gRPCProtobuf API

Request format

curl -sm5 /rpc \
    -H 'Content-Type: application/json' \
    -d '{"jsonrpc":"2.0","id":1,"method":"shard_blockNumber","params":[]}'

# → {"jsonrpc":"2.0","id":1,"result":21089}

Transaction submission

shard_sendRawTransaction

Submit a single signed transaction (borsh-serialized hex string).

{"jsonrpc":"2.0","id":1,"method":"shard_sendRawTransaction",
 "params":["0x01a0…"]}

Returns: tx_hash (32-byte hex).

shard_sendRawTransactionBatch

Submit multiple TX in one call. Used by stress tools for high-TPS submission.

{"jsonrpc":"2.0","id":1,"method":"shard_sendRawTransactionBatch",
 "params":[["0xtx1…","0xtx2…","0xtx3…"]]}

Block queries

shard_blockNumber

Current chain tip (highest committed height).

shard_getBlockByNumber

{"jsonrpc":"2.0","id":1,"method":"shard_getBlockByNumber","params":[1234]}

Returns the block at height: header, transactions, receipts.

shard_getBlockByHash

{"jsonrpc":"2.0","id":1,"method":"shard_getBlockByHash",
 "params":["0xab…"]}

shard_getRecentBlockhash

Returns the most recent blockhash usable for recent_blockhash in a transaction (Solana-style stateless signing window).

Account queries

shard_getBalance

{"jsonrpc":"2.0","id":1,"method":"shard_getBalance",
 "params":["shard1abc…"]}

Returns balance in shardoshi (10^18 = 1 SHARD).

shard_getAccount

Full AccountState: balance, stake, delegated_stake, nonce.

shard_getTransactionCount

Returns the account's nonce (for sequenced TX flows; mostly informational).

Transaction queries

shard_getTransactionByHash

Returns the signed transaction by its 32-byte hash.

shard_getTransactionReceipt

Returns the execution receipt: status (Success/Reverted), gas_used, block_height, logs.

shard_getTransactionsByAddress

Paginated TX history for an address.

shard_getLogs

Filter contract logs by address, topic, block range. ETH-style.

Chain metadata

shard_chainId

Numeric chain identifier (currently 590 on testnet).

shard_getValidators

Active validator set for an epoch.

shard_getEpoch

Current epoch number and slot range.

shard_getFinality

Finality status: tip_height, attested_height, committed_height.

shard_syncStatus

Sync progress: syncing (bool), current_height, highest_known_height.

shard_getSupply

Returns aggregate balance, stake, delegated stake, total supply.

shard_getPruningInfo v5.1.6+

Reports the pruning configuration and the lowest-readable block:

{
  "mode": "archive",
  "lowest_block": 0,
  "current_height": 21089,
  "keep_blocks": 1000,
  "history_gap": 21088
}

Explorer endpoints (REST)

The Go API exposes additional endpoints for the block explorer UI:

Errors

Standard JSON-RPC 2.0 error codes plus ShardoChain-specific ones:

CodeMeaning
-32700Parse error (malformed JSON)
-32601Method not found
-32602Invalid params
-32603Internal error (DB read failure, FFI error)
-32000Mempool rejected (fee, signature, quota)
-32001Block not found
-32002Account not found / zero balance

Rate limits

Defaults (configurable via env vars on the Go API):

Validators bypass these limits (whitelist by node IP).