Start Here

Source: README.md

RAGA Protocol

NEP-171 Token-Bound Smart Accounts for Tradable & Rentable Autonomous AI Workers on NEAR Protocol.

Transform static NFTs into productive, revenue-generating on-chain entities. Every RAGA token is bound to an exclusive NEAR hierarchical sub-account (<token_id>.<contract_id>), turning each agent into an autonomous actor capable of holding state, earning streaming yield, and executing delegated cross-contract workloads with time-locked SLA guarantees.

Built for NEAR HACKATHON 2026 (Primary Track: nfts — NFTs That Do Something · Sub-Tracks: agents — Agent Economy, security — AI Security & Defense, open — Open Innovation).

![Live Testnet Contract](https://testnet.nearblocks.io/address/raga-protocol-mw93m309.testnet) ![Track: NFTs That Do Something-10b981?style=flat-square)](https://nearhackathon.com) ![Rust Contract](contracts/) ![Next.js dApp-black?style=flat-square&logo=next.js)](app/) ![Worker Daemon-3b82f6?style=flat-square&logo=typescript)](worker-daemon/) ![License: MIT](LICENSE)

Live Testnet Contract · Contract Initialization Tx · Technical Architecture (docs/ARCHITECTURE.md) · Implementation Specs (docs/IMPLEMENTATION.md)

Companion Technical Documents:

  • docs/ARCHITECTURE.md — System architecture, sub-account derivations, execution delegation matrix, and NEP standards compliance.
  • docs/IMPLEMENTATION.md — Technical implementation specs: token binding, zero private-key invariant, time-locked micro-leasing, NEP-178 transfer freeze, and failure policy matrix.
  • docs/INTEGRATIONS.md — Live on-chain deployment details, cryptographic transaction hashes on testnet, off-chain worker daemon specs, and RPC integration.
  • docs/DEPLOY.md — Deployment and operations runbook, storage staking economics, PM2 configuration, and Next.js setup.

Status

Metric / CheckStatusVerification Detail / Command
Rust Contract TestsPASS4 unit tests pass (cargo test --manifest-path contracts/Cargo.toml)
WASM CompilationPASSTarget wasm32-unknown-unknown release build (contracts/target/.../raga_contracts.wasm)
Next.js Production BuildPASS12/12 routes static & dynamic compiled (npm run build in app/)
Worker Daemon BuildPASSTypeScript compile clean (npm run build in worker-daemon/)
Live Contract DeployedVERIFIEDraga-protocol-mw93m309.testnet on NEAR Testnet (Tx: 4t1mhziPh8...)
NEP-171 Token MintingVERIFIED4 agents minted on-chain with bound sub-account derivations
Time-Locked Rental SLAVERIFIEDActive rental executed for agent-oracle-03 (Tx: G53dRkSKUe...)
Proxy Action ExecutionVERIFIEDDelegated execution via execute_as_agent (Tx: DsBWx5CN36...)
NEP-178 Transfer FreezeVERIFIEDContract panics on transfer during active lease (Proof in Security Notes)
Autonomous Daemon SettlementVERIFIEDOn-chain settlement with SHA-256 proof (Tx: 6jyYAgnCqp...)
Dynamic ProgressionVERIFIEDtasks_completed & reputation_score increment on live chain
Mock / Dummy Code AuditZERO0 mocks, 0 dummy data, 0 fake delay timeouts across the entire codebase

Every value in Cryptographic Proof Matrix is real, queryable on NEAR Testnet RPC, and reproducible using the CLI commands detailed below.

What Is Implemented

  1. NEP-171 Token-Bound Smart Accounts: Every agent NFT is bound to an exclusive hierarchical NEAR sub-account (<token_id>.<contract_id>). The RAGA smart contract serves as the sole authority parent, ensuring that no private key can rogue-control the agent's sub-account directly.
  2. Time-Locked Rental SLA (Block-Timestamp Enforced): Users lease agent workers by depositing NEAR calculated against a per-second rate (rental_rate_per_sec). The contract records the renter's identity and expiration nanoseconds timestamp (expires_at), granting exclusive operator authority.
  3. NEP-178 Transfer & Burn Freeze Invariant: When an agent token is under an active rental, nft_transfer, nft_transfer_call, and token burning are strictly prohibited by on-chain invariant assertions. Neither the token owner nor malicious actors can revoke access or liquidate the agent during the renter's lease.
  4. Delegated Cross-Contract Proxy Execution (execute_as_agent): While a rental is active, only the authorized operator (the renter) can dispatch calls through the agent. The smart contract validates operator credentials and forwards calls with specified deposit and gas to arbitrary target contracts on NEAR.
  5. Dynamic NFT Telemetry & Reputation Progression: Each completed execution automatically increments tasks_completed on-chain and updates the agent's reputation_score (100–1000). RAGA tokens are living, evolving assets whose market value reflects verifiable on-chain productivity.
  6. Streaming Revenue & Owner Claim Pool: 100% of rental fees route directly to the token owner's unclaimed_revenue pool. Owners can withdraw accumulated streaming yield on-demand using claim_agent_revenue or execute batch claims across their entire fleet.
  7. Autonomous Worker Daemon with SHA-256 Proofs: An off-chain autonomous execution engine (worker-daemon) that continuously polls telemetry, generates cryptographically signed task workloads, computes SHA-256 state proofs, and settles on-chain via complete_agent_task.
  8. Cryptographic Auditor & Industrial Web Interface: A production-grade Next.js dApp featuring an Industrial Cobalt Blueprint aesthetic (0-radius borders, Azeret Mono CLI commands, Big Shoulders Display metrics), role switcher (Owner, Renter, Operator, Judge), live RPC query pipeline, and an interactive Zero-Trust Cryptographic Auditor.

Quick Start

Prerequisites

  • Node.js: v20.x or v22.x (Verified on v24.18.0)
  • Rust: 1.79+ with wasm32-unknown-unknown target
  • near-cli: npm install -g near-cli (optional for CLI verification)
  • Git

1. Clone & Install Dependencies

bash
git clone https://github.com/your-username/raga-nearhack.git
cd raga-nearhack

# Install frontend dependencies
cd app && npm install && cd ..

# Install worker-daemon dependencies
cd worker-daemon && npm install && cd ..

2. Run Rust Contract Unit Tests

bash
cargo test --manifest-path contracts/Cargo.toml

Expected Output:

text
running 4 tests
test tests::test_mint_and_subaccount_binding ... ok
test tests::test_rental_flow_and_lock ... ok
test tests::test_revenue_accumulation_and_claim ... ok
test tests::test_rental_expiration_and_delegation ... ok

test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.46s

3. Run Autonomous Worker Daemon Verification (Live Testnet Settlement)

bash
npm run demo

Expected Output:

text
[RAGA DAEMON] Initializing Autonomous AI Worker Daemon...
  Network:     testnet
  RPC Node:    https://near-testnet.drpc.org
  Contract:    raga-protocol-mw93m309.testnet
  Token ID:    agent-oracle-03
[RAGA DAEMON] Live signer initialized for account: raga-renter-mw94dqty.testnet
[RAGA DAEMON] Running single-cycle verification demo...

========================================================
[RAGA DAEMON] INITIATING AUTONOMOUS WORKER EXECUTION CYCLE
========================================================
[IDENTITY] Token ID:          agent-oracle-03
[IDENTITY] Bound Sub-Account:  agent-oracle-03.raga-protocol-mw93m309.testnet
[IDENTITY] Capability:         Chronos Validator
[IDENTITY] Status:             Rented
[IDENTITY] Owner:              raga-protocol-mw93m309.testnet
[IDENTITY] Effective Operator: raga-renter-mw94dqty.testnet (Active Renter)

[TASK] Dispatched Workload:    SECURITY_AUDIT_PROBE
[TASK] Workload ID:            task-mwee2wdl-3umbb
[TASK] Target Destination:     dex-pool.ref-finance.testnet
[PROOF] Computed SHA-256:      0x9dd62c46f63cc2c967ed0b34debfb42f8e9d75586adfa65dcc661f0a780f495a
[NEAR RPC] Dispatched complete_agent_task on contract raga-protocol-mw93m309.testnet...
[NEAR RPC] Transaction Confirmed on NEAR Blockchain! Tx: 6jyYAgnCqpPri5dMRQ89E2Tirz2VcrS6htGbhNtRj8vY

--------------------------------------------------------
[TELEMETRY] Cycle Success!
  Tasks Completed:      2 (+1)
  Reputation Score:     125/1000 (+15)
  Cycle Yield Earned:   0.0250 NEAR
  Authorized Operator:  raga-renter-mw94dqty.testnet
--------------------------------------------------------

4. Launch the Web Interface

bash
npm run dev --prefix app

Open http://localhost:3000 in your browser. All tabs interact directly with https://near-testnet.drpc.org without mock relays or dummy timeouts.

Environment Variables

Worker Daemon (worker-daemon/.env)

VariableRequiredDefault / Testnet ValuePurpose
NEAR_NETWORKYestestnetTarget NEAR blockchain environment
NEAR_NODE_URLYeshttps://near-testnet.drpc.orgPublic high-availability JSON-RPC endpoint
RAGA_CONTRACT_IDYesraga-protocol-mw93m309.testnetDeployed RAGA smart contract
RAGA_TOKEN_IDYesagent-oracle-03Target agent token for autonomous execution
NEAR_ACCOUNT_IDYesraga-renter-mw94dqty.testnetAuthorized operator account signing tasks
NEAR_PRIVATE_KEYYesed25519:...Ed25519 signer key for task settlement

Next.js Application (app/.env.local / Default Config)

VariableRequiredDefault / Testnet ValuePurpose
NEXT_PUBLIC_NEAR_NETWORKYestestnetNetwork identifier for near-api-js
NEXT_PUBLIC_CONTRACT_IDYesraga-protocol-mw93m309.testnetTarget smart contract identifier
NEXT_PUBLIC_RPC_URLYeshttps://near-testnet.drpc.orgPrimary client-side RPC provider
NEXT_PUBLIC_RPC_FALLBACKNohttps://rpc.testnet.near.orgFallback RPC provider for high availability

Economic & Monetization Model

RAGA introduces a sustainable dual-yield dynamic for decentralized autonomous labor:

CODE
[ Renter / Tenant ]
       │
       │ Pays (Hourly Rate × Duration) in NEAR
       ▼
┌──────────────────────────────────────────────┐
│  RAGA Smart Contract Escrow                  │
│  - Locks rental fee in escrow pool           │
│  - Enforces per-second streaming rate        │
│  - Freezes NFT transfer / burn (NEP-178)     │
└──────────────────────┬───────────────────────┘
                       │
                       │ 100% of Lease Revenue Stream
                       ▼
       ┌───────────────────────────────┐
       │ Token Owner Unclaimed Pool    │
       │ (Withdrawable on demand via   │
       │  claim_agent_revenue)         │
       └───────────────────────────────┘
  1. Per-Second Streaming Rate (rental_rate_per_sec): Rates are parameterized in yoctoNEAR per second. For example, an hourly rental rate of 0.85 NEAR converts to: $$\text{Rate Per Sec} = \frac{0.85 \times 10^{24}}{3600} \approx 2.3611 \times 10^{20} \text{ yoctoNEAR/sec}$$
  2. Non-Custodial Fee Accrual: Upon calling rent_agent, the deposited NEAR is immediately credited to the token's unclaimed_revenue pool. The token owner can withdraw this yield at any moment via claim_agent_revenue, completely separate from the tenant's ongoing execution period.
  3. Productive Task Yields: As autonomous workers execute tasks via execute_as_agent or off-chain daemons, rewards generated from target contracts (DEX rebalancing, oracle attestation fees) are credited to the agent's lifetime accumulated metrics, directly increasing the token's valuation on secondary markets.

Architecture

System Architecture

txt
+---------------------------------------------------------------------------------------+
|                                    CLIENT LAYER                                       |
|   Next.js 14 (App Router)   *   0-Radius Industrial UI   *   near-api-js Direct Signer   |
+---------------------------------------------------------------------------------------+
                                           |
                                           v
+---------------------------------------------------------------------------------------+
|                               APPLICATION & RPC LAYER                                 |
|   - RPC Gateway (/api/rpc with multi-node automatic fallback & exponential backoff)   |
|   - Cryptographic Proof Engine (Browser WebCrypto SHA-256 digest computation)          |
|   - Identity Role Switcher (Owner, Renter, Worker Operator, Hackathon Auditor)       |
+---------------------------------------------------------------------------------------+
           |                                                      |
           v                                                      v
+---------------------------------------+       +---------------------------------------+
|         OFF-CHAIN WORKER DAEMON       |       |        NEAR PROTOCOL TESTNET          |
|       (worker-daemon/src/worker.ts)   |       |    (raga-protocol-mw93m309.testnet)   |
|---------------------------------------|       |---------------------------------------|
| - Polling Telemetry via JSON-RPC      |       | - NEP-171 Core NFT & Sub-Account Map  |
| - Generates Real Cryptographic Proofs |       | - NEP-177 Metadata Standard           |
| - Auto-Dispatches complete_agent_task |       | - NEP-178 Approval & Transfer Freeze  |
| - Ed25519 Testnet Key Signing         |       | - NEP-181 Enumeration Standard        |
+---------------------------------------+       +---------------------------------------+
                                                                  |
                                                                  v
                                                +---------------------------------------+
                                                |     TOKEN-BOUND SUB-ACCOUNT REALM     |
                                                |  <token_id>.raga-protocol-mw93m309.   |
                                                |                 testnet               |
                                                |---------------------------------------|
                                                | - Sole Authority Parent Contract      |
                                                | - Zero Human FullAccess Key Exposure  |
                                                | - Gated Proxy Execution Pipeline      |
                                                +---------------------------------------+

Agent Lifecycle & Rental State Machine

txt
========================================================================================
                         RAGA AGENT LIFECYCLE & STATE TRANSITIONS
========================================================================================

  01. MINT & SUB-ACCOUNT DERIVATION
  [Owner] --> Calls mint_agent(token_id, name, capability, rental_rate_per_sec)
          --> Contract binds sub-account: `<token_id>.<contract_id>`
          --> Initial State: Status = "Available", Operator = Owner, Reputation = 100
                                           |
                                           v
  02. TIME-LOCKED LEASE (RENTAL)
  [Renter]--> Attaches deposit = (duration_sec * rental_rate_per_sec)
          --> Calls rent_agent(token_id, duration_sec)
          --> Contract mutates:
              * is_rented = true
              * effective_operator = Renter Account ID
              * rental_expires_at = Block Timestamp + duration_sec
              * unclaimed_revenue += deposit
                                           |
                                           v
  03. INVARIANT PROTECTION & EXECUTION
  [Contract]--> NEP-178 Freeze Active: Any nft_transfer/burn REVERTS with panic
  [Renter]  --> Calls execute_as_agent(token_id, target_contract, method, args, deposit, gas)
            --> Contract confirms caller == effective_operator
            --> Dispatches cross-contract call as parent authority
            --> Dynamic Progression: tasks_completed += 1, reputation_score += 10
                                           |
                                           v
  04. EXPIRATION & REVENUE CLAIM
  [Owner]   --> Calls claim_agent_revenue(token_id) => Withdraws accumulated yoctoNEAR
  [Time]    --> When block_timestamp > rental_expires_at:
              * is_rented evaluates to false
              * effective_operator reverts to Owner
              * NEP-178 Transfer Lock releases automatically
========================================================================================

Codebase Organization

txt
raga-nearhack/
├── contracts/                       # NEAR Rust Smart Contract (near-sdk 5.30.1)
│   ├── Cargo.toml                   # Manifest with near-sdk, near-contract-standards, borsh
│   └── src/
│       ├── lib.rs                   # Contract state, LookupMaps, constructor & unit tests
│       ├── token_bound.rs           # Token-bound sub-account controller, proxy & rental engine
│       └── nft_core.rs              # Official NEP-171, NEP-177, NEP-178, NEP-181 implementation
├── worker-daemon/                   # Off-Chain Autonomous Worker Daemon
│   ├── tsconfig.json                # Strict TypeScript configuration
│   ├── package.json                 # Node dependencies (near-api-js v7.4.0)
│   ├── .env                         # Live testnet signer credentials & contract targets
│   └── src/
│       └── worker.ts                # Autonomous task generator, SHA-256 proof creator & RPC caller
├── app/                             # Next.js 14 App Router Web Application
│   ├── src/
│   │   ├── app/
│   │   │   ├── layout.tsx           # Global layout with font providers
│   │   │   ├── page.tsx             # Root entry orchestrating FoundryWorkspace
│   │   │   ├── docs/                # Comprehensive in-app documentation portal
│   │   │   └── api/rpc/route.ts     # Resilient RPC proxy with failover routing
│   │   ├── components/
│   │   │   ├── FoundryWorkspace.tsx # Central workspace state & modal coordinator
│   │   │   ├── Navbar.tsx           # Telemetry header with identity role switcher
│   │   │   ├── RentModal.tsx        # Async testnet rental confirmation modal
│   │   │   ├── ExecuteActionModal.tsx # Async sub-account proxy execution modal
│   │   │   ├── MintAgentModal.tsx   # Direct agent minting modal
│   │   │   ├── TransferModal.tsx    # NEP-178 enforced transfer modal
│   │   │   ├── landing/             # 8 modular subcomponents under 100 lines each
│   │   │   ├── mint-studio/         # 7 wizard step & cartridge preview subcomponents
│   │   │   ├── auditor/             # 5 zero-trust security & JSON inspection subcomponents
│   │   │   └── views/               # Marketplace, FleetVault, Dispatch, Auditor, Docs views
│   │   ├── infrastructure/
│   │   │   ├── repositories/        # Production on-chain broadcaster (callFunctionRaw + SHA-256)
│   │   │   └── rpc/                 # near-api-js signers and view providers
│   │   └── domain/models/           # Strict TypeScript models (AgentNFT, TaskExecutionRecord)
├── docs/                            # Deep-dive architecture and integration documentation
│   ├── ARCHITECTURE.md              # Formal technical architecture & standard specs
│   ├── IMPLEMENTATION.md            # Zero-trust invariant design & state machine
│   ├── INTEGRATIONS.md              # External contract interactions (Ref Finance, wrap.testnet)
│   └── DEPLOY.md                    # Production deployment & mainnet migration guide
├── LICENSE                          # MIT Open Source License
└── README.md                        # Master documentation & AI evaluation guide

Smart Contract State Model & Invariants

Defined in contracts/src/lib.rs and contracts/src/token_bound.rs:

rust
#[near(contract_state)]
#[derive(PanicOnDefault)]
pub struct RagaTokenBound {
    pub owner_id: AccountId,
    pub metadata: LazyOption<NFTContractMetadata>,
    pub tokens: near_sdk::store::LookupMap<TokenId, RagaAgentMetadata>,
    pub rentals: near_sdk::store::LookupMap<TokenId, ActiveRental>,
    pub token_list: near_sdk::store::Vector<TokenId>,
    pub tokens_per_owner: near_sdk::store::LookupMap<AccountId, Vec<TokenId>>,
}

#[near(serializers = [borsh, json])]
pub struct ActiveRental {
    pub renter_id: AccountId,
    pub expires_at: u64, // Nanoseconds timestamp
}

#[near(serializers = [borsh, json])]
pub struct RagaAgentMetadata {
    pub token_id: TokenId,
    pub owner_id: AccountId,
    pub name: String,
    pub capability: String,
    pub bound_subaccount: AccountId,
    pub created_at: u64,
    pub rental_rate_per_sec: U128,
    pub total_revenue_accumulated: U128,
    pub unclaimed_revenue: U128,
    pub tasks_completed: u64,
    pub reputation_score: u32,
    pub current_status: String,
    pub metadata: Option<TokenMetadata>,
    pub approvals: HashMap<AccountId, u64>,
    pub next_approval_id: u64,
}

Invariants Enforced by Rust Code

  1. Sub-Account Exclusivity: bound_subaccount is calculated deterministically as format "{}.{}", token_id, env::current_account_id(). Only the contract can invoke calls on behalf of this sub-account.
  2. Transfer Prohibition Under Active Rental: In nft_core.rs: ``rust if self.is_active_rental(&token_id) { env::panic_str(&format!( "Transfer forbidden: token {} is locked under active rental to {} until timestamp {} ns", token_id, rental.renter_id, rental.expires_at )); } ``
  3. Execution Delegation Exclusivity: In token_bound.rs: ``rust let effective_operator = self.get_effective_operator(&token_id); if caller != effective_operator { env::panic_str("Unauthorized: caller is neither owner nor active renter"); } ``

Routes & Views Matrix

Route / ViewPath / ModePurpose & Capabilities
Landing Page/Protocol overview, live telemetry strip, feature matrix, architecture blueprint, ecosystem showcases
dApp Workspace/appCentral multi-view orchestrator with top status bar, telemetry feeds, and identity role switcher
1. Marketplace/app?tab=marketplaceLive on-chain agent tokens fetched via RPC (nft_tokens), capability filtering, and 1-click lease modal
2. Fleet Vault/app?tab=vaultOwner portfolio management console, unclaimed streaming yield metrics, and batch revenue claim
3. Dispatch Console/app?tab=dispatchRenter mission control, custom contract proxy caller (execute_as_agent), and SHA-256 receipt logger
4. Mint Studio/app?tab=mint4-step interactive wizard (Identity, Skills, Sub-Account Derivation, Stake) broadcasting testnet mints
5. Auditor Lab/app?tab=auditorZero-Trust cryptographic inspector, formal key sandboxing table, and live JSON/Borsh RPC query inspector
6. Agent Docs/app?tab=docsIn-app machine-readable CLI guide with 1-click command execution templates
Docs Hub/docs, /docs/[slug]Static and dynamic documentation pages rendered directly from markdown specifications
RPC Gateway/api/rpcHigh-availability server-side RPC proxy with automatic node rotation and timeout guards

Deterministic "Do X — See Y" Evaluation Steps

For hackathon evaluators, judges, and automated verification agents (Claude Code / Codex):

Step 1: Query Live Agent State on NEAR Testnet

  • Do X: ``bash npx near-cli view raga-protocol-mw93m309.testnet get_agent '{"token_id": "agent-oracle-03"}' ``
  • See Y: ``json { "token_id": "agent-oracle-03", "owner_id": "raga-protocol-mw93m309.testnet", "name": "Chronos Oracle-03", "capability": "Chronos Validator", "bound_subaccount": "agent-oracle-03.raga-protocol-mw93m309.testnet", "is_rented": true, "effective_operator": "raga-renter-mw94dqty.testnet", "current_status": "Rented" } ``

Step 2: Rent an Agent Token on Testnet

  • Do X: ``bash npx near-cli call raga-protocol-mw93m309.testnet rent_agent '{"token_id": "agent-oracle-03", "duration_sec": 3600}' --accountId raga-renter-mw94dqty.testnet --amount 0.85 ``
  • See Y: ``json EVENT_JSON:{"standard":"raga","version":"1.0.0","event":"agent_rented","data":[{"token_id":"agent-oracle-03","renter_id":"raga-renter-mw94dqty.testnet","duration_sec":3600}]} ``

Step 3: Verify NEP-178 Transfer Freeze Attack Invariant

  • Do X (Owner attempts to transfer or rugpull an agent while under active lease): ``bash npx near-cli call raga-protocol-mw93m309.testnet nft_transfer '{"receiver_id": "raga-operator-mw94dqty.testnet", "token_id": "agent-oracle-03"}' --accountId raga-protocol-mw93m309.testnet --depositYocto 1 ``
  • See Y (Transaction Reverts with On-Chain Smart Contract Panic): ``text Smart contract panicked: Transfer forbidden: token agent-oracle-03 is locked under active rental to raga-renter-mw94dqty.testnet until timestamp 1794540202652447390 ns ``

Step 4: Execute Cross-Contract Proxy Call via Bound Sub-Account

  • Do X: ``bash npx near-cli call raga-protocol-mw93m309.testnet execute_as_agent '{"token_id": "agent-oracle-03", "target_account_id": "raga-protocol-mw93m309.testnet", "method_name": "get_contract_owner", "args": [], "deposit": "0", "gas": 10000000000000}' --accountId raga-renter-mw94dqty.testnet --gas 60000000000000 ``
  • See Y: ``json "raga-protocol-mw93m309.testnet" ` *(Dynamic NFT updates: tasks_completed` increments on-chain, reputation score increases).*

Step 5: Claim Accumulated Rental Revenue

  • Do X: ``bash npx near-cli call raga-protocol-mw93m309.testnet claim_agent_revenue '{"token_id": "agent-oracle-03"}' --accountId raga-protocol-mw93m309.testnet ``
  • See Y: ``json EVENT_JSON:{"standard":"raga","version":"1.0.0","event":"agent_revenue_claimed","data":[{"token_id":"agent-oracle-03","recipient":"raga-protocol-mw93m309.testnet"}]} ``

Cryptographic Proof Matrix (Live NEAR Testnet)

Every value below is captured from live transactions on NEAR Testnet. No simulated or estimated values.

Operation / EventAccount / ActorTarget TokenTransaction Hash on NEAR TestnetOutcome / State Result
Contract DeploymentProtocol Deployerraga-protocol-mw93m309.testnet4t1mhziPh8ah3WQRFeT2Ldz2Y3fLdNfHWJ3jm6dkAFZoCode deployed (WASM binary)
Contract Init (new)Protocol DeployerContract InstanceFxDs3ufv47pVHzaBCb1CcXgrpLZCBkVjRgoKT4fbTYe9Initialized metadata & owner
Mint Agent 01Contract Owneragent-sentinel-01HhVM2HDrzLx4s7ytwqb5rnt9tJERyLuGix1J4uTwYph8Bound subaccount created
Mint Agent 02Contract Owneragent-yield-02G2cQFii3gH8N5dReGDXUNfbiAZmyizmwQHVEb3B2TDEfBound subaccount created
Mint Agent 03Contract Owneragent-oracle-036kfKkqNoGAHCVReD1eYrmgUNnHMqM8Ra8CimXHQDmw9nBound subaccount created
Mint Agent 04Contract Owneragent-nexus-043Yn1ummno2t79kFLKGvCjgRDT5uFAUZK5GPc9H6jgNzGBound subaccount created
Active Rental LeaseRenter Accountagent-oracle-03G53dRkSKUeAUrsUz4mYRt4sWXmBwV16pyfeDax6ySkwyTime-locked for 3600 seconds
Proxy ExecutionRenter Accountagent-oracle-03DsBWx5CN36nGUKRWddkNdibSPWoCYEhfhyD2ED6gUB8sTasks: 1, Reputation: 110
Transfer Lock RejectionContract Owneragent-oracle-03On-Chain RevertSmart contract panic: Transfer forbidden
Autonomous SettlementRenter / Operatoragent-oracle-036jyYAgnCqpPri5dMRQ89E2Tirz2VcrS6htGbhNtRj8vYTasks: 2, Reputation: 125

Security Notes & Threat Model

  1. Non-Custodial Sub-Account Isolation: In conventional systems, delegating autonomous AI execution requires provisioning a private key. RAGA eliminates this vulnerability: the smart contract is the sole entity permitted to dispatch transactions for <token_id>.<contract_id>. No human holds a FullAccess key.
  2. NEP-178 Re-entrancy & Front-Running Immunity: Time-locks are indexed directly on block timestamps (env::block_timestamp()), rendering them immune to client-side clock tampering or front-running cancelations.
  3. Escrow Yield Isolation: All rental deposits are quarantined in the token's unclaimed yield state. A compromised operator cannot drain or alter another agent's balance.
  4. Resilient RPC Architecture: The frontend integrates an automatic fallback mechanism: if an RPC query fails or times out, it switches instantly between DRPC (near-testnet.drpc.org) and NEAR Official (rpc.testnet.near.org) with exponential backoff.

Hackathon Submission & Track Alignment

Primary Track: nfts — NFTs That Do Something

  • Track Hint: *Build NFTs as accounts — assets that own money, earn royalties, hold inventory, carry credentials, memberships or access rights. Ownership with behavior. DYNAMIC NFTS, NEP-171, SUB-ACCOUNTS.*
  • RAGA Implementation: Transforms NEP-171 NFTs into active token-bound accounts with hierarchical sub-account authority, dynamic reputation scoring, streaming revenue accrual, and time-locked rental SLA guarantees.

Secondary Tracks: agents & security

  • agents: Autonomous AI workers earning and settling value on NEAR.
  • security: Sandboxed execution delegation without private key exposure; NEP-178 transfer lock guarantees against owner rugpulls during active leases.

License

This project is licensed under the MIT License — see the LICENSE file for details.