Git Product home page Git Product logo

commitment-device's Introduction

Commitment Device

This is a very simple commitment device contract.

The idea is this:

  • Suppose you want to form some positive habit, and you want a trusted friend to keep you accountable.
  • You deploy this contract with yourself as the subject and some amount XTZ at stake, and list your friends as arbiters of the contract
  • Every day, you do the habit, and send a Keep_alive operation
    • It's up to you to be honest (and your friends to keep you honest)
  • If 36 hours pass and you don't send the keep-alive, then anyone can steal your stake
    • Why 36 hours? Because 24 is the ideal, but it seems real life would demand some buffer.
  • If you want out of the deal, you have two choices:
    • Get one of your arbiter friends to send an Approve_quit operation. Then you can send a Quit operation to gracefully get out of the contract and get your stake back.
    • Quit without their approval. You'll still get your stake back, but the contract will call you out on it by emitting an on-chain event, permanently recording you as a quitter in blockchain history...

I wrote this for myself in over a weekend - don't expect much from it.

WARNING

THIS CONTRACT HAS NOT BEEN AUDITED! USE AT YOUR OWN RISK.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.