Concept for trustless contracts using multisig

I came up with an example of how multisig can be used to make a trustless contract on the nano network.

Let’s use the case of matched donations. Account A says it will donate 10 Nano to charity account D, so long as account B also donates 10 Nano to account D.

To do this, we use an intermediate account C, which is a multisig account between A and B. You then create and sign a series of blocks to handle the transactions; these will all be orphan blocks until the conditions are met, so they need to be stored off the network until they are ready to be broadcast. Here are the blocks:

1.) C receives 10 Nano from A
2.a) C receives 10 Nano from B with block 1 as the previous block
2.b) A bails and has C send the 10 nano back to it with block 1 as previous
3.a) C sends 20 nano to D with block 2a as prev
3.b) C receives 10 nano from B with block 2b as prev
4.) C sends 10 nano back to B with block 3b as prev

If both parties hold their ends of the bargain, the order of blocks is: 1->2a->3a

If B doesn’t send anything to C, A has recourse to reclaim its funds through: 1->2b

If A tries to troll B by pocketing its funds back before B notices, B has recourse to claim its funds through 1->2b->3b->4

If either party sends a block that isn’t exactly as agreed upon, it won’t be received by C.

Let me know if there are any reasons why this couldn’t work that we overlooked.

Credit to @fishy for starting the idea of how to do it without a time delay, and thanks to sparkcrz and @vyryn for helping strengthen the ideas.

6 Likes