Skip to content

Latest commit

 

History

History
209 lines (136 loc) · 3.42 KB

File metadata and controls

209 lines (136 loc) · 3.42 KB

Public API Reference

JSON-RPC endpoints for interacting with SynapticChain.


Base URLs

Network Endpoint
Mainnet RPC https://rpc.synapticchain.xyz
API Proxy https://api.synapticchain.xyz
Testnet RPC https://rpc.synapticchain.xyz (testnet mode)

All endpoints accept POST requests with Content-Type: application/json.


Standard JSON-RPC Format

{
  "jsonrpc": "2.0",
  "method": "syn_getBalance",
  "params": ["syn1rjzc59jwqflhme0gqu6mwf48eny8ms4xlx08mc"],
  "id": 1
}

Response:

{
  "jsonrpc": "2.0",
  "result": "1000000000",
  "id": 1
}

Account Methods

syn_getBalance

Get the balance of an address in wei (smallest unit).

Params: [address: str]
Returns: str (balance as decimal string)

curl -X POST https://rpc.synapticchain.xyz \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"syn_getBalance","params":["syn1rjzc59jwqflhme0gqu6mwf48eny8ms4xlx08mc"],"id":1}'

syn_getAccount

Get full account information.

Params: [address: str]
Returns: Account object

syn_getNonce

Get the next transaction nonce for an address.

Params: [address: str]
Returns: u64


Transaction Methods

syn_sendTransaction

Submit a signed transaction.

Params: [signed_tx: object]
Returns: tx_hash: str

syn_getTransaction

Get transaction details by hash.

Params: [tx_hash: str]
Returns: Transaction object or null

syn_getTransactionReceipt

Get transaction receipt (status, gas used, logs).

Params: [tx_hash: str]
Returns: Receipt object or null


Contract Methods

syn_deployContract

Deploy a compiled contract.

Params: [owner: str, bytecode: str, gas_limit: u64]
Returns: contract_address: str

syn_callContract

Call a contract function (read-only, no state change).

Params: [contract: str, function: str, args: array]
Returns: Function-specific

syn_executeContract

Execute a contract function (state-changing, requires signature).

Params: [signed_tx: object]
Returns: tx_hash: str


Network Methods

syn_getStatus

Get network status.

Params: []
Returns:

{
  "chain_id": 1,
  "height": 1234567,
  "synced": true,
  "validator_count": 18,
  "shard_count": 3
}

syn_getBlock

Get block by height or hash.

Params: [height_or_hash: str | u64]
Returns: Block object

syn_getBlockHeight

Get latest block height.

Params: []
Returns: u64

syn_getCheckpoint

Get latest checkpoint info.

Params: [shard_id: u64]
Returns: Checkpoint object


Rate Limits

Endpoint Limit
RPC 100 req/min per IP
API 1000 req/min per IP
Explorer 200 req/min per IP

Error Codes

Code Meaning
-32700 Parse error
-32600 Invalid request
-32601 Method not found
-32602 Invalid params
-32603 Internal error
-32000 Server error (invalid signature, insufficient balance, etc.)

WebSocket (Beta)

Real-time block and transaction subscriptions:

wss://rpc.synapticchain.xyz/ws

Subscribe to new blocks:

{
  "jsonrpc": "2.0",
  "method": "syn_subscribe",
  "params": ["newBlocks"],
  "id": 1
}

For SDK wrappers, see sdk/