The CCF Confidential Consortium Framework is a blockchain that utilizes Trusted Execution Environments (TEEs) for secure and multiparty computation. It features a built-in map for data storage and exposes a RESTful endpoint, allowing it to be used as a secure service. The framework employs a Distributed Ledger Technology (DLT) solution for decentralized federated learning.
The repository includes a development container that creates an isolated environment for installing and running the application.
-
Clone the repository:
git clone https://github.com/aamar-shahzad/ccf-app-template.git
-
Open the project in Visual Studio Code:
- It will prompt you to open the code in the development container.
- Choose "Open in dev-container," and it will start installing the required packages.
-
Run the development container:
make run-virtual
- This command starts the network and exposes a default server address with a port number.
-
Main Working Files:
test.ipynb
: Contains client-side code that consumes the CCF REST API./cpp/app.cpp
: Source file of the CCF REST API. It defines endpoints and handlers.
Handler Actions:
- Upload initial models to the CCF network using the REST API. This endpoint returns a
model_id
for use in subsequent steps. - Download initial models for each client, initializing them with the same model after data distribution. Pass the previously generated
model_id
as a parameter. - Train the local model and upload local weights to the CCF network with the specified
model_id
for each local client. Assume users are training nodes, and they can call these endpoints by passing their certificate and private key for authentication. - Each local training node uploads local model weights with
round_no
andmodel_id
. - After calling the aggregation function, compute
FedAvg
from submitted local model updates to update theglobal_model_weights
. Use these weights in the next round for each client. - Download the global weights and update the local model weights at the end of each round.
- Continue this process until the model converges at the desired threshold limit.