What is SCALE?

SCALE (Secure Coordinated Agent Ledger Environment) is Rialo's native framework for building agent-native programs. It provides the on-chain primitives that AI agents need to operate autonomously: identity, payments, task delegation, compliance checks, and coordination � all without requiring a human in the loop for every transaction.

Rialo's broader vision is that the AI systems with the greatest real-world impact will be decentralized. SCALE is the infrastructure layer that makes that possible.

??

Agent Identity

Each agent has a verifiable on-chain identity with scoped permissions � what it can spend, where it can transact, and under what conditions.

??

Autonomous Payments

Agents can pay other agents and services directly on-chain, within pre-approved limits, without human approval per transaction.

??

Task Delegation

Agents can delegate subtasks to other agents with cryptographic guarantees about scope, compensation, and outcome.

??

Compliance Rails

Spend limits, allowlists, audit trails, and revocable permissions are programmable � compliance is code, not policy.

The agent coordination problem

AI agents are increasingly capable of performing complex, multi-step tasks autonomously. But they face a fundamental coordination problem: how do agents transact with each other and with external services in a trustworthy way?

Without on-chain infrastructure, agents must rely on:

  • Centralized payment processors (single point of failure, censorship risk)
  • Human approval loops (defeats the purpose of automation)
  • Informal agreements with no enforcement mechanism
  • Fragile API integrations that break when services change

SCALE solves this by giving agents a programmable, verifiable economic environment. An agent's budget, permissions, and task obligations are on-chain � transparent, enforceable, and auditable.

??
Machine-to-machine economies

Capabilities like payments, data access, and compliance become composable, monetizable services exposed through open marketplaces. An agent can discover, hire, and pay another agent to perform a specialized task � all autonomously, all on-chain.

Agent identity & wallets

In SCALE, every agent is represented by a scoped wallet � an on-chain account that defines what the agent can do. Unlike a regular wallet, a scoped wallet has programmable constraints:

rust
use rialo_cdk::prelude::*;
use rialo_cdk::scale::*;

// Define an agent's scoped wallet
let agent_wallet = ScopedWallet::new()
    .owner(human_pubkey)                     // the human who controls this agent
    .spend_limit(1_000_000_000)              // max spend per period (in lamports)
    .spend_period(Duration::days(1))         // rolling 24-hour window
    .allowed_programs(vec![                  // whitelist of programs the agent can call
        defi_protocol::ID,
        data_marketplace::ID,
    ])
    .require_audit_log(true)                 // every action is logged on-chain
    .build()?;

The agent's key material lives in a TEE � the private key never leaves the enclave, and the agent's actions can be cryptographically attributed to its identity.

Agent payments

Agents pay for services using standard token transfers, but with SCALE's spending controls enforced at the protocol level. A payment that exceeds the agent's daily limit is automatically rejected � no human needed to monitor it.

rust
use rialo_cdk::scale::*;

rialo! {
    state {
        agent_wallet: ScopedWallet,
        task_budget:  u64,
    }

    program {
        // Agent pays a data provider for a market report
        fn purchase_data(ctx: Context, provider: Pubkey, price: u64) {
            // ScopedWallet enforces spend limits automatically
            scale::pay(
                &state.agent_wallet,
                provider,
                price,
                "market_data_report",
            ).expect("Payment failed or exceeds spend limit");

            // Request the data
            SEND request_data_delivery(provider);
        }

        fn request_data_delivery(provider: Pubkey) {
            let report = https::get(
                format!("https://data.provider.io/report?agent={}", ctx.signer)
            ).unwrap();
            // process report...
        }
    }
}

Task coordination

Agents can delegate subtasks to other agents using SCALE's task delegation primitives. The delegating agent escrows payment, the sub-agent performs the work, and the escrow releases upon verifiable completion.

rust
use rialo_cdk::scale::*;
use rialo_venus_dsl::rialo;

rialo! {
    state {
        task_id:     u64,
        delegatee:   Pubkey,
        reward:      u64,
        deadline:    i64,
        completed:   bool,
    }

    program {
        // Orchestrator agent delegates a task to a specialist agent
        fn delegate_task(
            ctx: Context,
            specialist: Pubkey,
            reward: u64,
            deadline_hours: u64,
        ) {
            state.task_id   = scale::new_task_id();
            state.delegatee = specialist;
            state.reward    = reward;
            state.deadline  = Clock::get().unix_timestamp
                              + (deadline_hours as i64 * 3600);

            // Escrow the reward
            scale::escrow(reward);

            // Notify the specialist agent
            SEND notify_specialist(specialist, state.task_id);

            // Auto-cancel and refund if deadline passes
            AFTER deadline_hours h => cancel_if_incomplete();
        }

        fn submit_result(ctx: Context, result_hash: [u8; 32]) {
            require!(ctx.signer == state.delegatee, ErrorCode::Unauthorized);
            state.completed = true;

            // Release escrowed reward to specialist
            scale::release_escrow(state.delegatee, state.reward);
            emit!(TaskCompleted {
                task_id: state.task_id,
                result_hash,
            });
        }

        fn cancel_if_incomplete() {
            if !state.completed {
                scale::refund_escrow();
                emit!(TaskCancelled { task_id: state.task_id });
            }
        }

        fn notify_specialist(agent: Pubkey, task_id: u64) {
            messaging::send(agent, format!("New task assigned: #{}", task_id));
        }
    }
}

Composable services marketplace

SCALE enables an open marketplace where agents publish capabilities as on-chain services, and other agents discover and consume them. Services are priced in tokens, and payment is atomic with delivery.

Service typeExamplePayment model
Data feedsCredit scores, sentiment analysis, shipping statusPer query
ComputeML inference, image generation, document parsingPer request
CoordinationMulti-agent task orchestration, consensusPer task
ComplianceKYC/AML checks, jurisdiction screeningPer check
ExecutionTrade execution, settlement, bridgingPer trade + fee

Full example � autonomous research agent

An agent that monitors news, purchases relevant data, and sends a daily briefing to its owner � entirely on-chain, no servers required.

rust
use rialo_cdk::prelude::*;
use rialo_cdk::scale::*;
use rialo_venus_dsl::rialo;

rialo! {
    state {
        owner:        Pubkey,
        wallet:       ScopedWallet,
        topics:       Vec,
        daily_budget: u64,
    }

    program {
        fn initialize(ctx: Context, topics: Vec, daily_budget: u64) {
            state.owner  = ctx.signer;
            state.topics = topics;
            state.wallet = ScopedWallet::new()
                .owner(ctx.signer)
                .spend_limit(daily_budget)
                .spend_period(Duration::days(1))
                .build()
                .unwrap();
            state.daily_budget = daily_budget;

            // Start daily briefing cycle
            EVERY 24h => generate_briefing();
        }

        fn generate_briefing() {
            let mut summaries = Vec::new();

            for topic in &state.topics {
                // Fetch news via native HTTPS
                let news = https::get(
                    format!("https://newsapi.example/v2/search?q={}", topic)
                ).unwrap();

                // Pay a summarization agent for AI-processed summary
                let summary_agent = scale::discover_service("text_summarizer").unwrap();
                scale::pay(&state.wallet, summary_agent.pubkey, summary_agent.price, "summarize").unwrap();

                let summary = https::post(
                    summary_agent.endpoint,
                    &news.body,
                ).unwrap();

                summaries.push(summary.text);
            }

            // Deliver briefing to owner (no wallet needed on their end)
            let briefing = summaries.join("\n\n---\n\n");
            messaging::send(state.owner, &briefing);

            emit!(BriefingDelivered {
                owner: state.owner,
                topic_count: state.topics.len() as u32,
            });
        }

        // Owner can update topics
        fn update_topics(ctx: Context, new_topics: Vec) {
            require!(ctx.signer == state.owner, ErrorCode::Unauthorized);
            state.topics = new_topics;
        }
    }
}

Further reading