Skip to content

A registry for digital research objetcs using Composer and Fabric

Notifications You must be signed in to change notification settings

Blockchain4openscience/hyperledger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blockchain4openscience

The project website is here.

Abstract: Open science is a new movement in science that promotes principles of open access to research data, publications, and scientific collaboration. Open science promises to increase transparency and quality of research, provide reproducibility by reusing scientific datasets and increasing trust in the scientific collaboration. Blockchain fits the mindset of open science and can help to fulfill open science principles: transparency and availability of blockchain makes scientific outputs open & transparent; disintermediation removes subjectivity from scientific reviews; integrity and possibility to secure transactions in the competing environment increases trust in scientific results; smart contracts allows to manage access to scientific outputs; immutability represents precise relationships between the works with such features as richness, time-based relationships, and logical precursors.


The project is curretly in development using frameworks and tools from Hyperledger, in particular Fabric and Composer

The business network is designed to capture the interactions between researchers within the academic community as well as participants from outside of the academia. The interactions involve digital research objetcs, that are shared and traded as assets accross a network. Some examples of digital research objects are: documents, presentations, datasets, code, among other object considered as valuable in the process of creating knowledge in a disciple onr accross many disicplines. A basic setup of a business network involves the digital research objets as assets and researchers and institutions as participants. These participants exchange the assets using different types of smart contracts. The business network may be used to register interactions among participants, provide tractability for the value creation process in science and it may include a system of tokens to reward interactiosn among participants.

We will be posting updates on different versions of the business network bforos that can be used both in the Composer Playground or can be deployed locally in Fabric. The individual files that make up the business network archive are in the directory bforos of the repository.


In order to deploy into a local Fabric environment please clone the repository and follow the instructions

git clone https://github.com/Blockchain4openscience/hyperledger

We follow the hyperledger-composer tutorial on Developer tutorial for creating a Hyperledger Composer solution.

Make sure that you start a fresh Hyperledger Fabric network, that is you must teardown any previous Hyperledger Fabric constainer and delete any old business network card that may exist form previous Fabric enviorments.

Installing the development environment

Follow the installation steps on Installing the development environment

In this tutorial, you must be create a PeerAdmin Card. To see the card name:

composer card list

Fabric Network Design

This step

The hyperledger repository contains the bussines network definition (bforos3 is the last version) and a bussiness network archive called bforos@0.0.1.bna generated from this definition . If you wish, you can generate a business network archive with:

composer archive create -t dir -n .

After creating the .bna file, the business network can be deployed to the instance of Hyperledger Fabric. For this step you must have the name of the PeerAdmin card created in previous steps.

Deploying a business network to the Hyperledger Fabric requires the Hyperledger Composer business network to be installed on the peer, then the business network can be started, and a new participant, identity, and associated card must be created to be the network administrator. Finally, the network administrator business network card must be imported for use, and the network can then be pinged to check it is responding.

  1. To install the business network:
composer network install --card PeerAdmin@hlfv1 --archiveFile bforos@0.0.1.bna

If PeerAdmin card name is different to PeerAdmin@hlfv1 replace this value

  1. To start the business network:
composer network start --networkName bforos --networkVersion 0.0.1 --networkAdmin admin --networkAdminEnrollSecret adminpw --card PeerAdmin@hlfv1 

This command generate a file for the admin network card admin@bforos.card

  1. To import the network administrator identity as a usable business network card:
composer card import --file admin@bforos.card
  1. To check that the business network has been deployed successfully, run the following command to ping the network:
composer network ping --card admin@bforos

Generating a REST server

Hyperledger Composer can generate a bespoke REST API based on a business network. For developing a web application, the REST API provides a useful layer of language-neutral abstraction.

  1. To create the REST API, navigate to the bforos directory and run the following command:
composer-rest-server
composer-rest-server -c admin@bforos -n never -w true
  1. Enter admin@bforos as the card name.
  2. Select never use namespaces when asked whether to use namespaces in the generated API.
  3. Select No when asked whether to secure the generated API.
  4. Select Yes when asked whether to enable event publication.
  5. Select No when asked whether to enable TLS security.

The generated API is connected to the deployed blockchain and business network.

Composer Rest Server

Launch your browser and go to the URL given http://localhost:3000/explorer for interacting with it. Rest server generates an endpoint for each participant, asset and transaction of the business network definition. Go to the business model to review all operations in the rest server. yo can use a api environment tool (e.g. Postman) to send Http Request to Hypeledger.

Additionally you can run hyperledger playground to see easily the changes in the components of the business model.

composer-playground

If you don't have hyperledger playground, follow the installation steps on Installing the development environment:

Create Participant

http://localhost:3000/api/Researcher

Create two Researcher participant:

POST http://localhost:3000/api/Reseacher -d
{
  "$class": "org.bforos.Researcher",
  "researcherId": "1",
  "email": "juan.uno@bforos.org",
  "firstName": "juan",
  "lastName": "uno"
}

Response

{
  "$class": "org.bforos.Researcher",
  "researcherId": "1",
  "email": "juan.uno@bforos.org",
  "firstName": "juan",
  "lastNam": "uno",
  "wallet": 10
}
POST http://localhost:3000/api/Reseacher -d
{
  "$class": "org.bforos.Researcher",
  "researcherId": "2",
  "email": "juan.dos@bforos.org",
  "firstName": "juan",
  "lastName": "dos"
}

Response

{
  "$class": "org.bforos.Researcher",
  "researcherId": "2",
  "email": "juan.dos@bforos.org",
  "firstName": "juan",
  "lastNam": "dos",
  "wallet": 10
}

Create Researcher Object

http://localhost:3000/api/ResearchOJ
  1. The research objects can be created directly. With this method you can create a research object without contributors:
POST http://localhost:3000/api/ReseachOJ -d {
{
  "$class": "org.bforos.ResearchOJ",
  "ResearcherObjId": "RO01",
  "typero": "DOCUMENT",
  "uri": "www.juanuno.com/ro"
}

Response

{
  "$class": "org.bforos.ResearchOJ",
  "ResearcherObjId": "RO01",
  "typero": "DOCUMENT",
  "uri": "www.juanuno.com/ro",
  "reward": 1,
  "cost": 1,
  "countAccess": "0",
  "collectors": [
    {}
  ],
  "contributors": [
    {}
  ]
}
  1. The research objects can be created by the smart contract CreateResearchOJ. The reward and cost is defined in the transaction
POST http://localhost:3000/api/CreateResearchOJ -d {
{
  "$class": "org.bforos.CreateResearchOJ",
  "researchObjId": "RO01",
  "typeRO": "DOCUMENT",
  "uri": "www.juanuno.com/ro",
  "creator": "resource:org.bforos.Researcher#1"
}

Unlike the first method, this method generate a wallet event for juan.uno@bforos.org that create the researcher object an assigns as contributor

Transaction Response

{
  "$class": "org.bforos.CreateResearchOJ", 
  "ResearcherObjId": "RO01",
  "typero": "DOCUMENT",
  "uri": "www.juanuno.com/ro",
  "creator": "resource:org.bforos.Researcher#1",
  "transactionId": "ce75b0e7-554b-4fff-a890-dee65067338c",
  "timestamp": "2018-09-29T16:35:57.702Z"
}

Wallet Event

See in hyperledger playground (all transaction)

{
 "$class": "org.bforos.WalletEvent",
 "claimer": "resource:org.bforos.Researcher#1",
 "oldbalance": 10,
 "newbalance": 11,
 "eventId": "ce75b0e7-554b-4fff-a890-dee6343067338c#0",
 "timestamp": "2018-02-28T15:03:44.534Z"
}

Research Object Modified

See in hyperledger playground (ResearcherOJ)

{
  "$class": "org.bforos.ResearchOJ",
  "ResearcherObjId": "RO01",
  "typero": "DOCUMENT",
  "uri": "www.juanuno.com/ro",
  "reward": 1,
  "cost": 1,
  "countAccess": "0",
  "collectors": [
    {}
  ],
  "contributors": [
    "resource:org.bforos.Researcher#1"
  ]
}

Claim Research Object

POST http://localhost:3000/api/ClaimRO

A Researcher participant claim a ResearchOJ. This generates a wallet event for research object claimer:

POST http://localhost:3000/api/ClaimRO -d
{
  "$class": "org.bforos.ClaimRO",
  "researchObjId": "resource:org.bforos.ResearchOJ#RO01",
  "claimer": "resource:org.bforos.Researcher#2"
}

Transaction Response

{
  "$class": "org.bforos.ClaimRO", 
  "ResearcherObjId": "resource:org.bforos.ResearchOJ#RO01",
  "claimer": "resource:org.bforos.Researcher#1",
  "transactionId": "ce75b0e7-554b-4fff-a890-dee65456338c",
  "timestamp": "2018-09-29T15:03:57.702Z"
}

Wallet Event

See in hyperledger playground (all transaction)

{
 "$class": "org.bforos.WalletEvent",
 "claimer": "resource:org.bforos.Researcher#2",
 "oldbalance": 10,
 "newbalance": 11,
 "eventId": "ce75b0e7-554b-4fff-a890-dee65456338c#0",
 "timestamp": "2018-02-28T15:03:44.534Z"
}

Research Object Modified

See in hyperledger playground (ResearcherOJ)

{
  "$class": "org.bforos.ResearchOJ",
  "ResearcherObjId": "RO01",
  "typero": "DOCUMENT",
  "uri": "www.juanuno.com/ro",
  "reward": 1,
  "cost": 1,
  "countAccess": "0",
  "collectors": [
    {}
  ],
  "contributors": [
	"resource:org.bforos.Researcher#1",
	"resource:org.bforos.Researcher#2"
  ]
}

CountRO

POST http://localhost:3000/api/CountRO

Count access to ResearchOJ. This generates a wallet event for each contributor of research object:

POST http://localhost:3000/api/CountRO -d
{
  "$class": "org.bforos.CountRO",
  "Ro": "resource:org.bforos.ResearchOJ#RO01",
  "description": "description information optional"
}

Transaction Response

{
  "$class": "org.bforos.CountRO", 
  "ResearcherObjId": "resource:org.bforos.ResearchOJ#RO01",
  "claimer": "resource:org.bforos.Researcher#1",
  "transactionId": "ce75b0e7-554b-4fff-a890-dee65456338c",
  "timestamp": "2018-09-29T15:03:57.702Z"
}

Wallet Event

See in hyperledger playground (all transaction)

{
 "$class": "org.bforos.WalletEvent",
 "claimer": "resource:org.bforos.Researcher#juan.uno@bforos.org",
 "oldbalance": 11,
 "newbalance": 12,
 "eventId": "ce75b0e7-554b-4fff-a890-deefdfdg067338c#0",
 "timestamp": "2018-02-28T16:13:44.534Z"
}
{
 "$class": "org.bforos.WalletEvent",
 "claimer": "resource:org.bforos.Researcher#juan.dos@bforos.org",
 "oldbalance": 11,
 "newbalance": 12,
 "eventId": "ce75b0e7-554b-4fff-a890-dee6506fdss#0",
 "timestamp": "2018-02-28T16:23:44.534Z"
}

Research Object Modified

See in hyperledger playground (ResearcherOJ)

{
  "$class": "org.bforos.ResearchOJ",
  "ResearcherObjId": "RO01",
  "typero": "DOCUMENT",
  "uri": "www.juanuno.com/ro",
  "reward": 1,
  "cost": 1,
  "countAccess": "1",
  "collectors": [
    {}
  ],
  "contributors": [
	"resource:org.bforos.Researcher#1",
	"resource:org.bforos.Researcher#2"
  ]
}
{
  "$class": "org.bforos.ResearchOJ",
  "researchObjId": "RO03",
  "typeRO": "OTHER",
  "uri": "",
  "reward": 1,
  "cost": 1,
  "countAccess": 0,
  "cauthors": [1,2],
  "collectors": [],
  "contributors": ["resource:org.bforos.Researcher#1","resource:org.bforos.Researcher#2"]
}

About

A registry for digital research objetcs using Composer and Fabric

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •