# Scriptcore > Your strategy is a contract. Write a trading rule in one line; it compiles to canonical bytecode, is stored on-chain on Elysium (chain 99901), and bonded keepers fire it against live HyperCore state. HyperCore orders run through the user's own executor on HyperEVM (chain 999). Site: https://scriptcore.me Docs: https://scriptcore.me/docs App: https://scriptcore.me/app MCP (streamable HTTP, JSON-RPC 2.0): https://scriptcore.me/api/mcp SDK (zero-dependency ES module): https://scriptcore.me/sdk/scriptcore.mjs (curl -O it) ## Grammar strategy := [if] condition then action { ("," | "and") action } (1 to 4 actions) condition := or ; or := and { "or" and } ; and := not { "and" not } not := "not" not | primary [ "for" DURATION ] primary := "(" condition ")" | expr CMP expr | FIELD "crosses" ("above"|"below") CONST | "market_open(" ("NYSE"|"NASDAQ") ")" CMP := "<" | "<=" | ">" | ">=" expr := term { ("+"|"-") term } ; term := unary { ("*"|"/") unary } ; unary := "-" unary | NUMBER | PERCENT | FIELD | "(" expr ")" DURATION := integer with s|m|h|d, 1s..30d ; PERCENT := number% (10% = 0.1) Fields (COIN = any HyperCore perp, e.g. HYPE BTC ETH SOL; values are 8-decimal fixed point): COIN.mark COIN.mid COIN.oracle COIN.funding (hourly rate) COIN.oi (coins) COIN.imbalance(N) book imbalance over N levels, 1..20, default 5, range -1..1 COIN.change(W) (mid now - mid W ago) / mid then, W 60s..12h, default 1h COIN.bigtrade(W) largest trade notional USD in window W, 1s..1h, default 1m 0xADDRESS.COIN.position signed perp position of an address (max 8 per strategy) kHYPE.rate Kinetiq exchange rate, HYPE per kHYPE SPOT.mid for tokens that trade only on HyperCore spot Stocks, commodities, indices (Hyperliquid HIP-3 perps, trading 24/7; every field above works on them): NVDA.mark TSLA.funding SP500.change(1h) GOLD.oi bare symbol = first dex in perpDexs order (xyz first) xyz:TSLA.mark io:NVDA.mark dex:SYMBOL picks a dex; core perps win bare names (BTC) NVDA.close last US regular-session close (Nasdaq quote API), US-listed names only NVDA.gap (NVDA.mark - NVDA.close) / NVDA.close market_open(NYSE) condition: true during the US regular session (Nasdaq market-info API); NASDAQ is the same session close/gap/market_open register on the next StrategyRegistry; the live one accepts every other HIP-3 value today Actions: Elysium (StrategyRegistry, HYPE escrow): buy HYPE of KNTQ [min ] sell KNTQ for HYPE [min ] send HYPE to 0xADDRESS (swaps route through the KNTQ/WHYPE Uniswap v4 pool, the one pool routed today) HyperCore (user's CoreExecutor on HyperEVM, funded with USDC on HyperCore): long|short USDC of COIN [slip x%] n >= 1 (the book needs 10 USDC) close COIN [slip x%] reduce COIN by <1%..100%> [slip x%] twap long|short USDC of COIN in <2..20> slices every <30s..1h> [slip x%] slip defaults to 1%, max 10%; orders are IOC limits at the live mark moved by slip Either venue: notify "https://..." (up to 200 characters) One venue per strategy. Limits: 32 values, 8 addresses, 1024 condition bytes, 4 actions. Examples (these compile): if HYPE.funding < 0 then close HYPE if HYPE.mark < 40 then buy 0.001 HYPE of KNTQ if HYPE.mark crosses above 35.5 then buy 0.001 HYPE of KNTQ min 100 if HYPE.change(1h) < -10% then short 50 USDC of HYPE slip 0.5% if (HYPE.mark - HYPE.oracle) / HYPE.oracle > 0.2% for 3m then reduce HYPE by 50% if BTC.mid crosses below 90000 and ETH.funding > 0.00001 then short 20 USDC of BTC if not (HYPE.oi > 30000000) and kHYPE.rate > 1 then sell 1 KNTQ for HYPE if NVDA.mark crosses above 151.43 then buy 0.0005 HYPE of KNTQ min 250 if not market_open(NYSE) and NVDA.gap < -3% then short 20 USDC of NVDA if SP500.change(1h) < -1% then reduce NVDA by 50% ## Site API (stable URL; engine routes answer 503 {"ok":false,"error":"engine unreachable"} when the engine is down) POST /api/engine/compile {"source": "..."} -> {ok, code, codeHash, bytes, venue, slots, actions} | {ok:false, error:{col, msg}} GET /api/engine/health | /api/engine/stats | /api/engine/market | /api/engine/strategies | /api/engine/strategies/ | /api/engine/fires | /api/engine/metrics GET /api/engine-url -> {"http": string|null, "ws": string|null} WebSocket : send {"source":"..."}; receive {"type":"compiled",...,"condition":{ok,slots|error}} then {"type":"tick", t, values:[{label,value}], result:true|false|null, firedNow, fires} about 4 times a second GET /api/tape?limit=20 -> recent fires from chain Fired events, decoded source, values, tx; engine decision record when up GET /api/strategies?owner=0x... -> strategies from chain Registered events with state and decoded source ## MCP tools (POST https://scriptcore.me/api/mcp; methods initialize, tools/list, tools/call) compile_strategy {source} preview_strategy {source} live values and result, about 3 s list_fires {limit?, strategyId?} get_strategy {id} prepare_register {source, escrowHype, maxFires?, expiresInDays?, cooldown?, maxStaleness?, keeperFeeHype?} -> {to, data, value, chainId, summary} for the user's wallet to sign. The server never signs. Add to Claude Code: claude mcp add --transport http scriptcore https://scriptcore.me/api/mcp ## SDK (https://scriptcore.me/sdk/scriptcore.mjs) ADDRESSES, CHAINS, compile(source, {site}), buildRegister({code, limits:{expiry, maxFires, cooldown, maxStaleness, keeperFee}, escrowWei}) -> {to, data, value, chainId}, listStrategies({owner?, rpc?}), listFires({strategyId?, rpc?}), getStrategy(id, {rpc?}), decode(code), sourceOf(code) ## Registry ABI (Elysium) register(bytes code, (uint64 expiry, uint32 maxFires, uint32 cooldown, uint32 maxStaleness, uint128 keeperFee) limits) payable returns (uint256) msg.value = escrow: swap and send amounts plus keeper and protocol fees per fire; maxStaleness 1..120 s deposit(uint256 id) payable ; withdraw(uint256 id, uint256 amount) ; kill(uint256 id) ; strategyOf(uint256) ; codeOf(uint256) ; strategyCount() event Registered(uint256 indexed id, address indexed owner, bytes32 indexed codeHash, (uint64,uint32,uint32,uint32,uint128) limits, uint256 escrow) event Fired(uint256 indexed fireId, uint256 indexed id, address indexed keeper, uint64 trigger, uint64 snapshotTime, bytes32 snapshotHash, int256[] values, uint256[] amountsOut) event Killed(uint256 indexed id, uint256 refund) snapshotHash = keccak256(abi.encode(uint256 strategyId, uint64 trigger, uint64 snapshotTime, int256[] values)) ## Chains Elysium: chain id 99901, RPC https://rpc.elysium.kinetiq.xyz, explorer https://elysium.kinetiq.xyz HyperEVM: chain id 999, RPC https://rpc.hyperliquid.xyz/evm, explorer https://hyperevmscan.io ## Contracts Elysium: StrategyRegistry 0xe490d582e9b04B51CB0a78DABC2ea2dD5218EC78 KeeperBond 0x2Fbf4fFdd294C06f152CE0BCd7B7B3DfcC6C73Ea CoreTruth 0xba4C06E63acf076d90223bF94c0E8151DB40E3C1 FeeBurner 0xC461e6E2Bf71238e27e49A0628Af9e421e14aBc1 ScriptVM 0x5577ca5E61F5AC7384588Aa9c512A681923D2a44 HyperEVM: ExecutorFactory 0x86d0ACf8CB304b6037bf4BF6a8d00F20162ABBFD CoreExecutor implementation 0xC45e90986aa7649358124c0CC6e0C62E52234A82 TruthProbe 0x48476A68CBa8537B3c2c179982932E9aa6450283 ScriptVM 0x5577ca5E61F5AC7384588Aa9c512A681923D2a44 CoreWriter (HyperCore) 0x3333333333333333333333333333333333333333 Owner of every contract except user executors: 0x3F745575b764288403b2A079A9e79FaC525F08Cb (an EOA). Owner powers are listed in each contract's natspec and at /docs/contracts. ## Notes - HyperCore actions need the user's own CoreExecutor (ExecutorFactory.create(owner), then enable(code, limits) and setKeeper(keeper, true)) funded with USDC on HyperCore. - EL1 precompiles (EL1Read, ElysiumCoreWriter) are announced by Kinetiq but not live. Scriptcore is built for them and switches when they ship. - $SCRIPT is not launched. Keepers bond HYPE until the stake token is set once to $SCRIPT.