Tenderfeud was built out of our fascination with the blockchain's ability to use real economic incentives to extract knowledge from the crowd. Transparency, combined with native economic value create a very powerful participation dynamic We believe that this dynamic will underlie all DAOs in the future.
The internet gave everyone a voice. The blockchain gives everyone the economic incentive to use them.
On a less lofty note, we've wanted to try using Tendermint for a while; modular blockchains are probably also the future :).
What it does
Tenderfeud is a website that interacts with a lotionjs blockchain app. Any user can create a poll, but doing so requires tenderfeud tokens.
Users can vote (once per private key) on existing answers to a poll or submit their own answers. The poll creator's funds are released to all users who selected the winning (strict majority) answer. Polls end once the block height reaches a number defined by the creator. Our choice of using a responsive vue.js frontend (discussed later) allows us to display realtime 'countdown' timers to the user synced to the blockchain's notion of time.
If a poll ends in a tie or ends with fewer than 2 distinct answers, the creator's funds are returned. Funds are distributed to winners on an exponential decay distribution based on vote order, to reward early movers proportionally more than 'bandwagoners.'
Even though users can create their answers, users are incentivized to vote on answers with existing support behind them, as only the winners are compensated in the end. Althogh we didn't have time to test this with hackathon attendees (this was the original plan...), we think this property will lead to a Keynesian beauty contest.
How we built it
The application consists of two components: the web app and the blockchain. Currently we run a single tendermint node (w/validator and the webserver on a single ec2 machine. In the future, we may expand the blockchain to a cluster of validators.
Github link here
Live version of the site here. Enter the name 'lakshman' for some free tokens with which to create polls.
The web application is a node.js server that uses the vue.js framework for responsiveness. We wanted the a frontend that reflected the state of the (constantly changing) blockchain and vue.js components were the perfect choice for this.
The node server communicates with the local tendermint validator via TCP.
We used lotionjs to program our tendermint blockchain. As mentioned earlier, the state consists of account balances and polls.
There are only two transactions that this app responds to:
- createPoll(pollQuestion, payout, creatorPubkey, endBlockHeight)
- payout must be greater than creator balance + all outstanding payouts owed by creator
- vote(pollQuestion, submittedAnswer, voterPubkey)
We use a block handler to update poll state (i.e. mark polls as inactive) once a certain block height is reached.
Challenges we ran into
Our initial plan was to deploy a full cluster of aws tendermint nodes to manage our blockchain. We had trouble getting the configuration right in time, so settled for a single node blockchain whose single node lives on the same machine as the webserver. A single node blockchain obviates the need for a blockchain, so in a sense our submission is a glorified webapp using a 'blockchain' as a database, but hey, it's a hackathon :).
We also hoped to get a working version of the webapp done by Sunday so that we could test polls on hackathon attendees, but we found two things to be the case:
- the frontend was a little tricker to hook up than initially expected
- hackathon attendees were more focused on finishing their projects than trying out others' on the last day (us included...)
Finally, despite some heroic design work by Manu (firstname.lastname@example.org), we weren't quite able to get our latest styles/designs onto our webapp. As such, in addition to the existing webapp, we've attached a bunch of concept art showing how this app may look in the future.
Accomplishments that we're proud of
We went from 0 (literally 0, we formed our team and idea on Friday evening) to a functioning webapp with an attached tendermint blockchain managing its state in 2 days.
None of us had worked with Tendermint/lotionjs before, but perhaps this is just testament to the great work done by @jaekwon, @keppel, @mappum, and crew. Who would've thought that programming a blockchain was just a matter of writing a function of state and the next transaction? Seriously, great work on making a beautifully simple library.
What we learned
- how to use lotionjs to create a blockchain application
- how to connect a web frontend to a tendermint blockchain
- how easy it can be to create blockchain apps with the right, modular tools (tendermint)
What's next for tenderfeud
TBD! We really like the idea of designing economic incentives to get wisdom from the crowd so hope to either:
- extend tenderfeud into a full-fledged app with a real, public blockchain backing it (maybe BTC or ETH, via smart contract)
- convert our learnings from tenderfeud into new prediction market/polling systems