Skip to main content

nexus query height

Get the current block height.
nexus query height

Output

→ Querying chain height...
Current block height: 1234

nexus query block

Get block information by height.
nexus query block <HEIGHT>

Example

nexus query block 100

Output

→ Block #100
Current Chain Tip: 1234

nexus query events

Query contract events with filters.
nexus query events [OPTIONS]

Options

OptionDescription
-c, --contract <ID>Filter by contract ID
-n, --event-name <NAME>Filter by event name
-f, --from <HEIGHT>From block height
-t, --to <HEIGHT>To block height

Examples

# All events for a contract
nexus query events --contract a1b2c3d4...

# Specific event type
nexus query events --contract a1b2c3d4... --event-name Transfer

# Events in block range
nexus query events --from 100 --to 200

# Combined filters
nexus query events \
  --contract a1b2c3d4... \
  --event-name Transfer \
  --from 100 \
  --to 200

Output

→ Querying events...
Found 3 events:
  Block 105: [Transfer] 0x1234...
  Block 110: [Transfer] 0x5678...
  Block 115: [Approval] 0x9abc...

nexus query node-info

Get node information including protocol key.
nexus query node-info

Output

{
  "version": "0.1.0",
  "network": "regtest",
  "mode": "primary",
  "block_height": 1234,
  "protocol_public_key": "1234567890abcdef...",
  "peer_count": 5
}
The protocol_public_key is needed for deriving vault addresses.

Common Queries

Check Sync Status

nexus query sync-status

Get Gas Price

nexus query gas-price

List Contracts

nexus query contracts --limit 10

Get Transaction

nexus query tx <TX_HASH>

RPC Endpoint Selection

Query commands use the configured RPC endpoint:
# Use default (localhost:8545)
nexus query height

# Use custom endpoint
nexus --rpc http://node.example.com:8545 query height

# Use with fallbacks
nexus --rpc http://primary:8545 \
      --rpc-fallback http://backup1:8545,http://backup2:8545 \
      query height