# hyperledger/indy-besu architecture

> Architecture diagram of the GitHub repository hyperledger/indy-besu, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-02-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hyperledger/indy-besu
- Repository: https://github.com/hyperledger/indy-besu

## Overview

##### Project Type and Purpose
- The project is a blockchain-based distributed ledger system that aims to replace components of the Hyperledger Indy ecosystem, particularly for verifiable credentials. It integrates an EVM-compatible blockchain (via Besu) and supports multiple DID methods (e.g., indy, sov, and ethr).
- The project also includes smart contract suites, client libraries (written in Rust, with various wrappers), and scripts/configurations for deploying a permissioned blockchain network using Docker containers.

##### Analyzing the File Structure
- Top-level directories indicate clear separation of the system’s modules:
– The “network” directory contains configuration files, scripts, and infrastructure setup (using Docker Compose) for deploying and managing node clusters (including validator and RPC nodes), alongside monitoring tools (Grafana, Prometheus, Loki, Blockscout).
– The “smart_contracts” directory holds Solidity/TypeScript contracts that implement various registry and control functionalities (DID registries, anoncreds, etc.) plus related tests and scripts to manage genesis and deployments.
– The “vdr” directory is a Rust-based client library offering the API for connecting to the ledger, handling transactions and queries. It also includes Uniffi bindings (for cross-language integration) and a WASM component.
– Supplementary directories like “docs” (with design and migration documents) and “examples” (with illustrative migration processes) provide insights and instructions.
- The presence of .github workflows, Docker Compose file, and CI/CD configurations shows that there is robust management for integration, deployment, and quality assurance.

##### Architectural Components
a. Main Components:
– Distributed Ledger Network: Represent the blockchain network that is built on Besu, including validator nodes, RPC nodes, and node configurations (under the “network” folder).
– Client Library/API: Include the VDR module in Rust (and its different bindings like uniffi and WASM) which provide a client interface for interacting with the ledger.
– Infrastructure & DevOps: Show the Docker-compose orchestration, configuration management, and monitoring components (Grafana, Prometheus, Loki, Blockscout) as well as scripts for running, stopping, and removing containers.
– Migration and Integration: Note the “examples” and “docs/migration” areas that support transitioning data from the original Indy ledger to the new setup.

b. Relationships and Interactions:
– Data Flow: Illustrate how front-end and command line tools (if applicable when using the client library) interact with the VDR API, which in turn builds and sends transactions/queries to the blockchain network.
– Deployment Flow: Show that the network scripts and docker-compose orchestrate node startups, while configurations from the “network/config” directory feed into the node setup.
– Smart Contracts Deployment: Describe how the smart contract suite is compiled (with Hardhat, TS configuration files, etc.) and deployed onto the Besu chain, with transactions initiated via the client library.
– Integration Points: Emphasize how modules for identifiers (DID methods), credential registries, and endorsement mechanisms operate together.

c. Architectural Patterns and Design Principles:
– Modular Architecture: Components are clearly separated (network orchestration, smart contracts, client library) allowing independent development and testing.
– Client-Server Interaction: The VDR client library acts as a bridge between external applications and the distributed ledger.
– Microservice-Oriented Infrastructure: The network’s Docker orchestration (with services like blockscout, Prometheus, etc.) supports a microservices-like deployment.
– Extensibility & Upgradability: The design emphasizes the ease of integrating additional DID methods and new modules.

d. Relevant Technologies and Frameworks:
– Docker and Docker-compose for orchestration.
– Hyperledger Besu as the EVM-compatible blockchain.
– Solidity/TypeScript smart contracts managed via Hardhat.
– Rust for the VDR client library, with bindings for Uniffi and WASM.
– Monitoring tools such as Grafana, Prometheus, Loki, and Blockscout.

## Diagram (Mermaid)

```mermaid
graph TD

    subgraph "VDR Client Library/API"
        V1["VDR Client Library (Rust) with Uniffi & WASM"]
        V2["VDR Source"]
        V3["VDR Uniffi"]
        V4["VDR WASM"]
    end

    subgraph "Smart Contracts Layer"
        S1["Indy Besu Smart Contracts"]
        S2["Contracts"]
        S3["Contracts TS"]
    end

    subgraph "Distributed Ledger Network"
        L1["Besu Network"]
        L2["Network Config"]
        L3["Network Scripts"]
    end

    subgraph "Infrastructure & DevOps"
        I1["Docker Compose Setup"]
        I2["Network Infra"]
        I3["CI/CD Workflow"]
    end

    subgraph "Migration & Integration"
        M1["Docs Migration"]
        M2["Examples Migration"]
    end

    %% Connections
    V1 -->|"sendsTransactions"| L1
    S1 -->|"deployedViaHardhat"| L1
    V1 -->|"initiatesContractCalls"| S1

    I1 -->|"orchestrates"| L1
    I2 -->|"monitors"| L1

    M1 -->|"migratesData"| L1
    M2 -->|"migratesData"| L1

    %% Styles
    classDef vdr fill:#ffebcd,stroke:#333,stroke-width:2px;
    classDef contracts fill:#90ee90,stroke:#333,stroke-width:2px;
    classDef ledger fill:#add8e6,stroke:#333,stroke-width:2px;
    classDef infra fill:#ffcccb,stroke:#333,stroke-width:2px;
    classDef migration fill:#d3d3d3,stroke:#333,stroke-width:2px;

    class V1,V2,V3,V4 vdr;
    class S1,S2,S3 contracts;
    class L1,L2,L3 ledger;
    class I1,I2,I3 infra;
    class M1,M2 migration;

    %% Click Events for Distributed Ledger Network
    click L2 "https://github.com/hyperledger/indy-besu/tree/main/network/config"
    click L3 "https://github.com/hyperledger/indy-besu/tree/main/network/scripts/"

    %% Click Events for Smart Contracts Layer
    click S1 "https://github.com/hyperledger/indy-besu/tree/main/smart_contracts"
    click S2 "https://github.com/hyperledger/indy-besu/tree/main/smart_contracts/contracts"
    click S3 "https://github.com/hyperledger/indy-besu/tree/main/smart_contracts/contracts-ts"

    %% Click Events for VDR Client Library/API
    click V1 "https://github.com/hyperledger/indy-besu/tree/main/vdr"
    click V2 "https://github.com/hyperledger/indy-besu/tree/main/vdr/src"
    click V3 "https://github.com/hyperledger/indy-besu/tree/main/vdr/uniffi"
    click V4 "https://github.com/hyperledger/indy-besu/tree/main/vdr/wasm"

    %% Click Events for Infrastructure & DevOps
    click I1 "https://github.com/hyperledger/indy-besu/blob/main/docker-compose.yml"
    click I2 "https://github.com/hyperledger/indy-besu/tree/main/network/infra"
    click I3 "https://github.com/hyperledger/indy-besu/blob/main/.github/workflows/indy-besu.yml"

    %% Click Events for Migration & Integration
    click M1 "https://github.com/hyperledger/indy-besu/tree/main/docs/migration"
    click M2 "https://github.com/hyperledger/indy-besu/tree/main/examples/migration"
```
