Skip to content

Brokerage Engine

Marios Phinikettos edited this page Aug 22, 2018 · 10 revisions

The blockchain for the Brokerage Engine of AEGIS was developed using Hyperledger Fabric v1.0 and Hyperledger Composer. The network consists of an Orderer, a CA authority, a peer and a CouchDB database for queries. Additional organizations, peers and orderers will be added in future versions.

Installation

Detailed installation steps can be found at the AEGIS Network Repository.

Usage

Along with the network, a REST API server is installed, allowing to interact with it. The following endpoints are available:

Users' API

  1. Get a list of all users registered with the brokerage engine:

     GET /api/User
    
  2. Add a user to the brokerage engine

     POST /api/User
    

    Example Body

    {
        "$class": "eu.aegis.User",
        "uid": "[email protected]",
        "balance": "0.0",
        "externalAssets": [
            {}
        ]
    }
  3. Get user's details:

     GET /api/User/{uid}
    
  4. Load currency to the balance of a user:

     POST /api/LoadBalance
    

    Example Body

    {
        "$class": "eu.aegis.LoadBalance",
        "amount": 0,
        "user": "eu.aegis.User#[email protected]",
        "transactionId": "string",
        "timestamp": "2018-03-21T10:10:29.384Z"
    }

Assets' API

  1. Get a list of all AEGIS assets:

     GET /api/AEGISAsset
    
  2. Add an asset to the brokerage engine:

     POST /api/AEGISAsset
    

    Example Body

    {
        "$class": "eu.aegis.AEGISAsset",
        "aid": "1234",
        "type": "Dataset",
        "cost": "0.0",
        "status": "Free",
        "exclusivity": "None",
        "contractText": "Lorem Ipsum...",
        "owner": "eu.aegis.User#[email protected]"
    }
  3. Get asset’s details:

     GET /api/AEGISAsset /{aid}
    
  4. Buy an asset:

     POST /api/BuyAsset
    

    Example Body

    {
        "$class": "eu.aegis.BuyAsset",
        "buyer": "eu.aegis.User#[email protected]",
        "relatedAsset": "eu.aegis.AEGISAsset#1234",
        "transactionId": "string",
        "timestamp": "2018-03-21T10:10:29.343Z"
    }
  5. Change the cost of an AEGIS asset:

     POST /api/ChangeAssetCost
    

    Example Body

    {
        "$class": "eu.aegis.ChangeAssetCost",
        "newCost": 0,
        "relatedAsset": "eu.aegis.AEGISAsset#1234",
        "transactionId": "string",
        "timestamp": "2018-03-21T10:10:29.343Z"
    }
  6. Change the status of an AEGIS asset (i.e. free, paid etc):

     POST /api/ChangeAssetStatus
    

    Example Body

    {
        "$class": "eu.aegis.ChangeAssetStatus",
        "newStatus": "Free",
        "relatedAsset": "eu.aegis.AEGISAsset#1234",
        "transactionId": "string",
        "timestamp": "2018-03-21T10:10:29.356Z"
    }
  7. Change the exclusivity of an AEGIS asset (i.e. none, lifetime etc):

     POST /api/ChangeExclusivity
    

    Example Body

    {
        "$class": "eu.aegis.ChangeExclusivity",
        "newPeriod": "None",
        "relatedAsset": "eu.aegis.AEGISAsset#1234",
        "transactionId": "string",
        "timestamp": "2018-03-21T10:10:29.368Z"
    }
Clone this wiki locally