Native Primitives
HTTPS on-chain, real-time price feeds, native randomness, and timers � built into the protocol, not bolted on.
Every capability on this page replaces a category of external service that developers on other chains must source, integrate, pay for separately, and monitor. On Rialo, they are protocol-level primitives with stable, predictable costs and no additional trust assumptions.
HTTPS on-chain
Rialo programs can make secure HTTPS requests directly from on-chain code, verified via Trusted Execution Environments (TEEs). No third-party oracle or off-chain relay is required. The request is issued by the Rialo node, the response is verified in the TEE enclave, and the result is committed to the chain as part of the transaction.
This enables smart contracts to read from any public API � weather data, sports scores, stock prices, credit scores, shipping status � without an intermediary.
use rialo_cdk::prelude::*;
use rialo_venus_dsl::rialo;
rialo! {
state {
last_weather_code: u32,
city: String,
}
program {
// Fetch weather data every 6 hours � no oracle needed
EVERY 6h => refresh_weather();
fn refresh_weather() {
let resp = https::get(
format!("https://api.weather.example/v1/current?city={}", state.city)
).expect("HTTPS call failed");
let data: WeatherResponse = resp.json();
state.last_weather_code = data.condition_code;
if data.condition_code == SEVERE_WEATHER {
emit!(SevereWeatherAlert { city: state.city.clone() });
}
}
}
}
#[derive(Deserialize)]
struct WeatherResponse {
condition_code: u32,
temperature_c: f64,
}
How TEE verification works
When a program issues an https::get() call:
- The Rialo node issues the request from within a TEE enclave (e.g. Intel TDX or AMD SEV-SNP)
- The TLS session is established inside the enclave � no node operator can see or modify the response
- The enclave produces a cryptographic attestation that proves: (a) the correct URL was fetched, (b) the response was not tampered with
- The attestation is verified by the rest of the network before the state change is committed
Because all nodes in the network must agree on state, HTTPS calls must return deterministic, cacheable responses within a given block. Rialo's runtime enforces response caching within a block window � the same URL called multiple times in one block returns the same result.
Price feeds
Rialo has native on-chain price feeds with stable costs. Unlike external oracle services (Chainlink, Pyth), price data is sourced and aggregated at the protocol level � no third party to trust, no per-request fee, no latency from a separate network.
use rialo_cdk::prelude::*;
fn check_collateral_ratio(ctx: Context) -> Result<()> {
// Get latest price � synchronous, no async call needed
let btc_price = price_feed::get("BTC/USD")?;
let eth_price = price_feed::get("ETH/USD")?;
// Prices include confidence intervals for risk calculations
let btc = price_feed::get_with_confidence("BTC/USD")?;
msg!("BTC price: {} � {}", btc.price, btc.confidence);
// Historical price (TWAP over 1h)
let btc_twap = price_feed::twap("BTC/USD", Duration::hours(1))?;
Ok(())
}
Available feed types
| Function | Description |
|---|---|
price_feed::get(pair) | Latest price for a trading pair |
price_feed::get_with_confidence(pair) | Price + confidence interval |
price_feed::twap(pair, duration) | Time-weighted average price |
price_feed::below(pair, threshold) | Event trigger � fires when price drops below value |
price_feed::above(pair, threshold) | Event trigger � fires when price rises above value |
price_feed::change(pair, pct) | Event trigger � fires on percentage change |
Randomness
True on-chain randomness is a first-class primitive in Rialo's REX runtime. No VRF service, no commit-reveal scheme, no external dependency. The random seed is generated inside the TEE at execution time and is verifiably unpredictable and unbiasable.
use rialo_cdk::prelude::*;
rialo! {
state {
participants: Vec,
winner: Option,
}
program {
fn enter(ctx: Context) {
state.participants.push(ctx.signer);
}
fn draw_winner(ctx: Context) {
require!(!state.participants.is_empty(), ErrorCode::NoParticipants);
// Native randomness � one line, no external service
let idx = random::range(0, state.participants.len() as u64) as usize;
state.winner = Some(state.participants[idx]);
emit!(WinnerSelected { winner: state.winner.unwrap() });
}
}
}
Timers
Timers in Rialo are native protocol primitives expressed through the Venus DSL's AFTER and EVERY keywords. See the Venus DSL reference for full details. The key point: these are registered with the protocol at deployment time and execute at the network level � no hosted scheduler, no external service, no uptime concern.
program {
EVERY 1h => hourly_task(); // runs every hour
EVERY 24h => daily_report(); // runs every day
AFTER 7d => trial_expiry(); // runs once after 7 days
}
Cross-chain data
Rialo can read state from other chains without bridges or wrappers. Cross-chain data is treated as a native read operation � the protocol handles proof verification under the hood.
use rialo_cdk::prelude::*;
fn check_ethereum_balance(eth_address: [u8; 20]) -> Result {
// Read ETH balance from Ethereum mainnet � no bridge, no wrapper
let balance = cross_chain::read(
Chain::Ethereum,
eth_address,
"balanceOf",
)?;
Ok(balance)
}
Messaging
Programs can send encrypted notifications to users via email, phone number, or device � without the user needing a wallet or any Web3 setup. This is powered by Rialo's identity-based encryption layer.
use rialo_cdk::prelude::*;
fn notify_user(recipient: Pubkey, message: &str) -> Result<()> {
// Send to wallet address (decrypted on their device)
messaging::send(recipient, message)?;
// Or send to email � no wallet needed on the receiving end
messaging::send_email("user@example.com", "Your order is ready")?;
// Send to phone number
messaging::send_sms("+1234567890", "Transaction confirmed")?;
Ok(())
}