Decentralized Solar Using Blockchain Technology

Simon Balean
FullStacked
Published in
5 min readAug 25, 2019

--

(part 3 of 4)

Blockchain Smart Contracts

Adoption of blockchain projects in energy sector will lead to the development of cryptocurrencies for digital monetary exchanges. A significant number of utilities are already advocating for digital transactions. For instance, the Marubeni Corporation allows digital payments in some parts of Japan. In South Africa, Bankymoon and Usizo are implementing cryptocurrency payments using bitcoins in remote areas in the country.

Smart contracts are computer programs meant to control transfer of cryptocurrencies and assets between two parties following predetermined conditions. They are also referred to as crypto- contracts and are placed within the blockchain technology to work autonomously. They offer solutions for Contract Lifecycle Management (CLM). Smart contracts are created by the scripting feature in blockchain, used to verify contractual agreements, and are run by a self-enforced code in the system computers. The logical structure has three entities which are clarified to be the suppliers — energy producers, retailers — the respective energy consumer, and the logistics providers — management that channels the energy from the producer to the consumer. Abstractly, the logistics provider issues an arrival statement, a produced signature, and requests a contract signature to the energy producer and then the energy consumer. This will verify that the supply and demand both entities are verified.

Smart contracts need to be executed by a neutral intermediary. This makes blockchain networks a suitable platform for such executions due to transactions in the blockchain that are recorded in an unbiased manner allowing transparency and honesty. Distributed ledgers employ a decentralized verification approach, which makes it more suitable for smart contract execution to occur. The program is run by every computer or node in the blockchain.

Since smart contracts are executable computer programs, the need to include all the terms of agreement between the participating parties. They are coded and initiated in all the nodes in the distributed blockchain network and executed to main transactions across the network without the disruption of a middleman. They aide in achieving a transparent, traceable and modification- free transaction within the network, which leads to achieving trust in the network.

Bitcoin Smart Contract Platform

The world of blockchain comprise of two different worlds Bitcoin-like systems and Ripple-like ledgers. The two worlds are brought together by a common technology i.e. the Replicated, Shared Ledger. This common architecture employs the idea that each party in the system has a copy of the entire ledger synced by an unbiased mediator system. As seen in the figure below, a sequence of digital signatures where each stakeholder makes transfers by digitally verifying and signing a hash of the previous transaction’s private key.

Infrastructure of a Bitcoin transaction

Ripple-like systems focus on the representation of “off-system” secured by entities which are identifiable. The security is based on identifying each participant and discipline measures are taken on the account that the system recognizes each participant. Systems similar to Bitcoin focus on “on-system” assets and are secured by an anonymous pool of participants. This security is achieved by incentive structures making it the interest of each participant to do what is right.

The fundamental building block for Bitcoin is the concept of “Unspent Transaction Outputs” (UTXOS). This is when one party gets what another party pays an individual a certain number of Bitcoins as an output of the transaction. Therefore, Bitcoin systems can be viewed as a pool of UTXOs i.e. all the payments received by the users and not yet spent.

Each UTXO has an identifier and a value showing the number of bitcoins represented in the UTXO. It is limited to the owner of the address to where it was sent. UTXOs are similar to computer programs in the ledger, controlling access to bitcoins and execute in response to specified events. An individual to spend money controlled by such contracts, he or she has to provide data to be processed by every node in the system and all the nodes have to return TRUE value for the transaction to be executed.

Spending money on bitcoin is done by requesting the platform to run the program provided and then feeding the output to the smart contract where the money is stored. If the smart contract runs correctly then the money can be spent. In this system the program provided by the user is “ScriptSig” and the UTXO program is “scriptPubKey”. The user provides the “scriptSig” and the output is fed to the “scriptPubKey” to check if it returns “TRUE”.

The “scriptSig” represents the user’s private key or digital signature that is fed into the system to generate the public key. Payment is received by creating a scriptPubKey that can only be executed by the person being paid. The program originally run by the payer is replaced by a program that can only be run by the payee.

Ethereum Smart Contract Platform

Blockchain technology developed Ethereum to be used as a platform for smart contract execution. The program in Ethereum platform is coded using a Turing language Solidity compiled in a stack-based byte code that is represented.

Infrastructure of an Ethereum transaction

This includes an in-build virtual machine emulating the role of a distributed computer. As a transaction is requested, the network of nodes analyzes the control parameters and digital signature that would validates the transaction.

Ethereum is the widely used platform for developing smart contracts as it provides a wider processing capability. The code written in Ethereum has the terms of agreement between the trading parties and exists throughout the distributed network.

These smart contracts are used to facilitate delivery versus payment (DvP) used in complex trading transactions. In DvP, Ethereum smart contracts are run to ensure the delivery is made to the right user prior to fulfilling a set agreement and resulting releases payment to the person who had issued the smart contact.

part 1 | part 2 | part 3 | part 4

--

--