36
For an energy transaction
𝑡 to be valid, it must satisfy specific conditions involving both parties'
registration statuses and the availability of energy for the transaction.
The transaction t is valid if the allocation function
𝐴(𝑝, 𝑐) which denotes the amount of energy from
the producer
𝑝 in contract 𝑐 is greater than or equal to the energy requested in the transaction 𝐸
𝑡
.
Additionally, both the producer and the buyer must be registered in the system.
𝑉𝑎𝑙𝑖𝑑(𝑡) = 1 𝑖𝑓 𝐴(𝑝, 𝑐) ≥ 𝐸
𝑡
𝑎𝑛𝑑 𝑅𝑒𝑔
𝑝
= 1 𝑎𝑛𝑑 𝑅𝑒𝑔
𝑏
= 1
Where:
𝑅𝑒𝑔
𝑝
and
𝑅𝑒𝑔
𝑏
are the registration status of the producer and buyer, respectively, and both
must be equal to 1 (i.e., both parties must be registered).
5.2.2 Contract Structure
The system is modular, designed to handle distinct responsibilities through separate contracts. This
modular approach enhances the maintainability and scalability of the overall system. At its core, the
system includes two main components:
ProducerRegistry: This contract is responsible for managing the registration of energy producers.
Only registered producers can create and offer energy contracts, ensuring that only verified entities
can participate in the marketplace. Producers can register and deregister themselves, emitting relevant
events for transparency (
producerRegistered
and
producerDeregistered
).
PPABuyerRegistry: This contract automatically registers buyers who purchase PPAs, assigning
them a unique identifier (buyer ID). The contract ensures that only verified buyers can claim or
purchase PPAs, enabling secure and controlled transactions.
Algorithm for registering and deregistering a buyer or producer:
Step 1: Algorithm RegistryManagement
Step 2: If producer or buyer wants to register then:
Step 3: If entity is a producer:
Step 4: Call registerProducer()
Step 5: Add producer to producers mapping
Step 6: Emit producerRegistered event
Step 7: End_if
Step 8: If entity is a buyer:
Step 9: Call registerPPABuyer(buyer)
Step 10: Increment buyer ID
Step 11: Add buyer to ppaBuyers mapping with ID
Step 12: Emit buyerRegistered event
Step 13: End_if
Step 14: End_if
Step 15: If producer or buyer wants to deregister then:
Step 16: If entity is a producer:
Step 17: Call deregisterProducer()
Step 18: Remove producer from producers mapping
Step 19: Emit producerDeregistered event
Step 20: End_if
Step 21: If entity is a buyer: