1. 程式人生 > >Introducing shastaOS: The architecture empowering energy freedom.

Introducing shastaOS: The architecture empowering energy freedom.

The operating system that empowers the energy market freedom.

What’s ShastaOS?

ShastaOS is a module containing all the logic and ideas around Shasta, implemented in Solidity, the language that powers Ethereum smart contracts. With it is possible to make the energy market more free and accessible than ever.

The module can be imported for anyone to interact with ShastaOS via your Truffle project, add new functionalities on the top of Shasta, or even create a new interface for Shasta via Web3.

You can jump into the first alpha release of ShastaOS and see the source code in the following Github repository:

https://github.com/Shasta/ShastaOS

Inside ShastaOS v0.1 Alpha

This initial and experimental release contains all the needed work to let the world interact with the core ideas around Shasta platform. The current system allows consumers and providers to registry into Shasta platform, makes it possible to energy providers to create energy offers and allows consumers to apply to these offers and create a contract between the consumer and provider.

What’s inside Shasta OS?

BillSystem.sol

The bill generator generates a bill between a user and a producer, linked with an energy contract. The billing system support Ether and any ERC20 token, making it possible to make payments using stable coins like Dai by MakerDAO or USDC, a fully collateralized fiat stable coin by Circle.

Once the user pays the bills, the smart contract holds the ERC20 token until the energy provider decides to withdraw his balance. Here is a Solidity example of how multi-ERC20 wallet works.

ContractRegistry.sol

This smart contract manages the storage of the accepted offers between a consumer and provider. In this contract, you determine what ERC20 will be used for payments between the two parties. It allows appending more metadata into the contract via IPFS, referencing the IPFS hash into the energy contract.

ShaLedger.sol

The testnet Sha token follows the ERC20 standard but has also implemented the approveAndCall function, allowing consumers to accept a prepaid contract and pay to the energy consumer, with only one Ethereum transaction. This is only a dummy token to use in the Alpha for paying energy bills.

ShastaMarket.sol

The ShastaMarket currently manages a store of all the energy offers, allowing the frontend to filter and show the better offer based by the consumer requirements. This smart contract also supports adding more metadata to the energy offer via IPFS, for example, providing extra details to the consumer about the origin of the electric energy, it is removable or not, or where is the energy plant located.

User.sol

Maintains a registry of consumers and energy providers. Allow consumers and producers to registry into Shasta platform, and each user information can be extended thanks to IPFS.

The development tools

I must start saying thanks to the Ethereum development community and Consensys team for all the tools, documentation, secure code patterns and resources that make possible to develop decentralized applications.

The current Alpha platform is made thanks to Solidity, Truffle, Ganache, OpenZeppelin secure framework, IPFS, Web3.js, React and Drizzle. You can check here a more in-depth post about the first alpha release of the Shasta platform, named “Diving into Shasta”, by Ignasi Ramos.

What’s next about ShastaOS?

Integration with Aragon OS

The main goals of the Shasta platform are to be fully compatible with Aragon organizations, implement voting mechanics to determinate the energy price and be able to communicate with other decentralized applications via a secure ACL system, so we are currently integrating the Aragon OS framework into our current smart contracts.