I'm interested in building an app that would generate a new smart contract every time two users of my app come to an agreement:

The first user would then send eth to the smart contract, and would receive a simple passphrase (something like a pin code) in return. the second user would provide an eth address to receive the funds.

Then, sending the passphrase to the smart contract would allow for the release of the funds.

It would also be great if the funds are actually sent back to user1 after a certain period if the passphrase hasn't been entered.

Does that sound easy to do? I assume this is exactly the sort of stuff one can do with ethereum, right? I'm pretty new with these sort of things, would there be an example I could use as a base? Thanks a lot in advance!

1 Answer 1


Can be done, and the contract can do other things if needed since it's the trusted man-in-the-middle overseeing this. You probably want to remove the passphrase from the process because there are generally better solutions.

I removed the password bit entirely. It's not clear to me at this what purpose it would serve. I would need to know what's for to work out the Ethereum way to doing it.

In the example, sender sends the funds. The contract doesn't wait for anything before pushing funds through to receiver. Not possible anyone else got paid.

Just a minimal example:

contract Forward {

  event LogFundsForwarded(address from, address to, uint amount);

  function forwardFunds(address receiver) 
    returns(bool success)
    if(msg.value==0) throw;
    if(!receiver.send(msg.value)) throw;
    LogFundsForwarded(msg.sender, receiver, msg.value);
    return true;


Hope it helps.

  • Hi Rob, Thank you! Basically what I want to do is lock the funds in the contract, and a unique PIN sent to the sender, who then gives it to the receiver (face to face) - receiver would then 'send' the PIN to the smart contract in order to get the fund - other things that the contract would have to do is actually 'show' that the funds are indeed there; A bunch of other things I'd like to add is a time limit for the funds to be sent back to the sender, and also a small %age of the funds to be sent to the contract creator as a commission... Mar 14, 2017 at 0:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.