API INTEGRATION
Bare-Metal WebSocket implementation guide for Quantitative Systems.
1. CONNECTION PROTOCOL
The Mempool Oracle does not use REST. It pushes data asynchronously via a persistent TCP/WebSocket connection to guarantee zero latency.
ENDPOINT
ws://alpha.mempool-oracle.com:8080* Immediately upon establishing the socket, you must transmit your raw API key encoded in UTF-8. Failure to authenticate within 500ms results in an IP ban.
2. DATA SCHEMA
When a Ghost Resolve is successfully calculated, or an RBF Panic is detected, the engine emits the following structured JSON string:
{
"asset": "BTC",
"type": "LIVE_SEGWIT_WHALE",
"size_btc": 142.0721,
"txid": "ff292edea839c9279d5d723c98fea1d34789882fe3da8f5cc2bda599db962300",
"prevout": "02f9...",
"vout": 1,
"rbf_enabled": true,
"rbf_bump_count": 2,
"node_ip": "216.122.251.157",
"fee_sats_per_byte": 245.20
}3. PYTHON SNIPER IMPLEMENTATION
Use the following boilerplate to construct your execution listener.
import socket
import json
# Replace with your provisioned API Key
API_KEY = "YOUR_API_KEY_HERE"
ORACLE_IP = "alpha.mempool-oracle.com"
PORT = 8080
def listen_to_oracle():
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((ORACLE_IP, PORT))
# 1. Authenticate
s.sendall(API_KEY.encode('utf-8'))
print("[+] Handshake confirmed. Listening for Alpha...")
buffer = ""
while True:
data = s.recv(4096).decode('utf-8')
if not data:
print("[-] Connection severed by Oracle.")
break
buffer += data
while '\n' in buffer:
line, buffer = buffer.split('\n', 1)
if line.startswith("{"):
payload = json.loads(line)
# Filter for Ghost Resolves or Panic Dumps
if payload.get("fee_sats_per_byte", 0) > 150 or payload.get("rbf_bump_count", 0) > 0:
print(f"!!! LETHAL SIGNAL DETECTED !!!")
print(f"TXID: {payload['txid']}")
print(f"Fee Density: {payload['fee_sats_per_byte']} Sats/vB")
# Insert your execution logic here
if __name__ == "__main__":
listen_to_oracle()