Diving into Shasta

Ignasi Ramos
Shasta
Published in
5 min readOct 8, 2018

One of the most freaking awesome applications of blockchain is the ability to decentralize entities. We are currently living in a system where nothing belongs to us even though the real owners make us believe the opposite. We don’t have money, the banks have. We don’t have properties, the governments have. We don’t have markets, the big companies have.

Decentralization allows individuals to truly own their money and make with it whatever they want, it allows them to participate in the parliament or to participate in company decisions that concern them and affect them directly. Those affected by the consequences will decide the causes.

Captain Fantastic

The purpose of this blog is to present a way — developed by the Shasta team — to decentralize the archaic world of the energy markets. It is recommended to read the introduction post because in the following blog the techie side of Shasta will be explained. Detailing the entire Shasta project may take a few blogs, so only the platform’s technologies will be explained here.

Shasta is built on the top of the Ethereum Network. Managing smart contracts makes this network totally fit with the purpose. The main smart contracts that make Shasta work are currently deployed in Rinkeby test network. I always say that deploying a contract to Ethereum is like installing a software to the internet, while what we actually want to do is to install an entire OS to the internet.

These smart contracts are currently managing the transactions of energy between energy producers and consumers (without intermediaries!). However, in our roadmap, we will implement a sophisticated mechanism of governance where the market will be regulated by the participants themselves.

What can I do with Shasta?

Shasta will allow you to:

  • Create your energy organization or join to Shasta organization
  • Exchange energy without intermediaries
  • Make energy contracts in a friendly interface and in an easy way
  • Reach consensus with other participants to decide prices, rules, new features
  • Make the organization improve and evolve!
  • See in real time your energy benefits or expenses

The data storage: IPFS + Ethereum

The project is still at a very early stage but it is conceived to be 100% decentralized. Ethereum is very useful for transactions and smart contracts, but it has some limitations — for now — when it comes to managing data and identity.

With Ethereum we remove the need for servers, avoiding from the design stage all the problems associated with censorship. With IPFS and its permanent web infrastructure, we ensure the access to information through a planetary-scale information network without central points of failure and bottlenecks.

We can distinguish between two kinds of data. The user data is decided by the user and is not critical; the name or the city of the user, for instance. This data will be stored in IPFS. A JSON with all the user data is created and updated by the users. For each update, a new hash is stored in a smart contract’s map. It is very important to distinguish between the metadata (stored in IPFS) and the critical data (stored directly in the blockchain): if you store unnecessary information in Ethereum, the application won’t be scalable because of the gas cost. On the other hand, if you store critical data on IPFS it won’t be immutable; the owner account will change the stored hash with altered data.

Uploading data to IPFS and updating in the blockchain

The above image is a snippet of the code that uploads data to IPFS and updates the hash on the smart contract (it is out of context, so you can use it for inspiration and better understanding, not for copy paste to your project). As you can see, we use Infura as the gateway.

The development environment: React + Truffle + Ganache + Drizzle

The Shasta platform that interacts with the smart contracts is developed in React. React is a very comfortable UI development because is flexible and provides hooks that allow us to interface with other libraries and frameworks, for example, Truffle and Drizzel.

Why Truffle + Drizzle + Ganache?

These libraries are the ones responsible for merging the ShastaOS with the platform. They easily allow the interaction between the frontend and the deployed smart contracts.

An example of the frontend interacting with the smart contracts could be when the user creates an offer:

The frontend interacting with Ethereuem

The main reasons we use them are:

  • Includes support for custom deployments, library linking and complex Ethereum applications.
  • Writes automated tests for smart contracts in both JavaScript and Solidity, and gets the contracts developed quickly.
  • Open source
  • We like how they work

Metamask: managing the transactions

Metamask is the most user-friendly way to allow users to make a transaction or call a smart contract function. It is very well integrated with web3 and a lot of people are already used to it in the ecosystem.

To use the platform, you must have the extension installed on your browser and pointing to Rinkeby.

Shasta structure

Alpha 0.1 release

The 0.1 release is on air! You can take a look at it here:https://github.com/Shasta/Shasta

We are only at the very beginning of our roadmap so our plan is to continue improving and adding features to the platform. In a near future, we hope you will contribute with us with an idea, proposal, pull request, advice… that would be awesome! For the project to be as resilient as possible, the development of the project should not be controlled by a single central entity. It should be in the hands of the community and multiple different development teams. Wanna join?

Ignasi Ramos

--

--