MasayumeDocs
Open app
For builders

Configuration reference

Which process needs each setting, and how missing configuration behaves.

Reviewed 2026-09-07

Public browsing needs no environment file. Connected services need specific configuration in the process that uses it. The tables below list names and behavior; they contain no credentials.

Web settings visible to the browser

Next embeds NEXT_PUBLIC_ values in the client build. Put only public configuration in these fields, and rebuild when changing a value used by the browser.

NamePurpose
NEXT_PUBLIC_APP_ORIGINApp origin used for app URLs; local default is http://localhost:3000.
NEXT_PUBLIC_DOCS_URLExternal documentation origin used by app links and old /docs redirects; production uses https://docs.masayume.app.
NEXT_PUBLIC_WALLETCONNECT_PROJECT_IDOptional WalletConnect project configuration.
NEXT_PUBLIC_CHAIN_IDParsed chain setting; checked-in integration targets Shannon. Changing a number alone does not port contracts or signer clients to another chain.
NEXT_PUBLIC_INDEXER_URLDreamDEX GraphQL indexer endpoint.
NEXT_PUBLIC_RPC_HTTP_URLSComma-separated HTTP RPC endpoints.
NEXT_PUBLIC_RPC_WS_URLSComma-separated WebSocket RPC endpoints.
NEXT_PUBLIC_VENUE_IDVenue used by app discovery.
NEXT_PUBLIC_PRICE_FEED_URLOptional feed endpoint override.
NEXT_PUBLIC_PRICE_FEED_QUOTEFeed quote currency setting.
NEXT_PUBLIC_X_HANDLEPublic handle users mention.
NEXT_PUBLIC_X_EXECUTOR_ADDRESSPublic fallback for the X grant's executor address.

HTTP and WebSocket endpoint lists do not imply automatic runtime failover. The source currently keeps automatic rotation off.

Local contract overrides

Production normally uses the generated deployment manifest. These app overrides exist for a deliberately matched local fork:

ContractAddress overrideStart-block override
EventVaultNEXT_PUBLIC_EVENT_VAULT_ADDRESSNEXT_PUBLIC_EVENT_VAULT_FROM_BLOCK
ForwarderNEXT_PUBLIC_FORWARDER_ADDRESS
ParlayReserveNEXT_PUBLIC_PARLAY_RESERVE_ADDRESSNEXT_PUBLIC_PARLAY_RESERVE_FROM_BLOCK
RangeReserveNEXT_PUBLIC_RANGE_RESERVE_ADDRESSNEXT_PUBLIC_RANGE_RESERVE_FROM_BLOCK
MarketMakerVaultNEXT_PUBLIC_MARKET_MAKER_VAULT_ADDRESSNEXT_PUBLIC_MARKET_MAKER_VAULT_FROM_BLOCK
LeverageReserveNEXT_PUBLIC_LEVERAGE_RESERVE_ADDRESSNEXT_PUBLIC_LEVERAGE_RESERVE_FROM_BLOCK
PrivateDeskNEXT_PUBLIC_PRIVATE_DESK_ADDRESSNEXT_PUBLIC_PRIVATE_DESK_FROM_BLOCK

The market package also accepts GameArena address/from-block in its programmatic configuration. The current web/src/lib/env.ts does not expose matching NEXT_PUBLIC_GAME_ARENA_* variables. Do not invent environment support from a TypeScript option name.

Shared records

DATABASE_URL is server-only. Configure it on web and the ops actors that need the same records. The driver uses a small connection pool and requires TLS for hosts other than local loopback.

Without it, public market browsing works, but X relay, stored social activity, durable agent memory, Lucky draws, arcade score posting and the duel settler worklist are unavailable or degraded.

AI on web and ops

NamePurpose
AI_MODELModel identifier supplied to the resolver.
AI_BASE_URL + AI_API_KEYTogether select a custom OpenAI-compatible endpoint.
ANTHROPIC_API_KEYDirect credential when the selected provider is Anthropic.
OPENAI_API_KEYDirect credential when the selected provider is OpenAI.
GOOGLE_GENERATIVE_AI_API_KEYDirect credential when the selected provider is Google.
AI_GATEWAY_API_KEYFallback route through the AI Gateway.

Resolution order is custom endpoint, selected provider's direct key, Gateway, then unavailable. The checked-in default model is anthropic/claude-opus-5; this is a source default, not a claim that your account can access it.

Configure web for Sensei and Studio Dry read. Configure ops independently for AI runner execution. A credential on one host does not configure the other. Dry-run trading can still make model calls.

Strategy runner

NameBehavior
RUNNER_PRIVATE_KEYKey that must match each strategy's runner.
STRATEGY_IDSOptional comma-separated ids. Empty discovers strategies naming the key and its historical attempts; inactive strategies are retained for settlement.
STRATEGY_RUNNER_ADDRESSWeb's public house-runner address. This is an address, not a private key.
RUNNER_INTERVAL_MSDefaults to 30,000 ms; accepted minimum 5,000 ms.
AGENT_MAX_CALLS_PER_HOURSliding-hour AI call budget across the runner's strategies; default 60.
AGENT_TIMEOUT_MSPer-read timeout; default 20,000 ms.
VENUE_IDOptional ops venue override.
DRY_RUNRunner suppresses sends only when explicitly 1 or true.
DATABASE_URLRequired for new trades, durable decision/execution reservations, risk history and heartbeats.

With no key, explicit strategy ids can still be inspected and reported when the required stores are available. With neither ids nor key, the runner idles. Missing AI credentials make AI strategies hold. Missing or stale risk data and unresolved execution attempts also hold new submissions. Keep the strategy runner and X executor on distinct keys, with one process writing each key.

X: web and relay use different credentials

ProcessNamesPurpose
WebX_API_KEY, X_API_KEY_SECRETOAuth 1.0a consumer credentials for sign-in.
WebX_SESSION_SECRETSigns account identity cookies; no safe public fallback.
WebX_REDIRECT_URIOptional callback override; otherwise app origin plus /api/x/callback.
WebX_EXECUTOR_ADDRESSPublic address to name in Executor grants; takes precedence over public fallback.
OpsX_RETTIWT_API_KEYOperator account-session credential used by the current mention transport.
OpsX_HANDLEAccount whose mentions are searched; must match the authenticated operator session.
OpsX_EXECUTOR_PRIVATE_KEYKey executing under wallet grants.
OpsX_POLL_MSPoll interval; default 20,000 ms, minimum 5,000 ms.
OpsX_POSTING_ENABLED1 or true enables public replies.
OpsX_REPLY_IMAGES_ENABLED0 or false disables reply images. Otherwise images are enabled for replies when posting is on; image preparation/upload failures can fall back to text.
OpsDATABASE_URLRequired for account links, cursor, one-time mention claims, durable execution recovery, reply delivery and separate polling/execution/delivery health.

The callback origin must match the browser origin that writes OAuth cookies. Starting on another origin redirects to the configured canonical origin.

The relay's session credential is sensitive account access. Do not publish it or put it in a client variable. Startup resolves the session's stable account id; a configured-handle mismatch prevents the relay from starting. Turning replies off does not turn trading off.

Testnet onboarding faucet on web

NamePurpose
STT_FAUCET_ENABLEDOnly the exact value true enables STT allocations.
STT_FAUCET_PRIVATE_KEYDedicated server-only Shannon funding key, separate from admin, runner and sponsor keys.
STT_FAUCET_RPC_URLOptional HTTP endpoint override; sends require chain id 50312.
DATABASE_URLRequired shared durable challenge, quota and signed-transfer records.

Fund the dedicated wallet with Shannon STT. The address and readable balance are returned by GET /api/faucet; the API never returns its private key or signed transaction bytes. Do not use the same key for unrelated transactions: a conflicting nonce stops allocations for review.

The fixed policy tops wallets below 1 STT up to 2 STT, once per rolling 24 hours, with a 40 STT rolling global allocation and 10 STT retained reserve. The fee envelope is checked separately before signing. Limits and pending transfers are coordinated with a PostgreSQL transaction lock across web instances. A missing database or unreadable required chain state prevents a new transfer.

Production POST routes currently trust Vercel's overwritten x-forwarded-for header for an HMAC-derived connection identifier. Production outside Vercel fails closed until a trusted proxy adapter is implemented. Raw IPs are not stored. A shared connection can receive at most ten allocations per rolling 24 hours; signature challenges are also limited. These caps bound distribution but are not proof that each wallet belongs to a different person.

Only the STT leg uses this service. The tUSDC leg remains the user's transaction through the DreamDEX SDK faucet. This is independent of the older sponsorship routes below and grants no trading or deposit permission.

NamePurpose
SPONSOR_PRIVATE_KEYPays STT for accepted vault relay calls and duel-key gas top-ups.
SPONSOR_RPC_URLOptional sponsor HTTP endpoint override.
SPONSOR_MAX_GASCeiling for a forwarded vault request.
SPONSOR_PER_ADDRESS_PER_HOURRequest cap; default 30.
SPONSOR_PER_DEVICE_PER_HOURDevice cap; default 60.
SPONSOR_GAME_MAX_WEIPer-match duel gas top-up ceiling.
PRIVATE_DESK_PRIVATE_KEYKey matching the contract's named desk.
PRIVATE_DESK_RPC_URLOptional desk HTTP endpoint override.

The sponsor declines unsupported targets, selectors, native value, gas or deadlines. It never supplies the player's deposit or pot. Sponsor counters and funded-seat tracking are process-local, not shared durable quotas.

PrivateDesk checks its named key, pause state, stake limits and gas readiness. Its open is three desk transactions, so the key must fund more than one send.

Game room and recovery

NameProcess and purpose
ROOM_TOKEN_SECRETSame server secret on web and room; ops requires at least 16 characters.
GAME_ROOM_PUBLIC_URLWeb-visible room WebSocket URL, returned by room-token API.
GAME_ROOM_HOSTOps listen host; default loopback.
GAME_ROOM_PORTOps listen port; default 8787.
GAME_ROOM_REGIONQueue grouping; default default.
GAME_DECK_KEY32-byte hex key for AES-256-GCM deck material.
GAME_DECK_JOURNALPersistent journal path; default .masayume/deck-journal.jsonl relative to process working directory.
GAME_DECK_HORIZON_SECDeck eligibility horizon; default one hour.
GAME_DECK_CREATE_LATENCY_SECTime allowance for creation when testing remaining card life; default 45 seconds.
GAME_CREATE_WINDOW_MSWait for pending on-chain creation; default two minutes.
GAME_PROJECTOR_POLL_MSEvent projection poll interval; default 6 seconds.
GAME_PROJECTOR_SPANBounded block span; default 800.
GAME_PROJECTOR_SPANSSpans per catch-up cycle; default 25.
GAME_PROJECTOR_FROMExplicit projector starting block override.
GAME_SETTLER_PRIVATE_KEYKey paying for arena maintenance calls.
GAME_SETTLER_REFRESH_MSSettler refresh; default 30 seconds.

The web fallback room secret is random per process. It may support isolated development behavior, but it cannot authenticate tokens to a separate room process. Configure the shared secret for multiplayer.

Maker and leverage keeper

NamePurpose
MAKER_PRIVATE_KEYNamed maker key.
MM_ASSETS, MM_INTERVALSMarkets considered; default intervals are 300, 900 and 3,600 seconds.
MM_HALF_SPREAD_RAWDesired half-spread in raw price units; default 15,000.
MM_QUOTE_SIZEWhole contracts per side before contract/lot caps; default 5.
MM_REFRESH_MSMaker refresh; default 45 seconds.
MM_QUOTE_TTL_SECQuote lifetime; default 180 seconds.
MM_REQUOTE_TICKSPrice move before requote; default 3 ticks.
LEVERAGE_KEEPER_PRIVATE_KEYKey paying for knock-out and settlement calls.
LK_REFRESH_MSLeverage keeper refresh; default 20 seconds.

Maker, leverage keeper and duel settler default to dry-run. They send only when DRY_RUN is 0 or false. This differs from the strategy runner. Set it deliberately rather than relying on a shared default.

Seasons and contract tools

NamePurpose
SEASON_IDEnables a configured season; absent means no season.
SEASON_NAMEDisplay name, otherwise the id.
SEASON_ENDS_ATRequired ISO instant when a season id is set.
SEASON_PRIZE_SPLITRank bands in start:end:amount format.
SEASON_MIN_STAKED_DUELSPrize eligibility floor; default 1.
SEASON_ELIGIBILITY_NOTEExplanation shown beside eligibility.
SEASON_ADMIN_PRIVATE_KEYOperator distribution tool's signing key.

Share the same season rules between web and payout tools. The contract end time does not automatically authorize or trigger payout.

Contract scripts separately use settings such as DEPLOYER_PRIVATE_KEY, SHANNON_FORK_URL, FORK_MARKET_ID, FORK_RESOLVED_MARKET_ID, FORK_ASSET and SETTLED_QUESTION_ID for specific deployment/fork scenarios. Inspect the selected script: these are not web runtime variables and should not be copied wholesale into a web host.

Source notes

This guide follows the application code reviewed on 2026-09-07. Links point to that reviewed commit and require repository access. GitHub may show 404 if you are signed out or do not have access.

On this page