Skip to content

Smart-Contract-Modelling-uOttawa/SymboleoAC-Application-API

Repository files navigation

SymboleoAC API

SymboleoAC API is a secure and event-driven application layer that connects \SymboleoAC/ smart contracts with external cyber-physical components, including IoT sensors, a message broker, a CEP engine, and Hyperledger Fabric.

It supports secure communication, event publication and subscription, smart contract transaction invocation, and role-based notifications.


Installation

# Node version: v16.16.0
npm install

Running the Application

Before proceeding, ensure the generated smart contract is successfully deployed on Hyperledger Fabric.
For deployment instructions, refer to:

SymboleoAC-HyperledgerFabric-Test-Network


Enroll Users and Retrieve IoT Rules (Per Instance)

To enroll \SymboleoAC/ users and retrieve IoT rules for a specific case study (e.g., Meat Sale or Vaccine Procurement), use the EnrollRolesRetrieveIoTRules.js script.

  1. Open EnrollRolesRetrieveIoTRules.js and uncomment the parameters for the intended case study.
  2. Run the script:
node EnrollRolesRetrieveIoTRules.js

Enroll Sensors (Per Instance)

To enroll sensors for a specific case study:

  1. Open EnrollSensors.js.
  2. Update the JSON file name to match the file generated by the retrieveIoTRules() function
    (e.g., rulesMeatSale0000.json, rulesVaccine0000.json).
  3. Run the script:
node EnrollSensors.js

Enroll Message Broker (One-Time Setup)

The message broker (RabbitMQ) enrollment is performed once (not per instance).

node runEnrollRabbitMQ.js

Enroll CEP Server (One-Time Setup)

The Complex Event Processing (CEP) server enrollment is performed once (not per instance).

node enrollCEPServer.js

Full Cycle Execution (IoT → CEP → Message Broker → Smart Contract)

After completing all enrollment steps, you can run the full cycle execution from IoT sensors to smart contract execution through the CEP engine and message broker.

Steps

  1. Open three different terminals.

  2. Terminal 1 — Start Sensor Publisher

node secureSensorPublisher.js
  1. Terminal 2 — Start CEP Engine
# Compile
javac -cp "esper-9.0.0/*:esper-9.0.0/dependencies/*" *.java

# Run
java -cp ".:esper-9.0.0/*:esper-9.0.0/dependencies/*" EsperBridge
  1. Terminal 3 — Start Alert Subscriber
node alertSubscriber.js
  1. Ensure the message broker (RabbitMQ) is running and properly connected.

  2. Monitor smart contract execution and notifications.


This setup enables real-time data flow from IoT devices through event processing and messaging layers to blockchain-based smart contract execution.

Multi-Instance Execution

To run multi-instance execution, follow the same steps used for single-instance setup, but use the scripts that end with MultiInstaExperiment For Example:

Enroll Users and Retrieve IoT Rules (Multi-Instance)

Use:

node EnrollRolesRetrieveIoTRulesMultiInstaExperiment.js

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors