dhiway / cord

CORD - Enterprise Blockchain Framework
https://cord.network
GNU General Public License v3.0
161 stars 112 forks source link

[C4GT] - Integrate with Sunbird RC #163

Open amarts opened 1 year ago

amarts commented 1 year ago

Project Details

Like Bitcoin, Ethereum, and Polkadot, CORD refers at once to a network protocol and the primary federated public network that runs this protocol. CORD is a free and open project, with the code being placed under a FLOSS license. The project is developed in an open manner and accepts contributions where ever they are helpful. The implementation of the CORD Layer-1 Framework (CLF), known as CORD and includes a full protocol implementation together with API bindings and SDK. CORD is designed to be a general-purpose blockchain technology stack, neither uniquely for a federated network nor public/private network operation. This paper nonetheless describes CORD under the context of a federated network.

More on the project @ https://cord.network

Features to be implemented

What exists

What needs to be built

Sunbird RC project should get a support for anchoring the credentials, and registry entries on to CORD Blockchain for immutability.

Complexity

Medium

Skills Required

Typescript, REST APIs, basic understanding of Sunbird RC, Rust

Name of Mentors:

@amarts, @smohan-dw, @vjgaur, @rohibhan, @Vikastc

Project size

8 Weeks

Product Set Up

docker run -p 9944:9944 -it dhiway/cord:dev-0.8.0 --dev --unsafe-ws-external --unsafe-rpc-external cd issuer-agent ; docker compose up Issuer Agent repo

Acceptance Criteria

Milestones

C4GT

This issue is nominated for Code for GovTech (C4GT) 2023 edition. C4GT is India's first annual coding program to create a community that can build and contribute to global Digital Public Goods. If you want to use Open Source GovTech to create impact, then this is the opportunity for you! More about C4GT here: https://codeforgovtech.in/

swastiksuvam55 commented 1 year ago

Hello I'm swastik suvam singh, a 3rd year undergrad at IIIT Bhubaneswar and am interested in knowing more and working in Corda. It'd be really helpful if I could get more info about the integration with Sunbird RC. Currently am trying to install and run the node locally in the system, will update shortly. Thank you.

fibonacci35813 commented 1 year ago

Hey, I'm Satyam Kumar , a 3rd year undergradute student at IIT Kharagpur and am really interested in knowing more about the project and CORD Blockchain. I have prior experience in REST APIs. It would be help if I can some info on how to start working on this project. Thank you

amarts commented 1 year ago

Everyone interested in the project, we will be taking another week for getting more documentation out for you. Happy to see your interest.

wiredhikari commented 1 year ago

Hello, Atharva here. I have setup the docker container. What should be the next steps.

Chetax commented 1 year ago

Hello @amarts ,Thanks For Consideration We Are Waiting For More documentation To Successfully Integrate Sunbird RC In Cord.

vinayastar01 commented 1 year ago

I am really interested to work on this project.

yoharsh14 commented 1 year ago

Hey, I am Harsh Dambhare, a 3rd year Grad in AKTU, I have been building optimized smart contract and also I have little experience with Hyperledger fabric, and when I heard about C4GT has a project on corda, I got excited and wanted to know more about CORDA and also want to contribute my knowledge here. If someone could please help me where to start with this project. Thankyou

amarts commented 1 year ago

@yoharsh14 CORDA is different from CORD.Network which are are building. Please visit https://cord.network and check the whitepaper to understand more on it.w

VenuChoudhary001 commented 1 year ago

Setting up the Sunbird RC Core Backend Locally for Development

This guide will walk you through the process of setting up the Sunbird RC Core Backend on your local system. Please note that this setup is intended for a basic local installation without using Docker. The instructions assume you are using Ubuntu 22.04 as your operating system and Visual Studio Code as your IDE.

If you want to use docker, you can follow this guide

Prerequisites

Before starting the setup process, make sure you have the following prerequisites installed on your system:

  1. Terminal Emulator: Linux and macOS usually come with a terminal installed by default. For Windows, it is recommended to use git-bash, which you can download and install from here. To test if the terminal is installed correctly, open it and type echo Hi. You should see "Hi" displayed when you hit enter.

  2. Git: You can find installation instructions for Git here. To check if Git has been installed correctly, run the following command in the terminal:

    $ git --version
    git version 2.33.0
  3. Java: Install Java 8 by following the instructions provided here. To check if Java has been installed correctly, run the following command in the terminal:

    $ java
    Usage: java [-options] class [args...]
  4. PostgreSQL: Make sure you have PostgreSQL installed and running on your system. You can download it from here. To check if PostgreSQL is running, use the following command in the terminal:

    $ sudo systemctl status postgresql

    PostgreSQL should be running on port 5432. You can verify it by running:

    $ sudo lsof -i:5432

    If you encounter an error such as "PostgreSQL cannot connect to the server" or similar, refer to this stack-overflow

Downloading the Source Code

  1. Open your terminal and run the following command to download the Sunbird RC Core source code:

    $ git clone https://github.com/sunbird-rc/sunbird-rc-core.git sunbird-rc/core
  2. Move into the downloaded folder by typing:

    $ cd sunbird-rc/core

Compiling the Registry

  1. Run the configure-dependencies.sh script in the root of the repository to set up the dependencies:

    $ sh configure-dependencies.sh
  2. Compile the registry by executing the following commands:

    $ cd java
    $ ./mvnw clean install -DskipTests
    $ cd ..

    The compilation process may take some time, especially when running it for the first time. Once completed, a JAR file will be generated in the java/registry/target directory.

Configuring Schemas

  1. Place all your schema files in the java/registry/src/main/resources/public/_schemas/ folder. You can find a sample set of schemas for a simple student-teacher registry here.

    To learn how to write your own schemas, refer to the provided guide.

Setting up Environment Variables

To set up the necessary environment variables for running the registry and the database, follow these steps:

  1. Open a terminal and run the following command to open the environment file:

    $ sudo -H gedit /etc/environment
  2. Add the following environment variables to the file. To understand what each config does, check out the configuration page. Here we are disabling most of the features, you can enable them once your registry is running and make the appropriate changes.

    async_enabled=false
    webhook_enabled=false
    authentication_enabled=false
    notification_async_enabled=false
    xpack.security.enabled=false
    notification_enabled=false
    signature_enabled=false
    workflow.enable=false
    registry_base_apis_enable=true
    enable_external_templates=true
    connectionInfo_uri=jdbc:postgresql://localhost:5432/registry
    connectionInfo_username=postgres
    connectionInfo_password=postgres
    template_base_url=http://registry:8081/api/v1/templates/
    manager_type=DefinitionsManager
    search_providerName=dev.sunbirdrc.registry.service.NativeSearchService
  3. Save the file and close the text editor.

  4. Run the following command in the terminal to apply the environment variable changes:

    $ source ~/.bashrc

Running the Registry

  1. Navigate to the project folder where you cloned the repository in your terminal.

  2. Run the following command to start the registry:

    $ java -jar ./java/registry/target/registry.jar

Troubleshooting

If you encounter the error "registry undefined or does not exist," follow these steps:

  1. Switch to the PostgreSQL user in the terminal:

    $ su postgres
  2. Create a database named "registry":

    $ createdb registry

    This error is caused because the connection URL in the environment variables is set to:

    connectionInfo_uri=jdbc:postgresql://localhost:5432/registry

    Adjust the command based on your specific configuration.

Congratulations! You have successfully set up the Sunbird RC Core Backend on your local system.

Now in order to check whether the registry is running or not, go to the terminal and run

     sudo -i -u postgres
     psql registry 
     \dt+;

If you can see a table named as V_Teacher_GROUP or something related present, the registry is running.

You can also check via calling any endpoint. Check the docs here