Lition Energy Use Case Smart Contracts
Lition is developing the only scalable public-private blockchain with deletable data features, made for commercial products. Designed with Lition's live P2P trading use case, and co-innovated with SAP.
This repository shows the solidity smart contracts for the energy use case, which is the world's first peer to peer energy trading plattform commercially available to a mass market. You can test it at https://demo.lition.de with the credentials demo / demo1234.
You need a recent version of nodejs and truffle (
npm install -g truffle) because code is a very simple truffle project
(pls check https://truffleframework.com/docs/truffle/overview for details).
Documentation of the Contract
The smart contract
EnergyStore is designed to record offers from
power plants (producers) and choices from users (consumers). Each
producer has its own Ethereum address; users interact with the
contract using the owner's (Lition's) address by delegating their
interaction to Lition.
The ethereum address that creates the contract is its owner. It is envisioned that this address is securely held by Lition.
Power plants (or conglomerates of power plants) are termed producers. It is envisioned that each producer securely holds one own address and shares this address (a hash of the public key) with Lition. Lition then calls a function of this contract to register the producer, allowing it to call another function to record offers of energy.
event BidMade(address indexed producer, uint32 indexed day, uint32 indexed price, uint64 energy)indicates that a new energy offer (bid) has been recorded.
event BidRevoked(address indexed producer, uint32 indexed day, uint32 indexed price, uint64 energy)indicates that a previously recorded energy offer (bid) is no longer valid.
These events use (essentially) the same parameters (
price instead of
aprice) as the setter functions.
EnergyOffered is emitted whenever a producer records a new energy
EnergyOfferRevoked is emitted beforehand if (and only if)
such an offer is cancelling a previous offer.
The various functions should emit events to simplify monitoring.
The registration function should allow setting a producer's capacity and the contract should not accept offers exceeding a producer's capacity.
The current time resolution for offers and choices is days; 1/4 hour may be needed in the future.
This repository is ethereum based smart contract POC for lition energy infrastructure.
Implementation is not always optimal as the main aim of this code is proof of decisions, problem highlighting. It will be replaced with highly efficient and enterprise ready blockchain solution developed by lition (see https://www.lition.io for more details).
Copyright 2018-2019 by Lition Technology AG, www.lition.io.
Special thanks to core contributor Björn Stein from Quantum-Factory GmbH, https://quantum-factory.de.
Free to use for non-commercial use under the following license: Attribution-NonCommercial-NoDerivatives 4.0 International