The dapp https://tamedu.github.io/lazy-loose-money
Running on Ropsten Testnet
, contract address 0x1e927cddb41e9347a47b23781a6a36e208575b73
- Problem & solution
- More game theory
- Smart contract development and deployment
- JavaScript CLI tools
- References
Let say that i want to do running for 1 hour everyday for 100 days. I create a contract and deposit $100 in it. Everyday, I need to (somehow) inform the contract that I finish my running or not. Then after 100 days passed, depend on the completeness of my report, the contract will do some punishment. For example: lock $100 for 10 more-day for each day I did not do the running. So if I skip running for 6 day, the money will be lock there for 2-months. Other kinds of punishment could be: Burn a part of deposit money, give it to someone ...
I'm thinking of asking a friend (roommate for example) to do the checking for me. And how should I incentive my friend to inform the contract regularly and CORRECTLY?
Here is a solution
-
If I cancel my commitment, I will part of my deposit money.
-
If I keep my commitment contract run till the end:
-
My friend will get a portion of deposit money according to the number of days reported to the contract.
-
I will get back a portion of deposit money according to the number of days I finished my commitment.
-
Later, we can add more features:
-
Supporters can visit and give the commitment some fund. Supporters are there to encourage I and my guardian finishing the commitment. The main purpose is to say nice words to make keep moving forward. Any fund supporters added should be treated as tip moneys (small amount)
-
Guardian can report a pending day, and give a resonable reason why committer can not fullfill his daily commitment (got sick for example)
-
More than one person can be guardians, and guradians can co-report me commitment. The more guradians join, the stronger my commitment is.
-
Above features can be extended to a group committers who commit to a same goal and guard each others.
-
Link with real data. See https://github.com/Cryptizens/cryptorun-back for example
To avoid troll guardian:
- Guardian need to deposit some money (implemented)
- Guardian have responsibility to warranty committer daily success. If guardian reported a day as failure, both committer and guardian loose money.
- Committer can
complain
if guardian reported wrongly. In this case both committer and guardian loose money - After complain for 3 times, committer can
fire
his guardian to find a more reliable one
Copy Solidity code from LazyLooseMoney.sol
and paste it to http://remix.ethereum.org
# Open the HTML app in Chrome
open https://tamedu.github.io/lazy-loose-money/
# Press Ctrl + Shift + J (Windows / Linux) or Cmd + Opt + J (Mac)
# to open Chrome DevTools Console
llm.help()
https://github.com/ethereum/wiki/wiki/JavaScript-API
https://solidity.readthedocs.io/en/v0.4.21/
https://github.com/cryptoprimitive/contracts/blob/master/BurnablePayment.sol
Learn Factory pattern and burnable concept from the contract. Also learn how to struct my solidity code too :) Thanks @coinop-logan to share the idea and introduce me to the blockchain world!
Stickk implemented the same idea. Can learn from it. Thanks @joshpitzalis to let me know.
It’s important to know what your goal is. But it’s more important to know what it’ll take you to actually accomplish your goal.
The possibility of losing money? A Referee who verifies your reports? Supporters who cheer you on along the way? Everyone’s different.
Stickk data shows that creating a Commitment Contract with:
- A Referee increases your chances of success by up to 2x
- Financial stakes increase your chances of success by up to 3x
What will it take for you?