How togettoyou/fabric-realty works
Project Overview
• This is a blockchain-based full-stack application designed for real estate registration and trading. It leverages Hyperledger Fabric to provide a distributed ledger system where three organizations (the Realty Agency, the Trading Platform, and the Bank) operate in a consortium network.
• The application has distinct layers: a blockchain network (with chaincode for business logic), a backend RESTful API server written in Go (using Gin) that interfaces with the blockchain, and a Vue-based frontend for user interaction.
Main Components
a. Blockchain / Network Layer:
• Hyperledger Fabric Network:
• Three organizations (identified as Org1: Realty Agency, Org2: Bank, and Org3: Trading Platform) each with their own set of peer nodes (e.g., peer0, peer1).
• Configuration files (from the network folder) which include crypto materials, configtx.yaml, docker-compose files, etc.
• Smart Contract (Chaincode) Layer:
• The chaincode component found in the “chaincode” directory. It encapsulates core functions for managing property and transaction data (e.g., property creation, transaction completion, queries).
b. Application Server (Backend) Layer:
• REST API server implemented in Go using Gin.
• API routing structure includes endpoints for:
• Realty Agency: create and query realty information.
• Trading Platform: initiate and query transactions.
• Bank: complete transactions and lookup details.
• This layer also integrates with Hyperledger Fabric via the fabric-gateway from the “pkg/fabric” code.
• The configuration management files (in “config”) support environment-specific settings (including Docker-based configurations).
• Docker-related files indicate container-based deployment.
c. Frontend (Web) Layer:
• Built using Vue.js with supporting TypeScript configuration.
• Provides independent user interfaces for each organization.
• Interacts with the backend API for operations such as realty creation, transaction initiation, and transaction completion.
• Files in “application/web” include configuration (Dockerfile, package.json, vite config) and the source code for views such as Bank.vue, RealtyAgency.vue, and TradingPlatform.vue.
d. Supporting Deployment & Configuration:
• Docker Compose files in both “application” and “network” directories serve to orchestrate multi-container deployments.
• Shell scripts (install.sh and uninstall.sh) for one-click deployment and teardown.
Relationships and Data Flow
• Backend’s internal call stack:
• API endpoint → internal service (e.g., bank_service, realty_agency_service, trading_platform_service) → fabric gateway calls → smart contract (chaincode) invocations.
• Demonstrate the blockchain network’s multi-organization structure and how each organization (with its peer nodes) interacts with the smart contract.
Architectural Patterns & Design Principles
• Clearly separate concerns: presentation (Vue frontend), application logic (Go REST API), and blockchain ledger (Hyperledger Fabric and chaincode).
• Use of microservice-style decomposition in the backend API (different service packages for the distinct business functions).
• Dependency injection and modular integration (with the fabric-gateway abstracting blockchain communication).
• Utilize Docker containers to encapsulate runtime environments, indicated by Dockerfiles and Docker Compose files.