Skip to main content

RPC Calls

Route any JSON-RPC call through the mixnet. The RPC provider sees the exit node, not your IP or wallet.

Generic RPC call

const result = await client.rpcCall(method, params);
ParameterTypeDescription
methodstringJSON-RPC method name
paramsunknownMethod parameters
rpcUrlOrOptsstring | object?Target RPC URL, or options object

When passing an options object:

OptionTypeDescription
rpcUrlstring?Target RPC endpoint
expectedResponseBytesnumber?Expected response size for SURB allocation

Returns: Parsed JSON-RPC result.

// Simple  - use exit node's default RPC
const block = await client.rpcCall("eth_blockNumber", []);

// Custom RPC endpoint
const block = await client.rpcCall("eth_blockNumber", [], "https://rpc.ankr.com/eth");

// With options - useful for large responses
const logs = await client.rpcCall("eth_getLogs", [filter], {
rpcUrl: "https://rpc.ankr.com/eth",
expectedResponseBytes: 50_000,
});

Convenience methods

The SDK provides typed wrappers for common RPC calls.

blockNumber

const block: number = await client.blockNumber();

Returns the current block number as a number (parsed from hex).

estimateGas

const gas: string = await client.estimateGas(
"0xContractAddress",
"0xCalldata"
);
ParameterTypeDescription
tostringTarget contract address
datastringHex-encoded calldata

Returns the gas estimate as a hex string.

getTransactionReceipt

const receipt = await client.getTransactionReceipt(
"0xTransactionHash"
);

Returns the receipt object, or null if the transaction hasn't been mined yet.

// Poll until mined
let receipt = null;
while (!receipt) {
receipt = await client.getTransactionReceipt(txHash);
if (!receipt) await new Promise((r) => setTimeout(r, 2000));
}
console.log("Status:", receipt.status);

getLogs

const logs = await client.getLogs({
address: "0xContractAddress",
fromBlock: "0x0",
toBlock: "latest",
topics: ["0xEventSignatureHash"],
});
OptionTypeDescription
addressstring?Filter by contract address
fromBlockstring?Start block (hex or tag)
toBlockstring?End block (hex or tag)
topics(string | null)[]?Topic filters

Returns an array of log objects.

info

getLogs auto-estimates the SURB budget based on the block range. Large ranges produce large responses - the SDK allocates extra SURBs to handle them.

Custom RPC endpoint

By default, the exit node uses its own configured RPC provider. You can specify a different one:

const result = await client.rpcCall(
"eth_blockNumber",
[],
"https://rpc.ankr.com/eth"
);

The exit node validates the target URL to prevent SSRF.

What's hidden

Without NOXWith NOX
RPC provider sees your IPProvider sees exit node IP
Provider links all your callsEach request can take a different route
Provider sees your wallet addressesProvider sees queries without identity
Timing reveals your activityCover traffic masks real requests