Social-Pulse

Social-Pulse

Autonomous social-sentiment rotation kernel · EIP-7702 × x402 V2 × TEE sybil sentinel

Turn real-time social signals into machine-to-machine executable financial primitives. Built for the OKX Onchain OS Hackathon.

EIP-7702 Type-4x402 V2 reusable sessionTEE sybil sentinelX Layer + Arbitrum7+ OKX products
↓ Why this existsLive dashboard →
OVERVIEW

SocialFi, reframed as a financial primitive

Today's SocialFi ends at "launch a token." Social-Pulse treats social signals as a paid data stream that an autonomous agent consumes, validates, and converts into atomic on-chain rotations — without ever holding the user's private key.

The Problem

  • Public social feeds lag 10–30 minutes and are cheap to manipulate.
  • Reacting in time means polling APIs + manually signing trades — users sleep, miss windows.
  • Bot clusters and sybil campaigns make raw sentiment actively dangerous to trade on.
  • Traditional AA wallets (ERC-4337) carry idle-gas overhead that bleeds small accounts.

Our Answer

  • x402 V2 reusable sessions — pay $0.005 USDC per query to a premium sentiment stream, cached session-wide.
  • TEE sybil sentinel — refuse to sign when velocity, author entropy, or smart-money divergence flags firing.
  • EIP-7702 Type-4 — JIT-upgrade the EOA, run the whole rotation in one atomic batch, revert to pure EOA after.
  • X Layer ledger + medal — every decision (including HOLDs) committed to a zero-gas audit ledger with a soulbound NFT receipt.
4
MCP skills
2
chains wired
3
smart contracts
7+
OKX products
60s
decision tick
0 gas
on X Layer
ARCHITECTURE

Two chains, one autonomous loop

Rotation executes on Arbitrum (where Uniswap V3 + Aave V3 live). Audit + medal mint land on X Layer (zero gas, high throughput). Both sides sign through the same TEE.

   ┌────────────────── Social-Pulse Agent (TypeScript) ──────────────────┐
   │                                                                      │
   │   x402 V2 session ──► sentiment-engine ──► decide ──► sybil-sentinel │
   │   OKX DEX Signal ───►                        │                        │
   │                                      HOLD | GO_RISK | GO_HEDGE        │
   │                                                                      │
   │             TEE (Agentic Wallet) signs Type-4 tx + follow-ups         │
   └────────────┬──────────────────────────────────────────┬──────────────┘
                │ Arbitrum                                 │ X Layer (zero gas)
                ▼                                          ▼
 ┌────────────────────────────────┐        ┌──────────────────────────────────┐
 │ SocialPulseDelegate            │        │ SocialPulseLog   append-only log │
 │   executeBatch([NPM,OKX,Aave]) │        │ SocialPulseMedal ERC-721 receipt │
 └────────────────────────────────┘        └──────────────────────────────────┘
x402 V2

Reusable Session Intelligence Net

Opens a session with a single EIP-3009 payment auth. Subsequent GET /sentiment hits are quota-metered, TTL-capped, and auto-refresh when ≤10% queries remain. $0.005 USDC per query. Protocol-level session semantics are real even against the local mock.

EIP-7702

JIT Account Upgrade (Pectra Type-4)

The EOA authorizes SocialPulseDelegate via an authorizationList tuple signed over keccak256(0x05 ‖ rlp([chainId, address, nonce])). Within a single Type-4 tx, executeBatch runs Aave.withdraw → OKX DEX swap → UniV3 increaseLiquidity. Reverts to pure EOA after — no idle-gas tax.

TEE

Pre-signing Sybil Sentinel

Three parallel checks gate every signature: (1) velocity z-score vs trailing hour, (2) author cluster Shannon entropy, (3) paid-sentiment vs smart-money divergence. Flagged? The agent refuses to call sign-typed-data. HOLD + flags still hit the on-chain log for audit.

DeFi

Bidirectional Aave ⇄ Uniswap V3

GO_RISK = Aave.withdraw → OKX Router swap USDC→risk-asset → NPM.increaseLiquidity. GO_HEDGE = NPM.decreaseLiquidity + collect → OKX Router swap risk→USDC → Aave.supply. SocialPulseDelegate allowlist is immutable, checked on-chain.

TECHNICAL DETAILS

Under the hood

Key algorithms, on-chain shapes, and the exact OKX surface. Every box maps to a file in the repo.

Sentiment composition (score 0–100)

score = clamp01(
   0.4 · (polarity + 100) / 200       // paid x402 polarity
 + 0.3 · (0.5 + smDelta / 1e7)        // smart-money 24h USD
 + 0.2 · (velocityZ / 4)              // mention-rate z-score
 + 0.1 · (signalCount / 10)           // OKX signal events
) · 100
agent/core/sentiment-engine.ts

Sybil sentinel flags

bit0  velocityZ      ≥ 3.0
bit1  clusterEntropy  < 1.2
bit2  polarity > +25 ∧ smDelta < -$500k

ok = flags === 0
// No signature produced if !ok.
// HOLD + flags still logged to X Layer.
agent/core/sybil-sentinel.ts

EIP-7702 authorization digest

keccak256(
  0x05 ‖ rlp([
    chainId,      // 42161 (Arbitrum)
    delegate,     // SocialPulseDelegate
    nonce
  ])
)
// TEE returns { yParity, r, s }
// Assembled into authorizationList tuple.
agent/lib/eip7702.ts

Rotation batch (GO_RISK)

executeBatch([
  Aave.withdraw(USDC, amt, delegate),
  OKXRouter.<swap>(USDC→riskAsset),
  UniV3NPM.increaseLiquidity(pos),
])
// Allowlist: {NPM, Aave Pool, OKX Router}
// Any other target → TargetNotAllowed revert
contracts/src/SocialPulseDelegate.sol

x402 session lifecycle

POST /session/open
  { signature, authorization,
    ttlSeconds: 300, maxQueries: 1000 }
→ { sessionId, ttl, maxQueries }

GET /sentiment?session=<id>&ticker=<t>
→ { polarity, velocityZ,
    authorClusterEntropy, signalCount }

Refresh when queriesLeft < 10% or TTL < 30s.
agent/clients/x402-social-session.ts

On-chain log Entry (X Layer)

struct Entry {
  uint64    timestamp;
  address   owner;
  address   agent;
  Direction direction;     // HOLD / GO_RISK / GO_HEDGE
  uint8     sentimentScore;// 0-100
  uint8     sybilFlags;    // bitmask
  uint256   usdAmount;
  bytes32   batchTxHash;   // Arbitrum tx
  uint256   medalTokenId;
  string    reason;
}
contracts/src/SocialPulseLog.sol

OKX product stack

Agentic Wallet
TEE signs 7702 auth + Arbitrum batch + X Layer follow-ups
X Layer
Zero-gas audit ledger + soulbound medal NFT
DEX Swap
USDC ↔ risk-asset leg inside the 7702 batch
DEX Signal
Smart-money flow into sentiment score + sybil divergence check
DEX Market
Price / volume for risk-asset display
x402 Payment
Reusable-session micropayment auth for sentiment feed
Security
Pre-execution tx-scan gates every signature
Onchain Gateway
Type-4 tx broadcast + Arbitrum submission
LIVE DASHBOARD

Agent runtime, real time

Streamed over SSE from the monitor loop. Heartbeat tick, composed score, last rotation card, and the addresses of the deployed on-chain infra.

○ OFFLINE — start with pnpm agent:start

Live monitor

Ticker
Side
Score (0-100)
Latest verdict
x402 queries left
Tick #

Last rotation

No rotation yet — agent is in HEDGE-only heartbeat mode. Fire one from thesocial-pulse-action skill or setDEMO_MODE=true and inject a sentiment score.

The four skills (MCP surface)

social-pulse-fund
Cross-chain USDC → Arbitrum Aave hedge (initial position).
fund social-pulse · deposit 200 USDC · bridge to Aave
social-pulse-analyze
Read-only sentiment + smart-money divergence report.
analyze sentiment · score this ticker · social report OKB
social-pulse-action
Force one bidirectional rotation, respects the sybil gate.
rotate now · go risk · force one rotation
social-pulse-monitor
24/7 autonomous loop — poll, decide, sybil-check, rotate.
start social-pulse · autopilot · begin monitoring
ON-CHAIN PROOF

Real transactions, no screenshots

Everything here is a link you can click and verify on a public explorer. No mocks, no testnets.

Deployed contracts

SocialPulseLog (X Layer)_not deployed yet_
SocialPulseMedal (X Layer)_not deployed yet_
SocialPulseDelegate (Arbitrum)_not deployed yet_

Zero-gas on X Layer — every decision (including HOLDs flagged by the sybil sentinel) is appended to the ledger.

Prize surface

Most InnovativeEIP-7702 + x402 V2 + TEE sybil sentinel — rarely combined
Best Data AnalysisPaid heterogeneous feed (social + smart-money) drives every decision
AI Agent24/7 autonomous monitor signs without user confirmation
X LayerSocialPulseLog + SocialPulseMedal deployed on chainId 196
DeFiAave V3 + Uniswap V3 via OKX DEX Aggregator
Cross-chainArbitrum rotation ↔ X Layer audit + medal

Mainnet smoke-test transactions

Full-path test run on X Layer — OKX DEX swap, pre-execution security scan, TEE EIP-712 signing, native transfer.

X LayerUSDG → USDC swap (OKX DEX aggregator)0x0a4edfb94adec3dcX LayerERC-20 approve for swap0xbc178bd7d9279513X LayerNative send 0.001 OKB (self-transfer)0x0b4dc54180476931