RPC Reference

RPC Reference

Ruby Chain expone una JSON-RPC API estándar Ethereum + las extensiones de OP Stack. Si tu código corre en Ethereum/Polygon/Base, va a correr acá sin cambios.

Métodos soportados (resumen)

eth_* — todos los estándar Ethereum

eth_chainId, eth_blockNumber, eth_getBalance, eth_getTransactionCount, eth_sendRawTransaction, eth_call, eth_estimateGas, eth_getLogs, eth_getBlockByNumber, eth_getBlockByHash, eth_getTransactionByHash, eth_getTransactionReceipt, eth_getCode, eth_getStorageAt, eth_subscribe (WS), …

net_*, web3_*

net_version, net_listening, net_peerCount, web3_clientVersion, web3_sha3.

debug_* (limitado)

debug_traceTransaction, debug_traceCall, debug_traceBlockByNumber. No debug_setHead ni similares destructivos.

engine_*, miner_*

Internos del consensus / batcher. No expuestos públicamente vía Caddy.

Ejemplos

Chain ID

curl -X POST https://rpc.ruby.testnet.finetry.win \
  -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}'
# {"jsonrpc":"2.0","id":1,"result":"0x712"}

Block height actual

curl -X POST https://rpc.ruby.testnet.finetry.win \
  -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'

Balance de una wallet

curl -X POST https://rpc.ruby.testnet.finetry.win \
  -H "Content-Type: application/json" \
  --data '{
    "jsonrpc":"2.0",
    "method":"eth_getBalance",
    "params":["0x...","latest"],
    "id":1
  }'
# El result viene en wei (hex). Para humanos: parseInt(result, 16) / 1e18

Suscripción a nuevos bloques (WebSocket)

WebSocket no está expuesto públicamente todavía. Si lo necesitás, abrime un issue.

Ejemplos por librería

Ethers v6

import { ethers } from "ethers";
 
const provider = new ethers.JsonRpcProvider("https://rpc.ruby.testnet.finetry.win");
 
// Read
const block = await provider.getBlockNumber();
const bal = await provider.getBalance("0x...");
console.log(`Block ${block}, balance ${ethers.formatEther(bal)} RUBY`);
 
// Write (necesita PK)
const wallet = new ethers.Wallet(PRIVATE_KEY, provider);
const tx = await wallet.sendTransaction({ to: "0x...", value: ethers.parseEther("1") });
await tx.wait();

Viem

import { createPublicClient, http } from 'viem';
import { rubyChain } from './chain';
 
const client = createPublicClient({ chain: rubyChain, transport: http() });
const block = await client.getBlockNumber();

Web3.js

import Web3 from 'web3';
const web3 = new Web3('https://rpc.ruby.testnet.finetry.win');
const block = await web3.eth.getBlockNumber();

Python (web3.py)

from web3 import Web3
w3 = Web3(Web3.HTTPProvider('https://rpc.ruby.testnet.finetry.win'))
print(w3.eth.chain_id)        # 1810
print(w3.eth.block_number)

Go (go-ethereum / abigen)

import "github.com/ethereum/go-ethereum/ethclient"
 
client, err := ethclient.Dial("https://rpc.ruby.testnet.finetry.win")

Rate limits

Por ahora sin rate limit estricto (CDN-level rate limiting via Caddy: max body 1MB por request, bloqueo de paths abusivos). Para mainnet vamos a tener rate limits explícitos por API key.

Si tu app hace > 100 req/s sostenidos, contactá backend.developer@elektrum.io para coordinar.