/edc-blockchain-broker

TP 1: Fork of the Eclipse Dataspace Connector (EDC) that extends the EDC with blockchain brokering capabilities and contains a demonstrator

OtherNOASSERTION

EDC Blockchain Broker

Description

Introduction

Please note: This repository does not contain production-grade code and is only intended for demonstration purposes.

This Repository was created to work for the specific demonstration of connecting the EDC to the tezos-edc-interface and the edc dashboard

We provide an extension that uses the Eclipse Dataspace Connector (EDC) by extending it with blockchain capabilities for the brokering / contract discovery process.

EDC Data Dashboard is a dev frontend application for EDC Data Management API. We had to fix some issues, so use our forked version to make sure everything works.

The Tezos-EDC Interface is a programm we created, to enable the connection between EDC and the Tezos Blockchain.

Currently we support the EDC version 0.2.0

Goal

  • Extend EDC functionality by managing and storing assets, policies and contract offerings as NFTs on Tezos blockchain
  • Data of assets etc. should be included inside token’s metadata to ensure integrity during negotiation phase
  • Implement a blockchain interface to realize minting and token querying functionality
  • Optimize token request by adding blockchain indexer → lower response time
  • Visualize process of asset, policy and contract offer creation in Data Dashboard → extension and modification is needed

Prerequisites

Install an extension to ignore CORS errors in the Browser, e.g. CORS Unblock (We're still working on a fix for this)

Quickstart with docker compose

In order to pin content to the IPFS you must include your Pinata API credentials in the form of environment parameters:

  1. Create a file in root directory called ".env"

  2. Add your Pinata key as a variable (the JWT key):

    PINATA_KEY="<JWT key>"
    
  3. Than you can just run docker-compose up to get a quick setup running for simple demonstration purposes.

Optionally you can add environment varibales to the edc-interface container in order to specify your own smart contract addresses. Following params can be modified:

  • ASSET_ADDRESS - default value = KT1S2BZRyg9MXgERzsCUjqjiKS95L7FCt8KM
  • POLICY_ADDRESS - default value = KT1L7w74gXr1kuF2z4cEe59z7fhihdixSKWm
  • CONTRACT_ADDRESS - default value = KT1VSymTD5oqBHqQqXPhc7hXhyoL38AK6xpC
  • TRANSFER_ADDRESS - default value = KT1N5oTfoLsKbXshfW5WrcnQJdB1kR5t21Vs
  • AGREEMENT_ADDRESS - default value = KT19Jk6zvWfFjWMVSozPNm7VDMKSDVGrU6XD
  • VERIFIABLE_CREDENTIALS_ADDRESS - default value = KT1XgUq6rzN9q6YMh44TbLffEz3zb54HbY2H

Create your own tezos adress or asset, policy, contract contracts

In case you wish to create your own tezos address or asset, policy, contract contracts, we provide an option. It is delivered with our docker compose file and commented out by default. Comment in the octez-node lines at the bottom of the docker-compose.yml and run:

docker compose up

Folders are created outside of Docker where the blockchain data is stored. On Linux systems, it is unfortunately necessary to give these folders separate write permissions for the current user because otherwise tezos/tezos:octez-node-alpha docker service cannot continue and is caught in a loop.

sudo chmod 777 -c -R client_data/ container-data/ node_data/ 

Generate a new address tz1... and load tez on to it:

docker exec edc-interface-1 ./newAccount.sh 

Copy the hash and visit the tezos faucet page to fund your account at:

https://faucet.ghostnet.teztnets.xyz 

Generate new asset, policy, contract contracts with:

docker exec edc-interface-1 ./newContracts.sh 

These can then be replaced in the docker-compose.yml in the lines 47 to 49 and the lines 117 to 119.

Installation & Execution

In order to try the demonstration, you need to run three applications:

  1. EDC Provider
  2. Tezos-EDC Interface
  3. Angular Frontend (EDC Data Dashboard)

All needed repositories are included in this repository as submodules.

Steps:

  • Clone this repository using git clone --recursive [URL] to make sure all submodules are also cloned correctly

  • Enter the EDC Interface Submodule and follow the readme instructions of edc-interface. Don't forget to add the Pinata env variable. Finally run the API with npm run serve.

  • Enter the Data Dashboard Submodule and run npm install -g @angular/cli to install Angular globally.

  • Run npm install to install all dependencies

  • Run npm run start to host angular frontend

To build and run the edc extension and the edc , run the next two commands in the root directory of the Samples-Blockchain submodule:

  • ./gradlew BlockchainCatalog:blockchain-catalog-prosumer:build

  • java -Dedc.fs.config=BlockchainCatalog/blockchain-catalog-prosumer/config.properties -jar BlockchainCatalog/blockchain-catalog-prosumer/build/libs/consumer.jar

Use http://localhost:4200/ to explore the Data Dashboard in your browser.

Example run via Postman requests

Deploy the two EDCs and the edc-interface.

Use this postman workspace to get access to the following requests. Also use this Environment of the Postman Collection as there are many variables used to make the flow more easy.

Navigate to the EDC REST API 0.2.0 Collection. The workspace makes strong use of variables and environments which are manipulated via Pre-request Scripts and Tests. To change the used URLs, click on the EDC REST API 0.2.0 and open Variables. The environment Test contains mostly variables that are changed during the execution of the requests. E.g. ids that are increased every request to mitigate duplicated keys and ids that are needed for later requests.

For a full example the following requests have to be send in this order:

  1. assets/create Asset
  2. policydefinitions/create Policy
  3. contractdefinitions/create Contract Definition
  4. contractnegotiations/initiate Contract Negotiation
  5. contractnegotiations/{id}/get Negotiation
  6. register dataplane
  7. transferprocess/initiate Transfer Process

Every step makes use of pre and post Requests scripts which collect values from request responses and save them for later requests. This should give an overview of how the requests works and how to change them for individual use cases.

Local Development

Using docker-compose-dev.yaml instead of docker-compose.yml will result in a fresh build of all components. For this, the repository has to be cloned including all submodules:

  • EDC-Blockchain-Catalog
  • EDC-Blockchain-Dashboard
  • EDC-Blockchain-Interface

Therefore, make sure to clone this repository using the recursive parameter: git clone --recursive https://github.com/GAIA-X4PLC-AAD/edc-blockchain-broker.git

Advantages of the Local Development Build

  • Automatically build new docker files when code changes are detected on restart
  • Integration of OpenTelemetry in the Catalog and Interface for better error detection
    • Jaeger runs at localhost:1668

Hint: If you want to integrate the Claim Compliance Provider make sure you configure the CCP_INTERFACE_URL in the blockchain interface. You also need to add following parameters to the create asset request:

  • claimsList -> List of claims to be passed to the CCP in the claims field to be checked for compliance.
  • gxParticipantCredentials -> the three participant credentials to be passed to the CCP in the verifiableCredentials field.

Those will be passed to the Claim Compliance Provider during asset creation. The blockchain listener will retrieve the CCP response from the asset and send it to the federated catalogue or CES (credential event service).

Support

If there are any problems with installation or deployment, you can write me a mail: julian.legler@tu-berlin.de


## Outlook

- reach higher level of decentralization and independency:
  - replace Pinata API with individual running IPFS nodes
  - replace TzKT API by running a full blockchain node and further implement lightweight blockchain indexer
- enrich blockchain interface functionality to comply with EDC processes:
  - delete/burn tokens (assets, policies and contract offers)
  - transfer tokens to map asset transfer after negotiation phase
  - link identity management to tokens
- analyze operation costs

## Legal

See legal comments of the three sub repositories.