# ishagaikwad07/decentralized-real-estate architecture

> Architecture diagram of the GitHub repository ishagaikwad07/decentralized-real-estate, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ishagaikwad07/decentralized-real-estate
- Repository: https://github.com/ishagaikwad07/decentralized-real-estate

## Overview

##### Project type and purpose
- This is a single-contract Solidity project for managing the sale of a property on Ethereum.
- Purpose: allow a property owner to assign an agent, let a buyer purchase the property for exactly 11 ETH, automatically split payments (2 ETH to agent, 9 ETH to owner), and enable anyone to verify ownership.

##### File structure
- Only README.md is present, implying a single smart‐contract source file (not shown).
- No “frontend” or “backend” folders—interaction is done via an Ethereum wallet or IDE (e.g. Remix + MetaMask).
- No test suite or deployment scripts beyond typical Solidity instructions.

##### README for architecture clues
- Key functions:
- constructor (sets deployer as owner)
- assignAgent(address)
- buyHouse() payable
- getOwner() view
- Dependencies: Solidity ^0.8.0, Ethereum network, wallet (MetaMask).

##### Main components
- Property Owner (EOA deploying contract)
- Agent (EOA assigned by owner)
- Buyer (EOA calling buyHouse)
- Any Observer (calling getOwner)
- Nodes / Consensus
- Smart Contract bytecode & storage
- State variables: owner, agent, houseSold flag
- Functions: constructor, assignAgent, buyHouse, getOwner

##### Relationships and interactions
- Owner →[deploy]→ Smart Contract (constructor sets owner)
- Owner →[assignAgent(addr)]→ Smart Contract (writes agent)
- Buyer →[buyHouse() + 11 ETH]→ Smart Contract
- Contract →[2 ETH]→ Agent
- Contract →[9 ETH]→ Owner
- Contract updates owner := Buyer, houseSold := true
- Observer →[getOwner()]→ Smart Contract →[owner address]→ Observer

##### Architectural patterns & design principles
- Role-based access control (only owner can assign agent, agent cannot call buyHouse)
- On-chain automation of funds distribution
- Immutable transaction log (Ethereum ledger)
- Minimal external dependencies (no off-chain services)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External Documentation
    Documentation["Documentation"]:::docs
    click Documentation "https://github.com/ishagaikwad07/decentralized-real-estate/blob/main/README.md"

    %% External Actors
    subgraph "External Accounts"
        direction TB
        Owner["Property Owner (EOA)"]:::actor
        Agent["Agent (EOA)"]:::actor
        Buyer["Buyer (EOA)"]:::actor
        Observer["Observer (EOA)"]:::actor
    end

    %% Ethereum Network Layer
    subgraph "Ethereum Network" 
        direction TB
        Nodes["Nodes / Consensus"]:::network
        SmartContract["Smart Contract"]:::contract
        Storage[(State: owner, agent, houseSold)]:::storage
    end

    %% Hierarchy
    Nodes --> SmartContract
    SmartContract --> Storage

    %% Interactions
    Owner -->|"constructor() (deploy)"| SmartContract
    Owner -->|"assignAgent(addr)"| SmartContract
    Buyer -->|"buyHouse() + 11 ETH"| SmartContract
    SmartContract -->|"2 ETH payout"| Agent
    SmartContract -->|"9 ETH payout"| Owner
    Observer -.->|"getOwner() view"| SmartContract
    SmartContract -.->|"returns owner address"| Observer

    %% Styles
    classDef actor fill:#bbdefb,stroke:#0d47a1,stroke-width:2px
    classDef docs fill:#e0e0e0,stroke:#424242,stroke-width:2px,stroke-dasharray: 5 5
    classDef network fill:#eceff1,stroke:#607d8b,stroke-width:2px
    classDef contract fill:#ffe0b2,stroke:#e65100,stroke-width:2px
    classDef storage fill:#fff3e0,stroke:#e64a19,stroke-width:2px,stroke-dasharray: 2 2
```
