RevealX Logo

RevealX

Prediction Protocol

DEVELOPER DOCUMENTATION

REVEALX DOCS

Full smart contract interfaces, client-side encryption algorithms, prediction pool wagers, and SDK code examples. Build next-generation time-locked escrows on EVM and Solana with RevealX.

QUICK START

Get up and running with RevealX in 4 simple steps: Connect Wallet, Create Capsule, Place Prediction, and Reveal Payload.

STEP 01CONNECT YOUR WALLET

Use the header button to connect your MetaMask (for Ethereum Sepolia/Hardhat Local) or Phantom (for Solana Devnet/Testnet/Mainnet) wallet.

BASH
# Faucets for local development:
# EVM (Hardhat local node): http://127.0.0.1:8545
# Solana (Devnet faucet): solana airdrop 1 <YOUR_WALLET_ADDRESS>
STEP 02CREATE A TIME CAPSULE

Enter your secrets, specify the unlock timestamp, recipient address, category hint, and lock your stake. The payload gets encrypted locally in your browser.

TYPESCRIPT
// Local Encryption & IPFS Upload Flow
const aesKey = crypto.getRandomValues(new Uint8Array(32));
const encryptedPayload = await encryptAESGCM(payloadText, aesKey);
const encryptedKey = await encryptECIES(aesKey, recipientPublicKey);
const ipfsCID = await uploadToIPFS(encryptedPayload);
STEP 03PLACE PREDICTION WAGER

Community members can browse public capsules in the explore feed and stake native tokens guessing the true category.

SOLIDITY
// Predict the capsule category on Ethereum
transaction = await timeCapsuleContract.makePrediction(
    capsuleId,
    uint8(Category.CryptoProfit),
    { value: ethers.parseEther("0.005") }
);
STEP 04REVEAL AND CLAIM

Once the unlock date passes, the creator unlocks the capsule, exposing the true category and releasing the stakes. Correct predictors claim their share of the reward pool.

RUST
// Claim Solana devnet reward on Win
pub fn claim_reward(ctx: Context<ClaimReward>) -> Result<()> {
    let capsule = &ctx.accounts.capsule;
    let prediction = &mut ctx.accounts.prediction;
    require!(prediction.guess == capsule.category, Error::WrongPrediction);
    // ... distributes proportional reward from prediction pool
}