> For the complete documentation index, see [llms.txt](https://rubaru-labs.gitbook.io/rubaru-whitepaper/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://rubaru-labs.gitbook.io/rubaru-whitepaper/rubaru-why-and-what/technical-architecture-and-breakthroughs/on-chain-referral-service.md).

# On-Chain Referral Service

RuBaRu's **Refer-2-Earn** incentive model, part of the **Creator-Consumer Incentive Program (CCIP),** is designed as a **fully on-chain, event-driven, auto-scalable referral service** to efficiently track and reward user-driven growth. The system follows a **modular, distributed architecture** ensuring **scalability, decentralization, and real-time processing.**

#### **High-Level Architecture:**

1. **Mother Registry Canister (Orchestrator)**
   * The central coordinator managing referral tracking and reward computation & distribution.
   * Maintains a ledger of referral relationships and dynamically provisions **Data Satellite Canisters** based on user demand.
2. **Data Satellite Canisters (Sharded Storage & Processing)**
   * Distributed storage and computation layer handling referral tracking at scale.
   * Ensures load balancing by **sharding data** across multiple canisters to support high throughput.
3. **On-Chain Referral Code System**
   * Generates **unique, immutable referral codes** directly on-chain.
   * Integrated into the **user signup flow** to link referral relationships.
4. **Event-Driven Reward Computation & Distribution**
   * **Referral rewards are dynamically computed based on SignUp and Claim referral reward events**.
   * Message events are generated in response to user Signup using referral code, which then trigger automatic reward distribution.
   * Directly integrated with **Wallet Service** for **real-time, on-chain ledger updates.**
5. **User Service & Wallet Service Integration**
   * Provides **instant access to referral earnings, transaction history, and leaderboard rankings.**
   * Users can transparently track referral activity and rewards.

By leveraging an **event-based, auto-scalable microservices architecture**, the **on-chain referral service ensures efficient tracking, seamless reward distribution, and scalable user onboarding.** The system dynamically scales with user demand, providing **high reliability, decentralization, and an optimal user experience.**

<figure><img src="/files/dkbe9T3kWJPtFyDWb7ys" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://rubaru-labs.gitbook.io/rubaru-whitepaper/rubaru-why-and-what/technical-architecture-and-breakthroughs/on-chain-referral-service.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
