In this project I will show how we can extends existing projects with Industry Marketplace functionality.
ProjectsFor demonstration purposes I will use some of my existing projects:
CoolSWITCH - Wireless High Power Smart Switch
(Designed for Industry 4.0, but suitable for smart home too. Features WiFi control, current measuring, PWM, soft start / stop and safety.)
IOTA Enabled Solid-State Switch and Power Meter
(IOTA-based payment, energy tracking, malfunction detection and preventive maintenance)
IOTA Pay Raspberry Pi
(Use a Raspberry Pi to add IOTA payment functionality to ANY product)
nanoSense:Motion - Ultra Low Power Wireless Motion Sensing
(Motion & Human Presence Sensing with Ultra Low Power Consumption and Bluetooth Low Energy Connectivity)
The Industry Marketplace is a new decentralized platform offered by the IOTA Foundation.
It works on the IOTA Tangle and uses with standardized e-contracts (based on eCl@ss-es), and offers an auction like mechanisms for negotiation.
Details descriptions and examples about the Industry Marketplace can be found on the https://industrymarketplace.net/ website.
Use Cases & eCl@ss Ideas> CoolSWITCH / IOTAAs a service provider with CoolSWITCH we can have the following use cases:
offer energy in an automated way, with CoolSWITCH acting as the main power switch
- offer energy in an automated way, with CoolSWITCH acting as the main power switch
- offer discounts if a high amount of energy is requested
- offer discounts for ours with low demand
As a service requester with can have use cases like:
switch between multiple power sources, based on the price of the energy
- switch between multiple power sources, based on the price of the energy
- schedule certain tasks when the energy is cheaper than usual
Special use cases like:
power delivery with ultra low noise
- power delivery with ultra low noise
- power delivery with custom waveform
- power delivery with current limiting
- etc.
may require new eCl@ss-es or new versions of existing eCl@ss-es.
> IOTA Pay Raspberry PiThe IOTA Pay Raspberry Pi (and the device connected to it) could act both like a service requester and as a service provider.
Common use cases would be:
- offer or acquire energy (electric, gas, etc.)
- offer or acquire consumables (coffee, water, fuel, etc.)
- dynamic pricing based on offer and demand
- etc.
In most use cases with the nanoSense:Motion will have the device acting as a service requester.
Use cases like the following could be possible:
- automatically acquire services when people enter a room
- automatically choose the service from the provider lowest price
- reduce cost by providing a service only when people are in the room
- etc.
To get started with the Industry MarketPlace we can follow the Using Python to automate Industry Marketplace participants video from one of the IOTA Fondtation developers Dave de Fijter.
The first step is to install some dependencies, such like Node.js and yarn:
### install dependencies
$ curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
$ echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
$ sudo apt-get update && sudo apt-get install nodejs yarn
### increase file watcher limit
$ echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
Next, we need to clone the iotaledger/industry-marketplace GitHub repository in two instances:
- provider - will act as our service provider Industry Marketplace node
$ git clone --depth=1 https://github.com/iotaledger/industry-marketplace.git provider
- requester - will act as our service requester Industry Marketplace node
$ git clone --depth=1 https://github.com/iotaledger/industry-marketplace.git requester
We would also need the iota-community/industry-marketplace-python-helper repository, which will act as our Industry Marketplace client.
To run the service provider node we need to do the following:
$ cd provider
### apply patches to change port and use the community IOTA tangle
$ git apply ../python-helper/patches/different_ports.patch
$ git apply ../python-helper/patches/comnet.patch
### build & run the node
$ yarn run dev
Running the service requester node is similar:
$ cd requester
### apply patch to use the community IOTA tangle
$ git apply ../python-helper/patches/comnet.patch
### build & run the node
$ yarn run dev
After this, we the web interface of the two nodes should be available on ports 3001 and 3000:
To run the demo applications we need to do the following steps:
- create python virtual environment, and install requirements
$ python3 -mvenv ../env
$ pip install -r requirements.txt
- run the provider application
$ python service_provider.py
- run the requester application
$ python service_requester.py [request_drone | drone_inspection]
According to the video this should generated some transactions in the provider, and requester node interfaces.
Note: I didn't managed to get this work yet. For some reason the requester node fails with a error, when a request is generated...
> Implementing custom Service Providers and RequestersTo implement custom service providers and requesters we can use the pyhton-helper project as a base.
Starting from there we create custom implementation by extending the IndustryMarketplace class from the imp package. Then, callbacks can be used to implement the Industry Marketplace specific flows:
For service providers we can use the following template:
class CustomProvider
name = 'CustomProvider'
service_provider = True
fund_wallet = False
gps_coords = '54.123, 4.321'
# callbacks ...
and callbacks:
on_cfp
- call for proposal - we can generate proposals here, if we wanton_accept_proposal
- a requester accepted or proposalon_reject_proposal
- a requester rejected or proposalon_inform_payment
- a requester paid an accepted proposal
For service requesters we can use:
class CustomRequester
name = 'CustomRequester'
service_provider = False
fund_wallet = True
gps_coords = '54.123, 4.321'
# callbacks ...
with the following callbacks:
on_proposal
- a proposal was receivedon_inform_confirm
- offer confirmed, time to pay
More implementation details to follow...
Comments