diff --git a/ROC_highlevel.png b/ROC_highlevel.png new file mode 100644 index 0000000000000000000000000000000000000000..4e91fb907d41f82e8eb3cdf0bf0f7a2e3e61b256 Binary files /dev/null and b/ROC_highlevel.png differ diff --git a/ROC_infrastructure.png b/ROC_infrastructure.png new file mode 100644 index 0000000000000000000000000000000000000000..f00bbb88986609d07571266f3949a380cd0c95f9 Binary files /dev/null and b/ROC_infrastructure.png differ diff --git a/Readme.md b/Readme.md index 3ee1ca4102a98c67dfa30bb5b2507087d3befe76..2862bd679436e203784583b6144343f1384e68bc 100644 --- a/Readme.md +++ b/Readme.md @@ -1,67 +1,99 @@ +# Roesticoin Infrastructure Documentation +## 1. Introduction -# Project Plan: Roesticoin - A Stablecoin on the Ethereum Blockchain +### Project Name +Roesticoin (ROC) +### Project Purpose +Roesticoin is a stablecoin implemented on the Ethereum blockchain. Its value is pegged to the price of potatoes in Swiss francs (CHF), aiming to provide a unique and innovative use case for blockchain-based currency. The project aspires to combine traditional agricultural economics with modern decentralized finance principles, making it both practical and educational. -## Getting all running -when switching between Devcontainer and production, rebuild the container, because the base image is different -### For development in Devcontainer -- open in VS Code -- add and modify `.env` file based on `.env.sample` -- reopen in container -### As release in Production -- add and modify `.env` file based on `.env.sample` -- `docker-compose -f docker-compose.yml -f docker-compose.release.yml up --build -d` +### Target Audience +This documentation is intended for Thomas Bocek, the blockchain module professor at OST - University of Applied Sciences, as well as team members or developers who worked on the project. +--- -## Project Title: -**Roesticoin: Swiss Franc-Pegged Stablecoin on Ethereum** +## 2. Architecture Overview +### Key Components +- **Grafana Dashboard**: Provides a visual representation and monitoring of key metrics related to the Roesticoin project. It enables the team to track real-time data and ensure system reliability. It also double serves as our frontend. +- **Roesticoin Service**: Manages core application functions such as minting, burning, liquidity, marketplace operations, and token interactions. This is the backbone of the project, ensuring the proper functionality. +- **Prometheus**: Integrated with Grafana for data collection and metric aggregation. Prometheus ensures reliable and scalable data monitoring. +### Key Technologies +- **Programming Languages**: C# (backend and application logic), Solidity (smart contract implementation on Ethereum). We chose C# because the developers on the team were already familiar with it. The reason we chose Ethereum (and thus Solidity) is because that's what we got introduced to in the Blockchain module. +- **Monitoring Tools**: Grafana (dashboard creation and visualization), Prometheus (data collection and alerting). We chose these two tools because David suggested these as he already has had good experiences with them in the past and nobody opposed his suggestion. +- **Database**: Postgresql (database), because that's what everyone was familiar with. +- **Containerization**: Docker (standardizes development and deployment processes). -## Team: -- Andri Joos +### High Level Infrastructure Diagram +<img src="ROC_highlevel.png"> -- David Hintermann +### Low Level Infrastructure Diagram +<img src="ROC_infrastructure.png"> -- Davor Lucic +--- +## 3. Infrastructure Details +### Environment Setup +We use two environments to facilitate development and deployment: +1. **Normal Environment**: A typical environment used for application deployment and testing in real-world scenarios. +2. **Devcontainer**: A standardized development environment configured using: + - A JSON configuration file that defines the settings and dependencies. + - A Docker Compose file to automate container setup and ensure uniformity across team members. This setup simplifies onboarding and minimizes discrepancies in development environments. -## Objective: -The goal of this project is to design and implement **Roesticoin**, a stablecoin pegged to the Swiss Franc +### Hosting +The Coin itself is deployed on the Ethereum blockchain. However, the rebalancing service we have is centralized. -(CHF) on the Ethereum blockchain. The coin will be implemented using **.NET technologies** for smart contract development and integration. The stablecoin will ensure stability through 1:1 collateralization with CHF and aim to serve as a reliable means of exchange. +### Monitoring Metrics +Metrics monitored through Grafana include: +- **Total Supply of Roesticoin**: Tracks the overall circulating supply of the token. +- **WETH/Roesticoin Price**: Monitors the token's exchange rate with Wrapped Ethereum (WETH). +- **Marketplace Potato Price (CHF and ETH)**: Reflects the price of potatoes in Swiss francs and its equivalent in Ethereum. +- **ETH Price in CHF**: Keeps track of the current Ethereum price in Swiss francs for accurate conversions. +- **Total Weight of Potatoes in Storage**: Provides an aggregated value of all stored potatoes, essential for accurate backing of the stablecoin. +These are just the most barebone metrics we wanted to implement, as these will give everyone a quick glance at the health of ROC. +--- -## Deliverables: -1. **Roesticoin Smart Contract**: An Ethereum-based ERC-20 token with functionality for minting, burning, and transferring tokens. -2. **Backend System**: A .NET-based system that integrates with the Ethereum blockchain to manage the issuance and redemption of Roesticoin, and interfaces with the Swiss Franc. -3. **Frontend Application**: A user-friendly interface for interacting with Roesticoin, allowing users to manage their tokens via a web-based dashboard. +## 4. Deployment Processes -<img src="overview.png"> +### Development Environment Setup +1. **Prerequisites**: Ensure Docker and the VS Code Dev Containers plugin are installed on your machine. +2. **Setup Process**: Open the project directory in VS Code. Use the Dev Containers feature to launch the development environment automatically. +3. **Run the Application**: Execute `Program.cs` using your development tools. This initializes the entire Roesticoin service, including core functionalities like monitoring and token operations. +4. **Standardization**: The devcontainer setup ensures that all developers work in a consistent environment, minimizing compatibility issues. -## Technologies: -- Blockchain: **Ethereum** -- Smart Contract Language: **Solidity** (with .NET interoperability) -- Backend: **.NET** - - **Nethereum** -- Frontend: **ASP.NET** for web development -- Testing: **Remix IDE**, **Nethereum** for Ethereum blockchain testing +--- +## 5. Tokenomics +### Minting and Burning Process +- **Minting**: Tokens are minted when the current supply of ROC is too low to push the current course. +- **Burning**: Burning works as the opposite of minting: when the supply of ROC is too high so the current course can't be pushed down enough, we burn ROC. +- These mechanisms follow established strategies used by other stablecoins, ensuring stability and reliability. -## Risk Management: -- **Blockchain Gas Fees**: Ensure the contract is optimized for gas efficiency. -- **Security Vulnerabilities**: Conduct smart contract audits and testing to prevent issues like reentrancy attacks. -- **Currency Peg Stability**: Implement mechanisms to monitor CHF collateral and ensure accurate pegging. +--- +## 6. Monitoring and External Dependencies +### Data Sources +- Roesticoin relies on the official potato price published by the Swiss government. This data is manually fetched from reliable government reports, as no API is available. -## Evaluation Criteria: -- Functionality of Roesticoin as a stablecoin pegged to CHF. -- Successful deployment on Ethereum with full integration in .NET. -- User interface and ease of interaction through the web dashboard. -- Security and efficiency of smart contract code. +--- +## 7. Security + +### Secure Processes +- The project adheres to standard blockchain security practices, ensuring the integrity and robustness of minting and burning operations. +- Smart contracts are thoroughly reviewed and tested to avoid vulnerabilities or exploits to the best of our abilities. +- Since the code base is on Andri Joos' own Gitlab server, access to the codebase is very restricted. + +--- + +## 8. Maintenance + +### Documentation Maintenance +- This will be the first and list time the documentation will be updated, since the projects is nearing its lifecycle.