Allows exchange energy between the householders (peers)
- edgex services for a powerflow instance
- trader service to trade and conclude a transaction
- blockchain service to maintain chain
Trader service is the main service. It relates to a identity that is participitating in market.
Every trader service will run a blockchain service (each blockchain instance will act as a Ledger of transactions in the market).
Blockchain is proxy for "view of market". It is a Ledger of the powerflow market.
To begin participating in the powerflow network they have to register as miner.
Blockchain service sends a request to registration server.
And Register server responds with peerlist of other blockchain holders on the network.
Then download the current state of chain from any of the fellow blockchain holder.
Register service keeps track of nodes in the network.
- Registration service Nodes in network Registration service node begins by calling /registerSelfTo api.
- Blockchain service Nodes in network Blockchain service sends a request "register/blockchain" to a Register service. And the register service responds with list of other nodes in the network. This act as start point of execution, for every blockchain service.
##Run details run command
go run main.go <ip> <port> <label>
example
go run main.go 127.0.0.1 6686 temper
- Run Edgex devices
- Run atleast one registration service
- For a actor in marketplace (each actor/trader controls 1 EdgeX instance)
- a. Run a trader service
- b. Run a blockchain service for this trader service (register req to a register service)
curl -sSL https://get.docker.com | sh
docker run --rm hello-world
If permission error is observed, run the following options:
Option #1
sudo docker run --rm hello-world
Option #2
usermod -aG docker <your_user>
Install Python modules:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && sudo python3 get-pip.py
sudo apt-get install libssl-dev
sudo apt-get install libffi-dev
Install vim:
sudo apt-get update && sudo apt-get install vim -y
Install docker-compose:
sudo pip3 install docker-compose
vim docker-compose.yml
You can add your device in docke-compose.yml file.
version: '3'
services:
webapp:
ports:
- 5000:8000
image: python:3.7-alpine
command: "python -m http.server 8000"
Run the docker compose:
sudo docker-compose up -d
sudo docker-compose down
- Goland IDE environment
- Git
- EdgeX Foundary
mkdir -p ~/go/src/github.com/edgexfoundry
cd ~/go/src/github.com/edgexfoundry
git clone https://github.com/edgexfoundry/device-sdk-go.git
mkdir device-simple
cp -rf ./device-sdk-go/example/* ./device-simple/
cp ./device-sdk-go/Makefile ./device-simple
cp ./device-sdk-go/Version ./device-simple/
cp ./device-sdk-go/version.go ./device-simple/
1.Main.go:
import library
"github.com/edgexfoundary/device-simple/driver"
- Configure Makefile:
MICROSERVICES=cmd/device-simple/device-simple
GOFLAGS=-ldflags "-X github.com/edgexfoundry/device-simple.Version=$(VERSION)"
cmd/device-simple/device-simple:
$(GO) build $(GOFLAGS) -o $@ ./cmd/device-simple
- go.mod
GO111MODULE=on go mod init
Alternatively, the go.mod from existing SDK device can be used in simple device example, directory root on go.mod file should be updated.
Make file is used to build the project. Build command in the build directory is:
make build
Run the binery generated in the follwing directory, in this example simple-device
cd cmd
cd simple-device
./simple-device
For re-run the application, it is required to kill or delete the devices that is running in docker background to avoid panic error in docker while is running to do so, do the following:
Delete Using Postman
DELETE clocalhost:48081/api/v1/device/id/DEVICE_ID
docker container ls -a
docker container stop $(docker container ls -aq)
docker container rm $(docker container ls -aq)
while docker-compose down, we can run in with --remove-orphans
docker-compose up -d
docker-compose down --remove-orphans
- Docker Up
- Make Build
- Run Device Simple
- Run Task Manager
- Brows HTML template
- Postman to run register device
- Postman to make decision
- Update Browser to update the page