35
Mathematical Libraries
OpenZeppelin: Due to Solidity's native limitations in performing arithmetic operations securely,
OpenZeppelinβs libraries were incorporated. The OpenZeppelin SafeMath library was used to prevent
common errors like overflows and underflows during mathematical operations, ensuring the integrity
of contract logic.
Front-End Development
React JS (v17.0.1): React JS was chosen for building the front-end interface for interacting with the
deployed smart contracts. This framework provides a dynamic and modular approach to developing
user interfaces, enabling seamless integration with Web3 libraries for blockchain interaction. It allows
users to interact with contracts deployed on the Optimistic Ethereum network in a user-friendly
manner.
5.2 Smart Contract Development
The development of our smart contracts focuses on managing energy transactions and tracking
renewable energy certificates using a decentralized, blockchain-based system. These smart contracts,
written in Solidity, facilitate the creation, trading, and verification of VPPAs. They ensure
transparency, traceability, and trust between energy producers (sellers) and buyers, while adhering to
the principles of decentralization and security. They smart contracts were deployed on the Rinkeby
test net and evaluated.
5.2.1 Constraints and Conditions
In our smart contract system for energy trading and PPA creation, various constraints and conditions
govern how contracts are created, validated, and executed. These constraints are crucial for ensuring
the system's integrity, fairness, and compliance with energy transaction rules. Below, we describe
these rules mathematically, highlighting the logic behind energy trading and PPA creation.
1. Contract Creation Constraints:
For a contract cc, certain conditions must be met to ensure it is valid and executable. These conditions
focus on the seller's available energy and the price per kilowatt-hour (kWh).
Energy Availability Constraint: The sellerβs available energy scsc must be less than or equal to the
amount of energy
π
π
offered in the PPA.
π
π
β€ π
π
2. Price Constraint:
The agreed price
π
π
in the contract must be greater than or equal to a minimum price
πππ_πππππ set
by the system. This ensures that all contracts respect a base market price and avoid exploitation.
π
π
β€ πππ_πππππ
Together, these constraints ensure that sellers do not promise more energy than they can provide and
that contracts maintain market price integrity.
3. Energy Transaction Validation: