SahyadriSahyadriAPI

How to Connect

Step-by-step connection guides for exchanges, wallets, explorers, and data aggregators.

JSJavaScript / WebSocket

Connect from any browser or Node.js environment. All RPC calls go through WebSocket. This is the primary way wallets, explorers, and web apps communicate with the node.

const ws = new WebSocket('ws://127.0.0.1:27110');

ws.onopen = () => {
  // Get node info
  ws.send(JSON.stringify({
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getInfo",
    "params": [{}]
  }));

  // Subscribe to new blocks
  ws.send(JSON.stringify({
    "jsonrpc": "2.0",
    "id": 2,
    "method": "subscribeVirtualChainChanged",
    "params": [{ "includeAcceptedTransactionIds": true }]
  }));
};

ws.onmessage = (event) => {
  const data = JSON.parse(event.data);
  console.log(data);
};
PYPython / gRPC

For high-performance backend integrations. Use gRPC proto from Sahyadri repository. Generate Python stubs using grpcio-tools.

import grpc
from rpc_pb2 import *
from rpc_pb2_grpc import RPCServiceStub

channel = grpc.insecure_channel('127.0.0.1:27113')
stub = RPCServiceStub(channel)

# Get node info
response = stub.GetInfo(GetInfoRequest())
print(response.serverVersion)

# Get balance
balance = stub.GetBalanceByAddress(
    GetBalanceByAddressRequest(address="csm1s...")
)
print(balance.balance)
SHcURL / wscat

Quick testing from terminal using wscat for WebSocket.

# Install wscat
npm install -g wscat

# Connect
wscat -c ws://127.0.0.1:27110

# Send RPC calls
> {"jsonrpc":"2.0","id":1,"method":"getInfo","params":[{}]}
> {"jsonrpc":"2.0","id":2,"method":"getCoinSupply","params":[{}]}

Exchange Integration

Complete guide for exchanges to integrate Sahyadri CSM deposits and withdrawals.

Step 1: Detect Deposits

// Poll hot wallet balances
ws.send(JSON.stringify({
  "id": 1,
  "method": "getBalancesByAddresses",
  "params": [["csm1shot_wallet...", "csm1scold_wallet..."]]
}));

// Response
{
  "entries": [
    { "address": "csm1shot_wallet...", "balance": "1000000000" }
  ]
}

Step 2: Process Withdrawals

// Broadcast account transaction (withdrawal)
ws.send(JSON.stringify({
  "id": 2,
  "method": "submitAccountTransaction",
  "params": [{
    "sender": "csm1shot_wallet...",
    "receiver": "csm1suser...",
    "amount": 100000000,
    "nonce": 42,
    "signature": "dilithium_signature..."
  }]
}));

// Response
{
  "transactionId": "8f3a9b2c1d..."
}

Step 3: Monitor Confirmations

// Check block count for confirmations
ws.send(JSON.stringify({
  "id": 3,
  "method": "getBlockCount",
  "params": [{}]
}));

// Transaction confirmed when block count > tx block height + 6

Wallet Integration

Guide for wallet developers to display balances and send transactions.

Get Balance

ws.send(JSON.stringify({
  "id": 1,
  "method": "getBalanceByAddress",
  "params": ["csm1suser_wallet..."]
}));

// Response: { "balance": "2301100000000" }
// Display: 2301100000000 / 100000000 = 23011 CSM

Send Transaction

// 1. Get current nonce
ws.send(JSON.stringify({
  "id": 2,
  "method": "getAccountInfo",
  "params": ["csm1suser_wallet..."]
}));

// 2. Sign transaction with Dilithium-3
// 3. Broadcast
ws.send(JSON.stringify({
  "id": 3,
  "method": "submitAccountTransaction",
  "params": [{
    "sender": "csm1suser_wallet...",
    "receiver": "csm1srecipient...",
    "amount": 100000000,
    "nonce": 42,
    "signature": "dilithium_signature..."
  }]
}));

Explorer Integration

Guide for block explorers to display real-time blockchain data.

// Subscribe to new blocks
ws.send(JSON.stringify({
  "id": 1,
  "method": "subscribeVirtualChainChanged",
  "params": [{ "includeAcceptedTransactionIds": true }]
}));

// On new block notification
ws.onmessage = (event) => {
  const data = JSON.parse(event.data);
  if (data.type === "VirtualChainChangedNotification") {
    // Fetch full block details
    ws.send(JSON.stringify({
      "id": 2,
      "method": "getBlock",
      "params": [{ "hash": data.chainBlocks[0].acceptingBlockHash }]
    }));
  }
};

Mining Pool Integration

Guide for mining pools to distribute work and submit solutions.

// Get work for miners
ws.send(JSON.stringify({
  "id": 1,
  "method": "getBlockTemplate",
  "params": [{ "payAddress": "csm1sminer..." }]
}));

// Distribute to miners
// Miners find nonce with SahyadriX hash

// Submit solution
ws.send(JSON.stringify({
  "id": 2,
  "method": "submitBlock",
  "params": [{ "block": "serialized_block..." }]
}));

Available Now:
• Rust Node - Native gRPC server + client
• WASM SDK - Browser wallet signing (Dilithium-3)
• Proto Files - Generate stubs in any language
• WebSocket API - Direct browser connection

Language Support:
• Rust - Native (node + client)
• JavaScript - WebSocket + WASM
• TypeScript - Proto-generated stubs
• Python - Via gRPC proto (grpcio-tools)
• Go - Via gRPC proto
• Any gRPC-supported language