Truth Staking

Overview

A decentralized application that allows the crowd to stake ether on the truthfulness of claims made by the media. If your peers agree with you, you win.

truthstaking.com

Watch a video here

The crowd stakes ETH on a claim made in the media as being True or False. After a period of time elapses, the majority wins and shares the distributed stakes from the minority.

The idea is to percolate truth through financial markets - somewhat similar to prediction markets.

Game theory flaws exist. It's a first attempt at an important problem.

Truth Staking Smart Contract

This smart contract allows users to do 2 things:

  1. Submit statements that are TRUE or FALSE.
  2. Stake on submitted statements.

After the staking period for the statement ends, the TRUE and FALSE pots of ether are counted. The larger pot wins, and the smaller pot is distributed amongst the winners, proportional to the size of their stakes. The "market maker" (the address that submitted the statement) receives an extra reward proportional to her first stake.

Developer Setup

Requirements

Documentation

  1. Install Ganache, truffle, node, metamask
  2. To get working full-stack template: $truffle unbox pet-shop
  3. To compile smart contracts and build the .json: $truffle compile
  4. have ganache open
  5. To launch smart contract, you will be using the javascript files in /migrations/. Adjust code for any new smart contract file names. 4.1 If your contract constructor takes arguments, place them in the deployer
  6. Initial migration of code to blockchain instance (running with Ganache): $truffle migrate
  7. If you change your smart contract code and want to update: $truffle migrate --reset // note this will reset everything
  8. interact with the smart contract from console with: $truffle console
  9. Once in console, enter $contractName.deployed().then(function(i) { app = i; }) // this should return 'undefined'
  10. Call contract functions with app.functionName(x,y,z, { from : 0x123..., value : 10 }) // {} contains metadata for the function
  11. View blockchain stuff with $web3.eth.X . $web3.eth.accounts returns account addresses in Ganache
  12. Use contractname.js in /test/ to test the contract in action using Mocha and Chai it(...) tests. Run $truffle test

Testing

  • Have test scripts in ./test/.
  • $ganache-cli (launches blockchain simulator)
  • $truffle compile (compiles contracts)
  • $truffle test (tests scripts)

General troubleshooting

Stuff

  • Provide pre-filtered datatable search by using truthstaking.com/stakes/live/#dataTableID=fWords%20of%20Interest