Skip to main content

MEMPOOL_TXS

Updated on
Apr 09, 2026

Overviewโ€‹

The MEMPOOL_TXS stream provides real-time access to pending transactions in Hyperliquid's mempool before they are confirmed and included in blocks.

Stream Type: MEMPOOL_TXS
API Availability: gRPC Streaming API only (testnet only)
Volume: Variable - Depends on mempool activity and network congestion


Testnet Only

The MEMPOOL_TXS stream is currently only available on Hyperliquid Testnet. It provides real-time visibility into pending transactions before they are included in blocks.

This stream is valuable for:

  • MEV Detection - Monitor pending trades to identify potential front-running opportunities
  • Transaction Analysis - Analyze transaction patterns and user behavior pre-confirmation
  • Order Flow Monitoring - Track incoming orders before they execute
  • Network Activity - Monitor mempool congestion and transaction volume
  • Testing and Development - Build and test applications against live testnet transaction flow

Each message contains a signed transaction with actions (orders, cancellations, transfers, etc.) that are waiting to be included in the next block.

Data Structureโ€‹

Each MEMPOOL_TXS event is an array with two elements:

[
"<timestamp>",
{
"signed_actions": [...],
"tx_hash": "0x..."
}
]

Response Fieldsโ€‹

FieldTypeDescription
[0] (timestamp)stringISO 8601 timestamp when the transaction entered the mempool
[1].tx_hashstringTransaction hash (0x-prefixed hex string)
[1].signed_actionsarrayArray of signed action objects - each represents a signed operation in the transaction

Signed Action Structureโ€‹

Each element in signed_actions contains:

FieldTypeDescription
actionobjectThe action being performed (order, cancel, transfer, noop, etc.)
noncenumberUnique nonce for this transaction to prevent replay attacks
signatureobjectECDSA signature with r, s, v components for transaction authentication

Action Typesโ€‹

The action object has a type field that determines its structure:

Order Action (type: "order")โ€‹

Used for placing new orders:

FieldTypeDescription
typestring"order" - indicates this is an order placement action
groupingstringOrder grouping strategy (e.g., "na" for no grouping)
ordersarrayArray of order objects to be placed

Order Object Fields:

FieldTypeDescription
anumberAsset/coin ID - numerical identifier for the trading pair
bbooleanBuy side - true for buy orders, false for sell orders
pstringPrice - limit price for the order
rbooleanReduce only - true if order can only reduce position
sstringSize - order quantity/amount
tobjectOrder type configuration (limit, trigger, etc.)
cstring(Optional) Client order ID (cloid) - custom identifier for tracking

Order Type Object (t field):

// Limit order
{
"limit": {
"tif": "Alo" // Time in force: "Alo", "Ioc", "Gtc"
}
}

// Trigger order (stop loss/take profit)
{
"trigger": {
"isMarket": true,
"tpsl": "sl", // "sl" = stop loss, "tp" = take profit
"triggerPx": "612.18"
}
}

Noop Action (type: "noop")โ€‹

No-operation transaction (often used for wallet activity or testing):

{
"action": {
"type": "noop"
},
"nonce": 1775736293821,
"signature": { ... }
}

Signature Structureโ€‹

FieldTypeDescription
rstringR component of ECDSA signature (0x-prefixed hex)
sstringS component of ECDSA signature (0x-prefixed hex)
vnumberRecovery ID (typically 27 or 28)

Example Responseโ€‹

[
"2026-04-09T12:07:15.440811159",
{
"signed_actions": [
{
"action": {
"grouping": "na",
"orders": [
{
"a": 122,
"b": false,
"p": "0.05726",
"r": false,
"s": "27989.1",
"t": {
"limit": {
"tif": "Ioc"
}
}
}
],
"type": "order"
},
"nonce": 1775736144931,
"signature": {
"r": "0x...",
"s": "0x...",
"v": 27
}
}
],
"tx_hash": "0x450e9f20970716b990944ee6691f6205ac138df1797138817f0689e0ae9b5bc3"
}
]

This example shows a sell order (IOC - Immediate or Cancel) for asset 122 at price 0.05726 with size 27989.1.

Multiple Actions Exampleโ€‹

A transaction can contain multiple signed actions:

[
"2026-04-09T12:07:15.658214500",
{
"signed_actions": [
{
"action": {
"grouping": "na",
"orders": [
{
"a": 1630000,
"b": true,
"c": "0xf7d9661c3bc8db57ce1c7d491ed7e991",
"p": "536.49",
"r": false,
"s": "1",
"t": {
"limit": {
"tif": "Alo"
}
}
}
],
"type": "order"
},
"nonce": 1775736358958,
"signature": { ... }
}
],
"tx_hash": "0x..."
}
]

Use Casesโ€‹

MEV Detectionโ€‹

Monitor pending orders to identify arbitrage opportunities or front-running risks:

for response in stream:
if response.HasField('data'):
data = json.loads(response.data.data)
timestamp, tx = data[0], data[1]

for signed_action in tx['signed_actions']:
if signed_action['action'].get('type') == 'order':
orders = signed_action['action']['orders']
for order in orders:
asset_id = order['a']
is_buy = order['b']
price = order['p']
size = order['s']

# Analyze order for MEV opportunities
analyze_order(asset_id, is_buy, price, size)

Transaction Monitoringโ€‹

Track transaction volume and mempool congestion:

tx_count = 0
order_count = 0

for response in stream:
if response.HasField('data'):
data = json.loads(response.data.data)
tx_count += 1

tx_data = data[1]
for signed_action in tx_data['signed_actions']:
if signed_action['action'].get('type') == 'order':
order_count += len(signed_action['action']['orders'])

print(f"Mempool: {tx_count} txs, {order_count} orders")

Filteringโ€‹

MEMPOOL_TXS supports standard stream filtering. Example filters:

// Filter by specific asset IDs
filters: {
"a": FilterValues { values: ["122", "6"] }
}

// Filter by order side (buy/sell)
filters: {
"b": FilterValues { values: ["true"] } // Buy orders only
}

// Filter by action type
filters: {
"type": FilterValues { values: ["order"] }
}

For complete filtering documentation, see Stream Filtering Guide.

gRPC Streamingโ€‹

Python Example
import grpc
import json
from pb import streaming_pb2, streaming_pb2_grpc

GRPC_ENDPOINT = 'your-endpoint.hype-testnet.quiknode.pro:10000'
AUTH_TOKEN = 'your-auth-token'

def stream_mempool():
credentials = grpc.ssl_channel_credentials()
channel = grpc.secure_channel(
GRPC_ENDPOINT,
credentials,
options=[
('grpc.max_receive_message_length', 100 * 1024 * 1024),
]
)

stub = streaming_pb2_grpc.StreamingStub(channel)
metadata = [('x-token', AUTH_TOKEN)]

def request_generator():
# Subscribe to MEMPOOL_TXS
subscribe_request = streaming_pb2.SubscribeRequest()
subscribe_request.subscribe.stream_type = streaming_pb2.StreamType.MEMPOOL_TXS
yield subscribe_request

# Keep connection alive with periodic pings
while True:
time.sleep(30)
ping_request = streaming_pb2.SubscribeRequest()
ping_request.ping.timestamp = int(time.time() * 1000)
yield ping_request

stream = stub.StreamData(request_generator(), metadata=metadata)

for response in stream:
if response.HasField('data'):
data = json.loads(response.data.data)
timestamp, tx = data[0], data[1]

print(f"Mempool TX: {tx['tx_hash']}")
print(f"Time: {timestamp}")
print(f"Actions: {len(tx['signed_actions'])}")

for signed_action in tx['signed_actions']:
action = signed_action['action']
print(f" Action type: {action.get('type')}")

if action.get('type') == 'order':
for order in action['orders']:
side = "BUY" if order['b'] else "SELL"
print(f" {side} asset={order['a']} "
f"price={order['p']} size={order['s']}")

if __name__ == "__main__":
stream_mempool()
JavaScript/Node.js Example
const grpc = require('@grpc/grpc-js');
const protoLoader = require('@grpc/proto-loader');

const GRPC_ENDPOINT = 'your-endpoint.hype-testnet.quiknode.pro:10000';
const AUTH_TOKEN = 'your-auth-token';

// Load proto file
const packageDefinition = protoLoader.loadSync('streaming.proto');
const proto = grpc.loadPackageDefinition(packageDefinition).hyperliquid;

// Create channel
const credentials = grpc.credentials.combineChannelCredentials(
grpc.credentials.createSsl(),
grpc.credentials.createFromMetadataGenerator((params, callback) => {
const metadata = new grpc.Metadata();
metadata.add('x-token', AUTH_TOKEN);
callback(null, metadata);
})
);

const client = new proto.Streaming(GRPC_ENDPOINT, credentials);

// Subscribe to MEMPOOL_TXS
const call = client.StreamData();

call.on('data', (response) => {
if (response.data) {
const [timestamp, tx] = JSON.parse(response.data.data);

console.log(`Mempool TX: ${tx.tx_hash}`);
console.log(`Time: ${timestamp}`);

tx.signed_actions.forEach(signedAction => {
const action = signedAction.action;
console.log(` Action: ${action.type}`);

if (action.type === 'order') {
action.orders.forEach(order => {
const side = order.b ? 'BUY' : 'SELL';
console.log(` ${side} asset=${order.a} price=${order.p} size=${order.s}`);
});
}
});
}
});

call.on('error', (error) => {
console.error('Stream error:', error);
});

// Send subscription
call.write({
subscribe: {
stream_type: 8 // MEMPOOL_TXS
}
});

// Send periodic pings
setInterval(() => {
call.write({
ping: { timestamp: Date.now() }
});
}, 30000);

Important Notesโ€‹


  1. Testnet Only - This stream is currently only available on Hyperliquid Testnet, not mainnet
  2. Pending Transactions - These transactions are NOT yet confirmed. They may fail, be cancelled, or never make it into a block
  3. No Guarantees - Mempool transactions can be reordered, replaced, or dropped
  4. High Volume - During active periods, the mempool stream can have high throughput
  5. Compression - Consider enabling zstd compression on your gRPC channel for bandwidth efficiency

  • ORDERS - Confirmed order events after block inclusion
  • TRADES - Executed trades after matching
  • EVENTS - System events including balance changes

For more information about gRPC streaming setup, see gRPC API Documentation.

Share this doc