Skip to main content

WebSocket Events

QoreChain provides real-time event streaming through two WebSocket interfaces: the EVM-compatible WebSocket and the QoreChain Consensus Engine RPC WebSocket.

note

Both WebSocket interfaces are available on the qorechain-vladi mainnet (live on chain version v3.1.85) and the qorechain-diana testnet. The local endpoints below assume a node you run yourself; substitute your provider's mainnet or testnet host for remote access.


EVM WebSocket

Endpoint: ws://localhost:8546

The EVM WebSocket supports the standard eth_subscribe method for real-time event streaming compatible with Ethereum tooling.

Subscription Types

SubscriptionDescription
newHeadsEmits a header each time a new block is appended
logsEmits logs matching an optional filter
newPendingTransactionsEmits transaction hashes entering the mempool
syncingEmits sync status updates

Subscribe to New Blocks

{
"jsonrpc": "2.0",
"method": "eth_subscribe",
"params": ["newHeads"],
"id": 1
}

Subscribe to Logs with Filter

{
"jsonrpc": "2.0",
"method": "eth_subscribe",
"params": [
"logs",
{
"address": "0x742d35Cc6634C0532925a3b844Bc9e7595f2bD28",
"topics": ["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"]
}
],
"id": 2
}

Unsubscribe

{
"jsonrpc": "2.0",
"method": "eth_unsubscribe",
"params": ["0x1a2b3c..."],
"id": 3
}

QoreChain RPC WebSocket

Endpoint: ws://localhost:26657/websocket

The RPC WebSocket uses the QoreChain Consensus Engine event subscription system. Clients subscribe with a query string that filters events by type and attributes.

Subscribe to All New Blocks

{
"jsonrpc": "2.0",
"method": "subscribe",
"params": {
"query": "tm.event='NewBlock'"
},
"id": 1
}

Subscribe to All Transactions

{
"jsonrpc": "2.0",
"method": "subscribe",
"params": {
"query": "tm.event='Tx'"
},
"id": 2
}

Subscribe to Module-Specific Events

Filter by event type to receive only events from a specific module:

{
"jsonrpc": "2.0",
"method": "subscribe",
"params": {
"query": "tm.event='Tx' AND fraud_alert.severity EXISTS"
},
"id": 3
}

Unsubscribe

{
"jsonrpc": "2.0",
"method": "unsubscribe",
"params": {
"query": "tm.event='NewBlock'"
},
"id": 4
}

Module Events Reference

PQC Module

Event TypeKey AttributesDescription
pqc_hybrid_verifyaddress, algorithm, result (pass/fail), modeEmitted on each hybrid signature verification
pqc_hybrid_auto_registeraddress, algorithm, pubkey_hashEmitted when a PQC key is auto-registered

AI Module

Event TypeKey AttributesDescription
fraud_alertseverity (low/medium/high/critical), address, reason, scoreEmitted when fraud is detected in a transaction
circuit_breakermodule, action (tripped/reset), threshold, valueEmitted when an AI circuit breaker changes state

Bridge Module

Event TypeKey AttributesDescription
deposit_completedchain_id, sender, recipient, amount, asset, tx_hashEmitted when an inbound bridge deposit is confirmed
withdrawal_completedchain_id, sender, recipient, amount, asset, tx_hashEmitted when an outbound bridge withdrawal is confirmed

Cross-VM Module

Event TypeKey AttributesDescription
crossvm_requestmessage_id, source_vm, target_vm, sender, payload_hashEmitted when a cross-VM call is initiated
crossvm_responsemessage_id, source_vm, target_vm, success, gas_usedEmitted when a cross-VM call completes
crossvm_timeoutmessage_id, source_vm, target_vm, queued_at_heightEmitted when a cross-VM message exceeds queue timeout

Multilayer Module

Event TypeKey AttributesDescription
anchor_submittedlayer_id, layer_type, anchor_hash, height, submitterEmitted when a layer state anchor is submitted
layer_status_changedlayer_id, previous_status, new_status, reasonEmitted when a layer changes operational status

RDK Module

Event TypeKey AttributesDescription
rollup_createdrollup_id, operator, settlement_type, profileEmitted when a new rollup is registered
batch_submittedrollup_id, batch_index, state_root, tx_countEmitted when a settlement batch is submitted
batch_finalizedrollup_id, batch_index, finalized_at_heightEmitted when a batch passes its challenge window
da_blob_storedrollup_id, blob_index, size_bytes, commitmentEmitted when a DA blob is stored
da_blob_prunedrollup_id, blob_index, pruned_at_heightEmitted when a DA blob is pruned after retention

Burn Module

Event TypeKey AttributesDescription
fee_distributedtotal_fees, validator_amount, burn_amount, treasury_amount, staker_amountEmitted when collected fees are distributed
tokens_burnedamount, channel, block_heightEmitted when tokens are permanently burned

xQORE Module

Event TypeKey AttributesDescription
xqore_lockedaddress, amount, lock_duration, tierEmitted when QOR is locked into xQORE
xqore_unlockedaddress, amount, penalty_applied, penalty_amountEmitted when xQORE is unlocked back to QOR
pvp_rebaseepoch, total_penalty, rebase_amount, beneficiary_countEmitted during PvP rebase distribution

Inflation Module

Event TypeKey AttributesDescription
epoch_mintedepoch, minted_amount, inflation_rate, block_heightEmitted at the end of each inflation epoch

RL Consensus Module

PRISM parameter adjustments and circuit-breaker activity are emitted through this module.

Event TypeKey AttributesDescription
rl_action_appliedaction_type, param_key, old_value, new_value, rewardEmitted when the PRISM agent applies a parameter adjustment
circuit_breaker_triggeredreason, param_key, attempted_value, limitEmitted when the PRISM circuit breaker blocks an action

JavaScript Client Example

EVM WebSocket (ethers.js)

import { ethers } from "ethers";

const provider = new ethers.WebSocketProvider("ws://localhost:8546");

// Subscribe to new blocks
provider.on("block", (blockNumber) => {
console.log("New block:", blockNumber);
});

// Subscribe to contract events
const filter = {
address: "0x742d35Cc6634C0532925a3b844Bc9e7595f2bD28",
topics: [ethers.id("Transfer(address,address,uint256)")],
};
provider.on(filter, (log) => {
console.log("Transfer event:", log);
});

QoreChain RPC WebSocket (Native)

const ws = new WebSocket("ws://localhost:26657/websocket");

ws.onopen = () => {
// Subscribe to fraud alerts
ws.send(JSON.stringify({
jsonrpc: "2.0",
method: "subscribe",
params: { query: "tm.event='Tx' AND fraud_alert.severity EXISTS" },
id: 1,
}));

// Subscribe to rollup batch submissions
ws.send(JSON.stringify({
jsonrpc: "2.0",
method: "subscribe",
params: { query: "tm.event='Tx' AND batch_submitted.rollup_id EXISTS" },
id: 2,
}));
};

ws.onmessage = (event) => {
const data = JSON.parse(event.data);
if (data.result && data.result.events) {
console.log("Event received:", data.result.events);
}
};

Notes

  • Connection limits: The default maximum number of WebSocket connections is unlimited (max-open-connections = 0). Set a limit in app.toml for production deployments.
  • Event buffer: The RPC WebSocket buffers up to 200 events per subscription. If the client falls behind, older events are dropped.
  • Reconnection: Clients should implement automatic reconnection with exponential backoff, as WebSocket connections may be interrupted during node restarts or upgrades.