Introducing the Opinionator

Jonas Bentke
slock.it Blog
Published in
7 min readAug 21, 2019
Image by Gerd Altmann from Pixabay

The DAO marked a milestone in the history of slock.it, but also brought to light many questions that the Ethereum community hadn’t fully considered before. One of the biggest questions is: How should we make decisions that affect hundreds of thousands of people? We at slock.it have been working on an opinion collection tool to capture the views of the community based on all the available information on the Ethereum blockchain.

Why We Need It

Currently, many voting tools used in the community weight your vote based on the amount of Ether you possess. This might work well to get a first glance of what investors want, but it does not capture the whole picture. Although it’s generally acknowledged that oligarchies are not an ideal way to govern a public good, there are still many stakeholders that are not considered in the voting process. Let’s look at an example:

Alice is a student currently studying in beautiful Mittweida, trying to finish her master’s degree in distributed ledger technology. During her free time, she creates a contract that enables users to play a game based on the Ethereum blockchain. She does it for fun, not for profit. The game takes off and thousands of people start using her contract. Alice does not have tons of Ether lying around to make a difference in a coin based vote, but she certainly has a lot to lose if the blockchain changes in a way that will affect her players.

Now have a look at Bob. He knows Alice and tells her about an open-source smart contract library that he wrote and deployed to the mainnet. Alice decides to use this library in her blockchain game. Bob doesn’t have much Ether, but a lot of people use his library. Shouldn’t he have a say in what’s going on?

Moreover, what do all those casual gamers have to say? They don’t hodl — they spend their Ether to play the game and drive the chain through the gas they spend. Surely, they also should have a say.

That’s why we developed the Opinionator.

What can it do

So, what does the Opinionator do differently from all the other voting tools out there? For starters, we don’t view it as a voting tool, but as an opinion collection tool. Furthermore, it considers a lot more than just the amount of ETH you have.

Looking back at Alice and Bob, we can see that counting Ether does not really help them get their opinions registered. But what does? Alice and Bob are developers whose contracts are used hundreds of times a day. People are spending money to use those contracts. Why don’t we measure that?

That’s exactly what we did. We developed a tool that measures the weight of your vote based on four main attributes extracted from the blockchain: the amount of Ether you possess, the amount of gas you’ve spent, the amount of gas spent using your contract, and the accumulated difficulty you’ve solved for creating a block. Here is a quick rundown on what each of these four components means:

  • Amount of Ether you possess. Although the weight of your vote isn’t based primarily on how much Ether you have, it is still a factor that needs to be considered while making decisions.
  • Amount of gas you’ve spent. If you actually use Ether the way it was designed to be used, why should you have less of a say than someone who is just hodling? Every unit of gas ever spent by an address is accumulated and used to weight your vote.
  • Gas spent on your contract. This is where Alice and Bob really shine. They created value and usability for the network, which will reflect in their voting power. The Opinionator dissects every trace in every transaction and finds the gas value spent on your contract. If Charlie uses Alice’s contract, which then calls Bob’s library, the gas spent on the library call will be counted toward Bob, the rest toward Alice, and Charlie gets the total amount of gas spent for himself.
  • Accumulated difficulty. Without our miner friends, nothing would go, so let’s let them have a say. Since it was way easier to solve a block early in Ethereum’s history, we can’t simply count the number of blocks found. Instead, we measure the difficulty the miner had to solve to create the block.

How can I use it

At this point, you may be wondering: “What does a vote actually look like? Do I have to spend money to vote?” No! Voting is free. Here is what you do:

First, go to voting.slock.it and pick a poll and then click on “Click here to vote”.

Choose what and how you want to sign. The most straightforward method is to use MetaMask. If you don’t use MetaMask, you can sign the vote yourself and paste your address and the signature of the vote into the appropriate fields.

Click the Sign button to complete your vote.

You will get a receipt (explained below) and then you’re done!

How you sign the message is totally up to you. One easy way is to use myetherwallet.com since it supports all common ways to import your precious private keys.

“But how can I trust that you are actually using my vote when you store all the votes off-chain?” We’ve got you covered. With the current system, it’s not very convenient to store every vote on-chain, but we made sure you can prove we counted your vote.

Here’s how it works. Each vote is made public through our API, where you can find all given votes. To make sure the numbers reflect your vote, we give you a signed receipt. That receipt is simply your signed vote signed by us. That way, we show you we received your vote and ensure you can’t just claim to have voted even when you didn’t (trust goes both ways). With this information, you can count the votes yourself since all the necessary information to prove or disprove is now public.

You can also create your own polls. Polls and proposals are stored on the blockchain, which means that this will create transaction costs for you. You can create simple yes/no polls or craft your own proposals. Once you create a poll, you can use the admin functions there to create your proposals (for those that aren’t yes/no polls).

One last word about the start and end date of a poll. If you leave the start date blank, it will start straight away. If you leave the end date blank it will never end. As soon as a poll ends, no one will be able to vote on it again.

How did we do it

The Opinionator consists of 4 crucial parts.

  1. The Importer
  2. The Database
  3. The Backend
  4. The UI

We used Parity Ethereum as our Ethereum client. (It is not as easy as you might think to run a full archive node. If you want to know more, read the blog post by our Big Data Guru, Markus.)

The first step is to get all that blockchain data into the database. For this, we wrote an importer that takes every block apart, sorts it, and writes it to the database. For this, it requests the data via IPC from the Parity node. First, we take the block and parse out each transaction, including its traces. All of that is then stuffed into the MongoDB database. That data can be retrieved by our backend, which uses some huge queries to get what we want. After a lot of database optimization, we got it down to usable response times. Just to give you a glimpse of what we have to do: To get the amount of gas spent on a contract, we must find every trace that addresses the contract and subtract every subsequent trace from it.

The backend is giving us the raw data from the database. That is useful but doesn’t go far enough. So we wrote a user interface that enables you to visualize that data in as many ways as you want. You want to know how the poll turned out when you split the weight evenly with 50% importance tied to Ether holdings and 50% tied to gas use? Or what happens when you configure the weights to 10% Ether, 47% gas, 38% developer, and 5% miner? The Opinionator can show you all of that, ensuring you get the whole picture of who wants what. If you think your poll is more important to developers, check out what they say. If you think it’s only important to miners, have a look. It’s that simple.

Conclusion

That’s it. Now you can find out what people think in the Ethereum community. Share the URL from your poll via social media to make sure your followers know what’s going on, and you are set to go.

--

--