Giter VIP home page Giter VIP logo

oble-pay's Introduction

Oble-Pay

An Online Wallet System built-in Decentralized Identifiers in fulfillment of CS 199 by Antonio A. Aquino IV and Jack Vincent Nicolas

Prerequisites

It is advisable to follow the order of installation based from the list above as it important to note that you should clone the OblePay github repository and then install the fabric-samples inside the OblePay repository

Quick Start

# To install the dependencies of the react app
npm install

# To start the Hyperledger Aries-Indy program, make sure to change the GENESIS_URL to http://greenlight.bcovrin.vonx.io/genesis in docker-compose.yml from the aries-playground repository and make sure to cd to aries-playground repository before running (Run this on another terminal):
docker-compose up

# Follow "Setting up Credentials System below before continuing

# To start the hyperledger fabric network, Token SDK and the react app. Make sure to cd to the Oble-Pay repository.
./startup.sh

# To issue tokens, use this cURL command from the Token SDK documentation
curl -X POST http://localhost:9100/api/v1/issuer/issue -H 'Content-Type: application/json' -d '{
    "amount": {"code": "TOK","value": 1000},
    "counterparty": {"node": "owner1","account": "alice"},
    "message": "hello world!"    
}'

# bring down fabric test network 
./stop.sh

# Run Ctrl+C on the terminal running docker-compose up

Setting up Credentials System

  1. Follow Create DID in a wallet from the link. Register the DiDs on the ledger.
  2. You will do this once times for localhost:8051, localhost:8052 and localhost:8053. However, you will only run POST /wallet/did/public on localhost:8051.
  3. Send a schema to the ledger with the API POST: ​/schemas with the json body as given (this is done on localhost:8051 and take note of schema_id):
{
  "schema_version": "1.0",
   "schema_name": "UP Credentials",
   "attributes": [
            "upMail",
            "name",
            "studentNumber"
          ]
 }
  1. Establish connection between the three agents by running these cURL commands.
# {CONNECTION BETWEEN ISSUER AND USER}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ISSUER (Create Inv)
issueInv=$(curl -X POST "http://localhost:8051/connections/create-invitation" -H "accept: application/json" | jq -r '.invitation')

# USER (Receive Inv)
issueCid=$(curl -X POST "http://localhost:8052/connections/receive-invitation" -H "accept: application/json" -H "Content-Type: application/json" -d "$issueInv" | jq -r '.connection_id')

# USER (Accept Inv)
curl -X POST "http://localhost:8052/connections/$issueCid/accept-invitation" -H "accept: application/json"

# {CONNECTION BETWEEN VERIFIER AND USER)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# VERIFIER (Create Inv)
inv=$(curl -X POST "http://localhost:8053/connections/create-invitation" -H "accept: application/json" | jq -r '.invitation')

# USER (receive inv)
cid=$(curl -X POST "http://localhost:8052/connections/receive-invitation" -H "accept: application/json" -H "Content-Type: application/json" -d "$inv" | jq -r '.connection_id')

# USER (accept inv)
curl -X POST "http://localhost:8052/connections/$cid/accept-invitation" -H "accept: application/json"
  1. Issuing of Credentials (On localhost:8051). Run POST method /credential-definitions using the json body below (Take note of the cred_def_id).
 {
   "revocation_registry_size": 8,
   "support_revocation": false,
   "schema_id": "PLACE schema_id THAT YOU TOOK NOTE OF FROM INSTRUCTION 3.",
   "tag": "default"
  }

Then, Run POST ​/issue-credential​/send using the json body below.

{ 
  "schema_name": "UP Credentials",
  "schema_version": "1.0",
  "cred_def_id": "USE THE cred_def_id FROM /credential-definitions",
  "auto_remove": false,
  "comment": "string",
  "connection_id": "GO TO CONNECTIONS AND LOOK FOR THE connection_id OF THE ACTIVE CONNECTION",
  "trace": false,
  "schema_issuer_did": "DERIVED FROM SCHEMA_ID, TAKE THE FIRST LETTERS UNTIL BEFORE THE FIRST :",
  "schema_id": "USE THE SCHEMA_ID THAT WAS INITIALLY TAKEN NOTE OF",
  "issuer_did": "SAME AS SCHEMA_ISSUER_DID",
  "credential_proposal": {
  "@type": "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/issue-credential/1.0/credential-preview",
  "attributes": [
     {
       "name": "name",
       "mime-type": "text/plain",
       "value": "Alice"
     },
     {
       "name": "upMail",
       "mime-type": "text/plain",
       "value": "[email protected]"
     },
     {
       "name": "studentNumber",
       "mime-type": "text/plain",
       "value": "202012345"
     }
   ]
  }
 }
  1. In the cloned Oble-Pay repository, go to test/my-app/src/pages/owner2.js
  • Open localhost:8053 and run GET /connections then take note of the connection_id of the active connection.
  • Replace the const [connectionId, setConnectionId] = useState('PLACE CONNECTION_ID HERE'); and all of the cred_def_id value with what you took note of in instruction 5.
  • Finally, close the browser and go back to Quick Start.

Ports used

  • 3000 - React client app
  • 8080 - Token SDK Swagger
  • 8051 - Issuer (Identity)
  • 8052 - User (Identity)
  • 8053 - Verifier (Identity)
  • 9100 - Issuer (Token)
  • 9200 - Alice (Token)
  • 9300 - Dan (Token)

oble-pay's People

Contributors

a4th avatar jabiwockeez avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.