PowerChain - Blockchain 4 Energy

27
1 POWERCHAIN Building Blocks to establish a Distributed Grid with a light weight P2P energy market.

Transcript of PowerChain - Blockchain 4 Energy

Page 1: PowerChain - Blockchain 4 Energy

1

POWERCHAIN

Building Blocks to establish a Distributed Grid with a light weight P2P energy market.

Page 2: PowerChain - Blockchain 4 Energy

2

POWERCHAIN

Collection of Smart Contracts implemented for Ethereum Blockchain…

Page 3: PowerChain - Blockchain 4 Energy

3

Node

Termination

Meter

MeteringPower

Delivery

POWERCHAIN

… working together to build a common consense based power grid and market.

Page 4: PowerChain - Blockchain 4 Energy

4

POWERCHAIN

Content1. Building Blocks 2. Use Cases 3. Best Practice

Page 5: PowerChain - Blockchain 4 Energy

5Node

Meter

Metering

Power Delivery

POWERCHAIN

Termination

Page 6: PowerChain - Blockchain 4 Energy

6Node

Meter

Metering

Power Delivery

POWERCHAIN

Standarized Representation of a power transmission from a Producer [Node]to a Consumer [Node].

Time Frame of Delivery (Start/End) Power (Total Wh, Min W, Peak W) Termination check Value (Money)Termination

Page 7: PowerChain - Blockchain 4 Energy

7Node

Meter

MeteringPower

Delivery

POWERCHAIN

Contract for Grid-End-Point operation owned by DSO

Manages approved Meter Operators [Metering] Manages a list of Producer/Consumers [Node] Manages a list of peers to other Grids

[Termination]

Termination

Page 8: PowerChain - Blockchain 4 Energy

8Node

Termination

Meter

MeteringPower

Delivery

POWERCHAIN

Legal, Managed Entity connected to a grid as End-Point

Is able to sell or buy power [PowerDelivery] Has a connection to the grid [Termination] Has a approved Meter [Meter/Metreing]

Page 9: PowerChain - Blockchain 4 Energy

9

POWERCHAIN

#USECASES (Basics)

Page 10: PowerChain - Blockchain 4 Energy

10

POWERCHAIN

UC1: Setup Grid

The smallest possible grid is a Termination with an approved Metering …

metering = instanceByName('Metering');termination = instanceByName('Termination');termination.addMetering(metering.address);

Page 11: PowerChain - Blockchain 4 Energy

11

POWERCHAIN

UC2: Adding a Producer and a Consumer Node

In order to exchange power two Nodes are required.

For the moment both connect to the same Termination which accepts only one Metering.

params =[metering.address];nodes.A = instanceByName('Node',params);nodes.B = instanceByName('Node',params);

Metering assigns two new Meters to those Nodes and adds to Termination.

meters.A= instanceByName('Meter', [0,true]); // Initial Reading 0 – Does Feed In to the grid (=true)meters.B= instanceByName('Meter', [7,false]); // Initial Reading 7 – Does Feed Out of the grid (=false)metering.addMeter(meters.A.address,nodes.A.address);metering.addMeter(meters.B.address,nodes.B.address);

termination.addNode(nodes.A.address);termination.addNode(nodes.B.address);

nodes.A.transferTermination(termination.address); nodes.B.transferTermination(termination.address);

Page 12: PowerChain - Blockchain 4 Energy

12

POWERCHAIN

UC3: Update Meter Readings

Metering provides an oracle by updating periodically readings of Meters.

As consequence of updateReading() all active PowerDelivery contracts of the affected Nodeget balanced to the current reading.

metering.updateReading(meters.A.address,new Date().getTime(),123); // Sets Current reading of Meter A to 123metering.updateReading(meters.B.address,new Date().getTime(),456); // Sets Current reading of Meter B to 456

updateReading() processPowerDelivery() updateReading()

balance

• Last Reading• Power Debit• Power Credit

Page 13: PowerChain - Blockchain 4 Energy

13

POWERCHAIN

UC3: Update Meter Readings (cont…)

updateReading()

• Last Reading• Power Debit• Power Credit

Last ReadingActual readig of Meter

Power Credit Power units (Wh) measured and covered by power delivery contracts

Power Debit Power units (Wh) measured but not covered by power delivery contracts

Condition: (Last Reading – Initial Reading*) = Power Credit + Power Debit

*) Initial Reading is reading of Meter as given in new Meter tx: instanceByName('Meter', [7,true]); // Initial Reading=7

Page 14: PowerChain - Blockchain 4 Energy

14

POWERCHAIN

UC4: Creating a Power Product

In order to trade on a market a product needs to be available having a common specification of the asset. PowerDelivery contracts hold a common specification for a „power product“. As every Node needs to follow this standard it could be traded/exchanged.node.createOffer( bool _is_feedin, // Perspective of Node (Is Feed-In or Feed-Out) uint256 _time_start, // Start of Delivery uint256 _time_end, // End of Delivery uint256 _total_power, // Total Power in Watt-Hours uint256 _peak_load, // Max-Load in Watt uint256 _min_load, // Min-Load in Watt uint256 _bid // Bid of creating Node (Monetary Value));

node.createOffer() New ProductDelivery()

Page 15: PowerChain - Blockchain 4 Energy

15

POWERCHAIN

UC5: Signing a Power Delivery (Contract)

A power delivery contract could be signed by any other Node. During signature process it is checked if Termination (physical connection) is possible.

node.signSellFeedIn(PowerDelivery.address,_bid); // _bid = counter offer needs to be better or equal… node.signBuyFeedOut(PowerDelivery.address,_bid); // _bid = counter offer needs to be better or equal

PowerDelivery contract accepts changes of counter bid until starting time of delivery.

Page 16: PowerChain - Blockchain 4 Energy

16

POWERCHAIN

#BESTPRACTICE

Page 17: PowerChain - Blockchain 4 Energy

17

POWERCHAIN

#Blockchain - Consense

In general a Blockchain holds an „universe of common truth“ = Consense

Node

Termination

Meter

MeteringPower

Delivery

Shared Truth

Page 18: PowerChain - Blockchain 4 Energy

18

POWERCHAIN

#Blockchain - Visibility

• All transactional data is public within its chain• Mining provides confirmations of transactions

MeterPower

Delivery

Meter

Producer Contract Consumer

If all transactions get confirmed, we do not need to identify „Producer“ or „Consumer“ to ensure consense.

“On the blockchain, nobody knows you're a fridge”

Page 19: PowerChain - Blockchain 4 Energy

19

POWERCHAIN

#Blockchain - Transactionalization

• Storing data in a blockchain is expensive• Each transaction costs a fee (or gas)

MeterPower

Delivery

Contract Consumer

Provides sub-second readings

Might be one single transaction

MeteringProvided oracalized data as required

Page 20: PowerChain - Blockchain 4 Energy

20

POWERCHAIN

#Blockchain - In/Off Chain

• Transactional Data is required in chain• Operational Data is required off chain

Power Delivery

MeteringProvided oracalized data as required (In Chain)

Termination Operational Data on Request (Off Chain)

Page 21: PowerChain - Blockchain 4 Energy

21

POWERCHAIN

#Blockchain - Off Chain

• Offchain transactions like data exchange can still be part of a single shared truth• EDIchain is a framework to exchange EDI messages via a Blockchain

MeteringTerminationEDI Message

CONTRL/APERAK

Metadata

Business Content (EDI Document)

HASHOn Chain (Frontend)

Off Chain (Backend)

Page 22: PowerChain - Blockchain 4 Energy

POWERCHAIN

#Smart Contract

• Simple rule based transaction trigger.• Or: Changing the state of a machine (blockchain) based on conditions.

Power Delivery

If all prerequisites are met…

feed_in=Node(msg.sender);

… sending Node becomes Producer

Page 23: PowerChain - Blockchain 4 Energy

POWERCHAIN

#Smart Contract

• The code is the rule• Once published the rules can not be changed.

Termination

The test() function is called as soon as a Node wants to sign a PowerDelivery.

For the owner of a Termination it might be good to keep record of all tests…

tests.push(_delivery);

… as this would change a value this function „call“ becomes a transaction (=requires Gas).

Page 24: PowerChain - Blockchain 4 Energy

POWERCHAIN

#Smart Contract

• Use „Events“ for monitoring instead of transactions

tests.push(_delivery);

contract Termination {…event TestTermination(address _sender,address _target);…function test(Node _delivery,Termination callstack) returns (bool) {

TestTermination(msg.sender,_delivery);…}

Page 25: PowerChain - Blockchain 4 Energy

POWERCHAIN

#Smart Contract

• The code is the rule• Once published the rules can not be changed.

Termination v1

As v1 is available within the blockchain „forever“ there needs to be a sunset function right from start

Termination v2

Page 26: PowerChain - Blockchain 4 Energy

POWERCHAIN

#Node (Blockchain)

• Never trust a Node … trust transactions.

meters.A= instanceByName('Meter', [0,true]);

Everyone could create a Meter

But it requires a Metering to add it.

metering.addMeter(meters.A.address,nodes.A.address);

Contract Metering { function addMeter(Meter meter,Node _node) { if(msg.sender!=owner) throw; … }}

Everyone could create a MeteringBut it requires a Termination to accept it.Everyone could create a PowerDelivery But if there is no Termination (peering) between both parties it will not be possible to sign.

Page 27: PowerChain - Blockchain 4 Energy

27

POWERCHAIN

Hackaton: https://hack.ether.camp/#/idea/let-ethereums-blockchain-become-the-backbone-for-energy-markets

GitHub:https://github.com/zoernert/powerchain

Community:http://ossn.stromhaltig.de/