NKN-ESI (or nESI) is an NKN based Energy Services Interface (ESI). An ESI supports a distributed marketplace for energy services on the electricity grid. It can be used to facilitate services such as load shifting (e.g. delaying energy consumption to help with peak capacity management) or the timed increased consumption of energy (e.g. activating devices to consume energy to mitigate a high voltage situation). The purpose of these services is to allow an aggregator, utility, or distribution system operator to easily and cost effectively maintain a stable and resilient electricity grid.
By developing NKN-ESI, we hope to show that an ESI which leverages NKN could be a very simple, secure, and resilient mechanism for building, factory, facility, or distributed energy resource operators to offer and provide energy services to a range of entities responsible for aspects of grid stability.
Click here to see a video demonstration.
Winner of Open innovative app on NKN (3rd prize).
A previous application of this ESI which leverages the same protobuf structures can be found at SolarNetwork, developed for the SEPA Plug and Play DER Challenge.
To install nkn-esi, you will need go, make and protoc.
You can find the latest version of Go at golang.org.
sudo apt-get install golang-goprotobuf-dev
sudo apt-get install build-essential
- Execute
make
in the project root directory. - Execute
go build
in the project root directory.
nkn-esi runs using the nkn.Multiclient, which allows the routing to happen:
- quickly
- easily
- securely
- without the need to mess around with ports and ip addresses
This is especially useful, given the fact that it allows each coordination node to recognize each other by using only a public key, while keeping the secret key private. The same instance (assuming the implementation of persistent data storage) can then run at different locations or machines, while retaining a single identifier which is publicly accessible.
NKN is also decentralized, which allows us to not worry about website certification or HTTPS for encrypted transfer, as NKN has no centralized server infrastructure. This also means that it is not vulnerable to the same attacks.
If this interests you, you can read more about the solution and benefits on NKN at nkn.org.
This demo utilizes the ESI API to create two primary agents:
- the coordination node
- the registry
The coordination node is a functional concatenation of the two ESI concepts of the facility (the DER Facility, or DERF), and the exchange (the Interfacing Party with External Responsibility, or IPER). This coordination node allows you to use a single instance as both a facility to an exchange, and an exchange to facilities.
The ESI is an interface between these two components, where it would ideally store historical data and future predictions.
If implemented, the ESI results in two distinctly different types of services:
- real time interactive requests
- dynamic responses based on configured parameters and real time, location specific electricity prices
The registry is a simple server intended to make it easy for facilities to find an appropriate exchange to engage with. The registry allows exchanges to save their information, hence allowing facilities to find them. Then, a facility can query the registry looking for specific exchange details and easily match. A registry is decentralized, and anyone can create their own registry and have exchanges sign up.
For the purposes of this demo, you will start three separate instances:
- the registry
- the facility
- the exchange
Note that both the facility and exchange are instances of the coordination node.
Create a directory in the project root directory called configs
. This is ignored by git, so you can place any of your
configuration or secret files in there.
First, you must create a configuration of your registry.
- Run
./nkn-esi registry init configs/registry
. This will create two files:registry.json
(your configuration), andregistry.secret
(your secret key). Your registry configuration is fine to share with others, but your secret key should be kept to yourself. Leave the configuration file as it is, the defaults are fine. - Run
./nkn-esi registry start configs/registry.json configs/registry.secret
. This will load your config and secret key for this particular instance.
You're done! You will now see a log print out that the registry has started.
You must now create a configuration of your facility.
- Run
./nkn-esi coordination-node init configs/facility
. - Run
/.nkn-esi coordination-node start configs/facility.json configs/facility.secret
.
You should now be at a shell terminal.
You must now create a configuration of your exchange:
-
Run
./nkn-esi coordination-node init configs/exchange
. -
Run
/.nkn-esi coordination-node start configs/exchange.json configs/exchange.secret
. -
You should now be at a shell terminal.
To sign your exchange up to a registry, you must run registry signup
, to which you will be prompted for the registry
public key. If you ever forget the public key for either your facility or exchange, you can see it in configs/x.json
,
or print it out in the terminal with info public
.
After signing up to the registry, you will see that the registry has taken your key.
By signing up to a registry, you can now quickly and easily receive potential facilities.
Your facility now needs to find the exchange. To do this, you can run registry query
on the facility shell. It will
then prompt you for the registry public key that you wish to use and a country. This corresponds to the country listed
in your exchange config file. For now, just leave the default, either by pressing ENTER or typing in 'DC'.
You will then receive a new exchange. To see the list of exchanges you have found, type in registry list
.
In the ESI, querying allows you to find exchanges based on shared or relevant details that may be important to you. In the real world, it would be likely that public keys for well known registries would be advertised by electricity utilities or other entities responsible for grid stability.
Your facility now needs to register with the exchange. Run facility request
in the facility shell, entering the public
key of the exchange. This will have the exchange send you a custom registration form. This registration form is totally
created and sent by the exchange, meaning that you can send whatever questions that may be important to your business.
To view the forms that you have, you can type facility forms
.
To register, you must now run facility register
in the facility shell, entering the public key of the exchange. This
will prompt you to answer a simple yes or no question. Either enter in Y, or just leave it and press ENTER to go with
the default.
The ESI describes the transaction process between a facility and an exchange.
- The facility creates a price map and characteristics.
- The exchange gets the facility's price map and characteristics.
- The exchange proposes an offer to the facility with their own price map.
- The facility responds to this offer, either with acceptance or their own counter offer.
To create your facility price map, run price-map create
. You can leave the defaults as they are. Similarly, you can
create your characteristics with characteristics create
. Again, the defaults will suffice.
Your exchange can now optionally view the price map and characteristics by using exchange get-interactive
. This will
then allow your exchange to view them with exchange price-maps
and exchange characteristics
respectively.
This part of the transaction is not necessary, but will allow you to get an idea of what your facility is expecting in the negotiation.
To propose an offer, run exchange propose
in the exchange shell, followed by the public key of the facility. This will
allow you to enter a new price map. You can either use the values given by the facility, or use your own.
ATTENTION: Each coordination node as an auto accept value. If you enter any price below 100, the other party will automatically accept. This shows their ability to automatically manage their own offers, as would probably be the case in the real world.
Any coordination node, whether they are operating in the facility or exchange role, can run offers list
to view the
currently available offers. This will print out some useful information like the parties involved, the price map, and
the UUID, which is used to evaluate offers.
To evaluate an offer, enter offers evaluate
, followed by the UUID of the offer. This will print the price map and ask
you if you're satisfied with it. If so, simply press YES. If not, then pressing NO will allow you to enter your own
counter offer.
If you do propose your own counter offer, you can view it the same way on the other shell by executing offers list
and
offers evaluate
.
Each offer has a status - you can view it in offers list
. Every offer has two basic properties:
- when the offer is supposed to start
- how long the offer is supposed to run for
In this demo, default values are already provided.
When an offer is due to start, it will have the EXECUTING status. When it has completed, it will have the status COMPLETED. Once a facility completes the offer, it will send a message to the exchange notifying it, together with the outcome - in which case, the exchange has the ability to signal whether it agrees with the facility's assessment.
Thank you for giving your time to read about NKN, ESI, and nkn-esi.