# Proposed Solution Architecture for Valence
## Context Diagram
The context diagram provides a high-level view of the Valence system, its users, and its interactions with external systems.
```plantuml
title Valence - Context Diagram
!include <c4/C4_Context.puml>
actor "Business Users" as B2B
actor "Individual Users" as B2C
rectangle "Valence" {
(Chain Layer)
(Protocol Layer)
(Data Lake)
(Data Pipeline)
}
database "Polygon Blockchain" as Polygon
database "Data Repositories & Storage" as Storage
B2B --> Valence
B2C --> Valence
Valence --> Polygon
Valence --> Storage
```
## Components
### Users
The Valence system will serve two primary types of users:
**Business Users (B2B)**
Enterprises and organizations who are interested in classifying and labeling large data repositories and constructing a value attribution graph.
**Individual Users (B2C)**
Individuals from the global community who want to onboard their data in a trustless manner, allowing fine-grained access to their data.
**External Systems**
Valence interacts with the Polygon blockchain for its underlying infrastructure. It also interfaces with various data repositories and storage systems based on the user's preference.
Container Diagram
The container diagram gives a more detailed view of the Valence system, breaking it down into its major high-level components.
```plantuml
title Valence - Container Diagram
top to bottom direction
!include <c4/C4_Context.puml>
System_Boundary(sv, "Valence") {
System(cl, Chain Layer)
System(pl, Protocol Layer)
System(dl, Data Lake)
System(dp, Data Pipeline)
}
```
- Chain Layer: This is the backbone of the Valence blockchain and handles transactions, staking, and delegation operations.
- Protocol Layer: This layer handles specific use cases like creating data pools, data validation, and the implementation of the data curation system.
- Data Lake: This component is responsible for fetching, storing, and validating data. It interacts directly with both the Chain and Protocol Layers.
- Data Pipeline: This is an ELT (Extract, Load, Transform) pipeline that provides users with access to Valence's data. It pulls data from the Data Lake and transforms it based on user requirements.
## Component Diagram
The component diagram breaks down the containers into more granular components that perform specific functions.
```plantuml
title Valence - Component Diagram
!include <c4/C4_Context.puml>
'LAYOUT_WITH_LEGEND()
System_Boundary(x, "Chain Layer"){
System(tm, "Transaction Management", "Handles all transaction-related operations")
System(sd, "Staking and Delegation", "Manages staking and delegation of ALCA tokens.")
}
System_Boundary(spl, "Protocol Layer") {
System(dpc, Data Pool Creation, "Users can create their own pools")
System(dv, Data Validation, "Ensures both data integrity and validity")
System(fg, Funding and Governance, "Manages funding and proposal voting systems using ALCA tokens")
}
System_Boundary(sdl, "Data Lake") {
System(df, Data Fetching, "")
System(ds, Data Storage, "")
System(dv2, Data Validation, "")
}
System_Boundary(sdp, "Data Pipeline") {
System(de, Data Extraction, "")
System(dt, Data Transformation, "")
}
```
### Chain Layer Components:
- Transaction Management: Handles all transaction-related operations.
- Staking and Delegation: Manages the staking and delegation of ALCA tokens to secure the network.
### Protocol Layer Components:
- Data Pool Creation: Allows users to create their own data pools.
- Data Validation: Ensures the integrity and validity of the data.
- Funding and Governance: Manages the funding and proposal voting systems using ALCA tokens.
### Data Lake Components:
- Data Fetching: Retrieves data from various sources based on user preference.
- Data Storage: Stores the fetched data.
- Data Validation: Verifies the integrity of the stored data.
### Data Pipeline Components:
- Data Extraction: Pulls data from the Data Lake.
- Data Transformation: Transforms the extracted data based on user requirements.
## Conclusion
This proposed solution architecture aims to create a robust, efficient, and user-friendly system for both business and individual users. It outlines a comprehensive, yet flexible, architecture that can accommodate a wide range of data curation needs while ensuring seamless integration of the ALCA tokens within the Valence ecosystem.