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.
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.
This smart contract allows users to do 2 things:
- Submit statements that are TRUE or FALSE.
- 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.
- Install Ganache, truffle, node, metamask
- To get working full-stack template: $truffle unbox pet-shop
- To compile smart contracts and build the .json: $truffle compile
- have ganache open
- 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
- Initial migration of code to blockchain instance (running with Ganache): $truffle migrate
- If you change your smart contract code and want to update: $truffle migrate --reset // note this will reset everything
- interact with the smart contract from console with: $truffle console
- Once in console, enter $contractName.deployed().then(function(i) { app = i; }) // this should return 'undefined'
- Call contract functions with app.functionName(x,y,z, { from : 0x123..., value : 10 }) // {} contains metadata for the function
- View blockchain stuff with $web3.eth.X . $web3.eth.accounts returns account addresses in Ganache
- Use contractname.js in /test/ to test the contract in action using Mocha and Chai it(...) tests. Run $truffle test
- Have test scripts in ./test/.
- $ganache-cli (launches blockchain simulator)
- $truffle compile (compiles contracts)
- $truffle test (tests scripts)
- if making a transaction with metamask and tx nonce is mismatched from ganache network's tx nonce, reset your account in metamask: https://consensys.zendesk.com/hc/en-us/articles/360004177531-Resetting-an-Account-New-UI-
- Provide pre-filtered datatable search by using truthstaking.com/stakes/live/#dataTableID=fWords%20of%20Interest