Wetonomy’s Tools & Libs Ecosystem

Maya Mateva
Coinmonks
6 min readOct 11, 2018

--

Wetonomy is a toolkit that streamlines the creation of a DAO allowing teams, companies, and organizations to collaborate, share profits, finance ideas and award contributions. If you are not familiar with it, check out my blog post for an intro, our beautiful website or better (if you are a dev) — our GitHub repo.

In this post, I will sketch a little bit the tools/framework/languages we are using just to get you a brief idea on the ecosystem that wraps up the project. Ordered alphabetically, here comes the list.

Aragon

Aragon is a great platform that enables building organizations on Ethereum and deploying DAO-s to the blockchain (thus, natively fitting into the Wetonomy purpose). It implements organizational features such as governance, fundraising, payroll, and accounting. Moreover, it allows you to create your own apps on top of it and extend the functionality for your own DAO. Aragon provides a couple of pieces that you can use — aragonOS (smart contract framework), aragon.js (lib for interacting with the state of the dapp) and aragonUI (components for building the UI of the dapp). Check out their constantly improving docs for more info.

Bonus note — Aragon has a pretty good dedicated and enthusiastic community (❤)

IPFS

IPFS is a peer-to-peer distributes file system that connects all computing devices with the same file system. It’s similar to a single BitTorrent swarm that exchanges items within one Git repository. What IPFS does is it gives each block of data a unique hash, removes duplicates and then each network node can store the content it needs and search for it by human-readable names provide by IPNS.

Both Aragon and OrbitDB counts on IPFS so it’s more or less essential for Wetonomy (and actually for the whole blockchain world).

Lerna

Lerna is a tool for managing a JavaScript project with a lot of dependencies. Once set up in a project, it will go through each app inside it and symlink its dependencies to the local version encountered in thepackages (downloaded based on the info from packages.json). All those that are not found in the packages will be installed through npm as they would anyway.

Wetonomy uses the following scripts:

The mainly used one is, of course, bootstrap — once executed, it will install all dependencies and link cross-dependencies in the current Lerna repo. Thus, the need for running npm install in every app and taking care of the packages is reduced to just running a simple command.

MetaMask

MetaMask is a plugin that allows you to run Ethereum transactions from the browser through a simple UI.

It injects a JS lib — web3.js — into each loaded page and thus enables reading and writing requests on the blockchain. You can sign transactions, change the network (from the main Ethereum one to test one — Ropsten, Rinkeby, localhost, etc.), create or import accounts.

What’s more, MetaMask allows a user to define the Ethereum node for sending the requests (so, there is no need to download the whole node (a lot of GB blockchain) to your own computer).

OrbitDB

OrbitDB is a great peer-to-peer database — every user has his/her own instance of it and all updates of the db are automatically synced between all peers. As opposed to the classic client-server model where the database is stored in a single place, OrbitDB keeps the data stored throughout the users. Once someone wants to have access to it, he/she needs to subscribe to that db instance and gain access (if required).

OrbitDB supports various data models and use-cases — log (append-only structure), feed (append and remove model), key-value store (dictionary-like structure), docs (document database), counter (useful for counting events).

Wetonomy follows the feed model — all items can be added, searched for and removed. Its initialization is set in a corresponding store (following the reflux conventions) and is something like:

React — Redux — Reflux

React is a JavaScript library for building interactive user interfaces. It makes it quite easy to create simple views for each state of the app and then handles the rendering and updating of the UI based on the data changes.

A simple component looks like:

In this case, MemberFormBase is another simple React component that can be reused wherever needed. Its behavior is dependent on the methods and properties bound to the corresponding properties of the component.

And as component logic is in plain JavaScript rather than templates, you can easily pass rich data through your app and keep the state out of the DOM.

Redux is a state container for JS apps which runs in different environments, is easy to test and simplifies the behavior of complex components. It sets certain rules to the UI behavior — the state is read-only, one store is responsible for one action, all changes are made through a simple JS function.

Reflux is again a JS lib for introducing a consistent flow of the data — once an action is executed, the corresponding store reacts based on its type and passes the required data to the UI (view components).

Solhint

Solhint is an open source project (lib and cli) for linting Solidity code. Unlike most of the other options, it ensures that not only the best coding practices are followed and the syntax errors are discovered, but also it detects any security vulnerabilities.

Once you install it, you can configure its rules and ignored files in the corresponding .solhint.json and .solhintignore files.

Linting command for Wetonomy:

Solidity

Solidity is the language to choose when you need to write smart contracts. It is statically typed, supports inheritance, libraries, and complex user-defined types and is designed to target the Ethereum Virtual Machine (EVM).

And, of course, all smart contracts in Wetonomy are written in Solidity.

Travis

I’m pretty sure that almost everybody knows what Travis does, but in case you don’t — it ensures the continuous integration (CI) for a GitHub repo and runs the tests in its own virtual environment. Once set up, it automatically builds and tests the changes and returns a feedback immediately — whether what you have committed is ok or not.

Its site provides a pretty good Getting Started article that you can follow and ensure your app also fits into the CI procedures. Considering Wetonomy, its .travis.yml file looks something like:

Travis will execute the steps in the following order:

  • before_install — the stage for installing additional dependencies required by a project
  • install — runs all installation commands — in the case of Wetonomy npm install for the main folder and then the Lerna bootstrap command for syncing the dependencies across the inner apps
  • before_script — command run before the script — in this case,npm prune clears the extraneous packages from the app
  • script — the most important command — the one that runs the tests or whatever else you need (in Wetonomy — linting the project as well)

Truffle

Truffle is a tool/framework that facilitates developing, deploying and testing smart contracts. Once you install it, you will get the built-in compilation, deployment, migrations history, network and package management, a console for executing its commands. All in all, everything you need (so far) for developing smart contracts without the need to set up all dependencies, deployment specifics and so many other things that I guess nobody will want to bang his head on his own.

You can test its functionality right away in Wetonomy by simply executing in an app:

It will run the tests in the corresponding Aragon app.

So far, this is a brief intro on the stack we are using. Next post coming up will be about why we chose Aragon and why we love it.

Still, in case you have any questions, come and join-collaborate-suggest in our Discord chat.

Originally published at wetonomy.com on October 11, 2018.

Get Best Software Deals Directly In Your Inbox

--

--