VYGA Cross-Chain Aggregator Platform Documentation

Table of Contents

Introduction and Goals

VYGA is a cross-chain aggregator platform that pools leading and curated digital collectibles, digital art, Web3 gaming, and Metaverse projects. The primary goal is to provide an extended target group of "physical world" consumer brands with easy and convenient access to the "BEST OF WEB3." Additionally, it aims to facilitate product and project discovery in Web3 commerce.

MVP Goals

Executive Summary

VYGA is a cross-chain aggregator platform, pooling leading and curated digital collectibles, digital art, Web3 gaming, and Metaverse projects. The goal is to provide an extended target group of “physical world” consumer brands with easy and convenient access to the “BEST OF WEB3” and further to facilitate product/project discovery in Web3 commerce.

VYGA will aggregate and curate content from multiple networks, focusing on digital collectibles, digital art, Web3 gaming, and Metaverse projects. By leveraging AI-supported functionalities and automated processes, VYGA will provide up-to-date and curated content. The integration of advanced search capabilities, including prioritization of HBAR results, will enhance user experience and facilitate discovery in Web3 commerce. Integration with Hedera blockchain and Hashpack wallet will ensure secure transactions, while compliance with data privacy and financial transaction laws will be strictly maintained.

The MVP goals include aggregating selected content from different networks, enabling users to find content through a search function, and developing AI-supported functionalities to ensure updated content and start developing a VYGA-owned index score for curation.

Problem Statement Overview

VYGA aims to address several critical challenges in the Web3 space, including:

Networks Involved in Cross-Aggregation

VYGA will aggregate selected content and data across the following blockchain networks:

During the THA supported MVP development VYGA starts by aggregating content explicitly from the approved platforms: Hashaxis, Superrare, Rarible.

Functional and Non-Functional Requirements

Functional Requirements

Non-Functional Requirements

Quality Goals with Measurable Criteria

Key Features and Benefits

Project VYGA includes various features that make it a unique endeavor. Below an overview of most relevant features, all of which are to be implemented during the MVP. Future features have not been included in this overview. For more detailed information, including (1) grouping of features, (2) explicit target groups and (3) feature prioritization, please consult the VYGA - KEY FEATURE DOC.

Technical Aspects

Technologies to be Used

Project VYGA includes various technologies, all of which are listed below. For more detailed information, please consult the structured Architecture Decision Records (ADRs): VYGA - ADR DOC.

Backend Development

The backend will be developed using Flask, a micro web framework written in Python. Flask is lightweight and flexible, making it ideal for developing APIs and backend services.

The backend will expose RESTful APIs to interact with the frontend and other services. These APIs will handle user authentication, content aggregation, search functionalities, and AI-supported processes.

Python libraries like Pandas and NumPy will be used for data manipulation and analysis. TensorFlow or PyTorch will be utilized for developing and deploying AI models for content curation and search optimization.

Frontend Development

The frontend will be developed using React, which allows for the creation of dynamic and responsive user interfaces. The SPA will interact with the backend APIs to provide users with real-time content updates and search capabilities.

Database Management

MongoDB Atlas will be used for managing the database. MongoDB is a NoSQL database that provides high performance, high availability, and easy scalability.

All persistent data, including user information, content records, and billing details, will be stored in MongoDB. The database will be designed to handle large volumes of data efficiently.

AI Model Training and Deployment

AI models for content curation and search optimization will be developed using TensorFlow or PyTorch. These models will be trained on historical data and deployed on AWS for scalability and performance.

Containerization and Orchestration

All services will be containerized using Docker to ensure consistency across different environments. Docker allows for easy scaling and deployment of applications.

AWS Elastic Container Service will be used for orchestrating and managing Docker containers. ECS provides a scalable and secure way to run containerized applications in production.

AWS Elastic Container Registry will be used to store Docker images. ECR integrates seamlessly with ECS, allowing for smooth deployment workflows.

Security and Compliance

Monitoring and Logging

Architecture

System Context View

The System Context Diagram provides an overview of the VYGA platform, illustrating how it interacts with external systems and users. Actors: End User: Individuals or brands accessing the VYGA platform to discover and interact with curated Web3 content. Admin User: System administrators managing the platform's content and user roles. Third-Party Service Providers: Providers offering content, blockchain networks, and authentication services (OAuth 2.0, Hedera blockchain, Hashpack wallet). External Systems: Blockchain: Hedera blockchain for secure transactions. Blockchain Networks: Source of digital collectibles, digital art, Web3 gaming, and Metaverse projects. OAuth 2.0 Provider: External service for user authentication. External APIs: External APIs including payment providers.

Container Diagram

Figure 1: System Context Diagram of VYGA Platform

Container View

This container diagram shows the main components of the VYGA platform and their interactions:

Container Diagram

Figure 2: Container Diagram of VYGA Platform

VYGA System: Frontend (React SPA): The user interface through which end users and admins interact with the platform. Backend (Flask API): The core application logic that handles user authentication, content aggregation, and data processing. Database (MongoDB Atlas): Storage for all platform data, including user information, content, and transaction logs. AI Processing (TensorFlow/PyTorch): AI components that curate content and optimize search results. Search Engine (Elasticsearch): Facilitates advanced search and filtering capabilities. Monitoring and Logging (ELK Stack, Prometheus, Grafana): Tools for monitoring platform performance and logging system activities.

Component Diagrams

Component Diagram: Web Application

Component Diagram: Web Application

Figure 3: Component Diagram: Web Application This diagram describes the structure of the React-based frontend, detailing its key modules.

Component Diagram: API Server

Component Diagram: API Server

Figure 4: Component Diagram: API Server This diagram will focus on the components within the API Server, which is the core of the backend.

Component Diagram: Database

Sequence Diagram: Hedera Blockchain Integration

Figure 5: Component Diagram: DatabaseThis diagram illustrates the components involved in data storage, aggregation, and backup processes within the MongoDB-based database system.

Component Diagram: Logging & Monitoring

Component Diagram: Logging & Monitoring

Figure 6: Component Diagram: Logging & MonitoringThis diagram shows the components responsible for logging, monitoring, and alerting using the ELK Stack and associated services.

Component Diagram: Task Queue

Component Diagram: Task Queue

Figure 7: Component Diagram: Task QueueThis diagram details the tasks managed by the Celery task queue, focusing on how different background tasks are handled..

Component Diagram: Blockcahin Integration

Activity Diagram: Transaction Process

Figure 8: Component Diagram: Blockchain IntegrationThis diagram focuses on how the system integrates with the Hedera blockchain and Hashpack wallet for secure transactions.

Component Diagram: AI Processor

Component Diagram: AI Processor

Figure 9: Component Diagram: AI ProcessorThis diagram focuses on the components within the AI Processor, which handles the AI models for content curation and search optimization.

Component Diagram: Search Engines

Component Diagram: Search Engine

Figure 10: Component Diagram: Search EngineThis diagram represents the components involved in processing search queries, integrating with Elasticsearch, and prioritizing results using HBAR.

Deployment Diagram

Deployment Diagram

Figure 11: Deployment Diagram This diagram represents the deployment architecture of the VYGA system across three distinct environments: Development, Staging, and Production, all hosted on AWS. It illustrates how key AWS resources such as API Gateway, Elastic Load Balancers, ECS (Elastic Container Service) Clusters, RDS (Relational Database Service) instances, and Elasticsearch clusters are utilized and interact within each environment. Additionally, the diagram shows the flow of requests, data storage, and monitoring/logging operations using CloudWatch, ensuring clear visibility into the deployment and operational flow for each environment. These resources are scaled appropriately depending on the environment, with production being fully scaled for high availability and performance, while development and staging environments are configured with smaller, cost-effective resources.

UML Diagrams

Sequence Diagram: Secure User Authentication and Authorization

Sequence Diagram: Content Verification and Curation

Figure 12: Sequence Diagram: Secure User Authentication and Authorization This sequence diagram describes the process of user authentication using 2FA and OAuth 2.0.

Sequence Diagram:Content Aggregation

Sequence Diagram: AI Content Curation

Figure 13: Sequence Diagram: Content Aggregation This sequence diagram shows the process of aggregating content from various blockchain networks.

Sequence Diagram: Search & Filtering

Sequence Diagram: Hedera Blockchain Integration

Figure 14: Sequence Diagram: Search & FilteringThis sequence diagram describes the process of searching and filtering content, with prioritization of HBAR results.

Sequence Diagram: User Dashboard & Analytics

Activity Diagram: Hedera Blockchain Integration Process

Figure 15: Sequence Diagram: User Dashboard & AnalyticsThis sequence diagram covers the interactions that occur when a user accesses the dashboard and views real-time analytics.

Sequence Diagram: Robust API Integration

Sequence Diagram: Search Functionality with HBAR Prioritization

Figure 16: Sequence Diagram: Robust API IntegrationThis sequence diagram illustrates the process of API calls to third-party services, focusing on ensuring the interaction is seamless and meets performance requirements.

Activity Diagram: Transaction Process

Activity Diagram: Transaction Process

Figure 17: Activity Diagram: Transaction Process

Activity Diagram: AI Model Training and Deployment

Sequence Diagram: AI Model Training and Deployment

Figure 18: Activity Diagram: AI Model Training and Deployment

Activity Diagram: AI Model Training and Deployment Process

Activity Diagram: AI Model Training and Deployment Process

Figure 19: Activity Diagram: AI Model Training and Deployment Process

Activity Diagram: User Transaction with Hedera and Hashpack

Sequence Diagram: User Transaction with Hedera and Hashpack

Figure 20: Activity Diagram: User Transaction with Hedera and Hashpack

User Journey

The user journey describes the steps and experiences a user goes through while interacting with the VYGA platform. For detailed information, please refer to the User Journey Document.

MVP Code

1. Aggregate Selected Content from Different Networks

# content_aggregator.py
import requests
from pymongo import MongoClient

def aggregate_content():
    networks = ['network1', 'network2', 'network3']
    client = MongoClient('mongodb://localhost:27017/')
    db = client.vyga
    content_collection = db.content

    for network in networks:
        response = requests.get(f'http://api.{network}.com/content')
        if response.status_code == 200:
            content = response.json()
            content_collection.insert_many(content)

if __name__ == "__main__":
    aggregate_content()
            

2. Enable Users to Find Content (Search Function)

# search_service.py
from flask import Flask, request, jsonify
from elasticsearch import Elasticsearch

app = Flask(__name__)
es = Elasticsearch(['http://localhost:9200'])

@app.route('/search', methods=['GET'])
def search_content():
    query = request.args.get('q')
    response = es.search(
        index="content",
        body={
            "query": {
                "multi_match": {
                    "query": query,
                    "fields": ["title", "description", "tags"]
                }
            }
        }
    )
    return jsonify(response['hits']['hits'])

if __name__ == "__main__":
    app.run(debug=True)
            

3. Develop AI-Supported Functionalities

# ai_functions.py
import pandas as pd
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.cluster import KMeans

def update_content_model():
    client = MongoClient('mongodb://localhost:27017/')
    db = client.vyga
    content_collection = db.content
    content = list(content_collection.find())
    
    df = pd.DataFrame(content)
    vectorizer = TfidfVectorizer(stop_words='english')
    X = vectorizer.fit_transform(df['description'])

    model = KMeans(n_clusters=5, random_state=42)
    model.fit(X)

    df['cluster'] = model.labels_
    for index, row in df.iterrows():
        content_collection.update_one({'_id': row['_id']}, {'$set': {'cluster': row['cluster']}})

if __name__ == "__main__":
    update_content_model()
            

4. Integrate with Hedera Blockchain and Hashpack Wallet

# hedera_integration.py
from hedera import Hbar, AccountId, PrivateKey, Client
from hedera import Transaction, TransactionReceiptQuery

def create_hedera_transaction(amount, sender_account_id, receiver_account_id, private_key):
    client = Client.forTestnet()
    client.setOperator(AccountId.fromString(sender_account_id), PrivateKey.fromString(private_key))

    transaction = Transaction.newTransferTransaction()
    transaction.setSenderAccountId(AccountId.fromString(sender_account_id))
    transaction.setReceiverAccountId(AccountId.fromString(receiver_account_id))
    transaction.setAmount(Hbar(amount))
    transaction.freezeWith(client)
    transaction.signWith(PrivateKey.fromString(private_key))

    tx_id = transaction.execute(client)

    receipt = TransactionReceiptQuery(tx_id).execute(client)
    return receipt.status

if __name__ == "__main__":
    sender = "0.0.1234"
    receiver = "0.0.5678"
    private_key = "302e020100300506032b657004220420..."
    amount = 10
    status = create_hedera_transaction(amount, sender, receiver, private_key)
    print(f'Transaction status: {status}')
            

5. Train and Deploy AI Models on AWS

# ai_training.py
import boto3
import pandas as pd
import tensorflow as tf
from sklearn.model_selection import train_test_split

def train_model():
    # Load and preprocess data
    client = MongoClient('mongodb://localhost:27017/')
    db = client.vyga
    content_collection = db.content
    content = list(content_collection.find())
    df = pd.DataFrame(content)
    X_train, X_test, y_train, y_test = train_test_split(df['description'], df['label'], test_size=0.2, random_state=42)

    # Create and train model
    model = tf.keras.Sequential([
        tf.keras.layers.TextVectorization(input_shape=(1,), output_mode='tf-idf'),
        tf.keras.layers.Dense(64, activation='relu'),
        tf.keras.layers.Dense(5, activation='softmax')
    ])
    model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy'])
    model.fit(X_train, y_train, epochs=10, validation_data=(X_test, y_test))

    # Save and upload model to S3
    model.save('vyga_model.h5')
    s3 = boto3.client('s3')
    s3.upload_file('vyga_model.h5', 'vyga-models', 'vyga_model.h5')

if __name__ == "__main__":
    train_model()
            

6. Prioritize HBAR Results in Searches

# search_service.py (update)
@app.route('/search', methods=['GET'])
def search_content():
    query = request.args.get('q')
    response = es.search(
        index="content",
        body={
            "query": {
                "multi_match": {
                    "query": query,
                    "fields": ["title", "description", "tags"]
                }
            },
            "sort": [
                {"token": {"order": "desc", "missing": "_last"}}
            ]
        }
    )
    return jsonify(response['hits']['hits'])
            

7. Implement Rebranding Requirements for the User Interface (UI)

// App.js (React)
import React from 'react';
import './App.css';

function App() {
    return (
        <div className="App">
            <header className="App-header">
                <h1>Welcome to VYGA</h1>
            </header>
            <main>
                <p>Discover the best of Web3.</p>
                <button>Explore</button>
            </main>
        </div>
    );
}

export default App;
            

8. Ensure Compliance with Data Privacy Regulations and Financial Transaction Laws

# compliance_check.py
import requests

def check_gdpr_compliance(data):
    response = requests.post('https://gdpr-check-api.com/validate', json=data)
    return response.json()

def check_transaction_compliance(transaction):
    response = requests.post('https://transaction-check-api.com/validate', json=transaction)
    return response.json()

if __name__ == "__main__":
    user_data = {"name": "John Doe", "email": "john@example.com"}
    transaction_data = {"amount": 100, "currency": "USD"}

    gdpr_status = check_gdpr_compliance(user_data)
    transaction_status = check_transaction_compliance(transaction_data)

    print(f'GDPR Compliance: {gdpr_status}')
    print(f'Transaction Compliance: {transaction_status}')
            

Cross-Cutting Concepts

An overview of cross-cutting concepts of project VYGA including specific implementation strategies and tools can be found in following document: VYGA - CROSS-CUTTING CONCEPTS.

Risks and Technical Debt

Risks

Technical Debt

Scalability

The VYGA platform is designed to be scalable to handle increasing loads and a growing user base. Key scalability strategies include:

Interoperability

Ensuring interoperability across different systems and networks is crucial for the VYGA platform. Strategies for achieving interoperability include: