tittuvarghese / ela.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ela Application

Ela blockchain application readme.

Running Application for Test

ssh -i "bcoin.pem" ubuntu@107.20.69.123
cd project/directory
npm install
./runApp.sh

Test

npm test

Accessing APIs

Refer tests folder for sample API calls.

Public IP

http://107.20.69.123:4000

Running for Production

ssh -i "bcoin.pem" ubuntu@107.20.69.123
cd project/directory
npm install
./runApp.sh
npm production

API Documentation

User Operations

Function: createUser
METHOD: POST
URL : '/channels/mychannel/chaincodes/ela_cc/createUser'
REQUEST
{
  "peers": ["peer0.org1.ela.com"],
  "args": ["ELP-USR001", {
    "user_id" : "ELP-USR001",
    "name": {
      "first_name": "Adam",
      "last_name": "Smith"
    },
    "email" : "user@org1.ela.com",
    "phone_number" : "+91-9876543210",
    "profile_image" : "profile_image_url_ipfs",
    "role" : "producer"
  }]
}

RESPONSE
{
    "success": true,
    "message": "Successfully invoked the chaincode for function createUser to the channel mychannel",
    "trxnID": "TxnID"
}
Function: queryUser
METHOD: GET
URL : '/channels/mychannel/chaincodes/ela_cc/queryUser/ELP-USR001?peer=peer0.org2.ela.com'
RESPONSE
{
  "success": true,
  "message": "Found results for queryUser - ELP-USR001",
  "data": {
    "user_id" : "ELP-USR001",
    "name": {
      "first_name": "Adam",
      "last_name": "Smith"
    },
    "email" : "user@org1.ela.com",
    "phone_number" : "+91-9876543210",
    "profile_image" : "profile_image_url_ipfs",
    "role" : "producer"
  }
}
Function: updateUser
METHOD: POST
URL : '/channels/mychannel/chaincodes/ela_cc/updateUser'
REQUEST
{
  "peers": ["peer0.org1.ela.com"],
  "args": ["ELP-USR001", {
    "name": {
      "first_name": "Adam",
      "last_name": "Smith"
    },
    "phone_number" : "+91-9876543210",
    "profile_image" : "profile_image_url_ipfs",
    "role" : "producer"
  }]
}

RESPONSE
{
    "success": true,
    "message": "Successfully invoked the chaincode for function updateUser to the channel mychannel",
    "trxnID": "TxnID"
}

About


Languages

Language:JavaScript 65.6%Language:Go 26.1%Language:Shell 6.4%Language:DIGITAL Command Language 1.9%