Coder Social home page Coder Social logo

time-locked-wallets's Introduction

There are many different applications of the Ethereum smart contracts, the most popular at the moment being cryptocurrencies aka ERC20 tokens and crowd funding token sales aka ICOs. In this hackathon, I would like to explore something different, like the idea of locking funds in crypto wallet contracts.

Here are several examples, starting with, probably the most common reason at the moment, to lock the funds called vesting. Imagine that you have just raised a successful ICO and your company still holds a majority of the tokens distributed between the team members. It would be beneficial to all the parties to ensure that the tokens hold by employees cannot be traded straight away. If they are no controls in place, employees might take action and sell all of them, cash out and quit the company. At the same time it would negatively affect the market price and make all the contributors to the project unhappy.

Another idea is to use smart contract as a crypto will/testament. Imagine I would like to store my crypto savings in a contract which will be accessible by members of the family, but only after something has happened to me. Let's say I should 'check-in' with the wallet, by evoking some contract call every so-often. If I don't check in on time, something might have happened to me and they can withdraw the funds. Either by reaching a consensus between the family members or by explicitly setting in the contract the proportions of the funds corresponding to each of them.

Different application of locking funds could be to create a small pension fund or time based safe/saving account that prevents the owner from withdrawing the funds before a certain time in the future. It could be particurarly useful for addicted crypto traders in helping keep their Ether intact e.g. HODL wallet. Also, what is a use case for this hackathon, to put some crypto money away for later for someone else, like a future birthday gift.

Demo

Why don't I introduce the actors of the demo first. Lets assume Alice is going to be the creator of the time locked wallet and Bob will be the recipient/owner of the funds.

Here comes the demo outline:

  • Alice creates a time locked wallet for Bob and sends some ETH
  • Alice additionally sends some ERC20 TopCoder tokens
  • Bob can see the wallets he has access to and the ones he created
  • Bob cannot withdraw any funds before the wallet time lock expires or is empty
  • Bob withdraws the ETH when the wallet gets unlocked
  • Bob withdraws all TopCoder tokens

Once it's done install Truffle with:

npm install -g truffle

Checkout this project source code:

git clone https://github.com//uport-time-locked-walletsradek1st
cd uport-time-locked-wallets

And then compile and migrate the contracts:

truffle develop
> compile
> migrate

Finally, you can run the DApp:

npm run dev

which will launch a browser tab on http://localhost:3000/.

I've discovered the following issues:

  • Rinkeby Etherscan is not reflecting correctly TimeLockedWallet contracts, probably because they were deployed from within the factory contract. Neither it is showing correctly all Ether transactions.

time-locked-wallets's People

Contributors

mxnre avatar

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.