Descrow: Multisig escrow dapp with staked arbitration

By November 9, 2020DApps
Click here to view original web page at
Descrow: Multisig escrow dapp with staked arbitration – screenshot 2
Descrow: Multisig escrow dapp with staked arbitration – screenshot 1

I just re-read the rules and noticed I missed the part about using one of Stellar's 4 new features. Sorry about that! I'd like to retract my submission as it does not use these features. I don't see a delete button in devpost...


Stellar is awesome at cheap and fast payments. However, payment by itself is difficult in cases where the two parties don't fully trust each other. Escrow is a useful service that makes a lot more possible. But escrow services tend to be centralized and expensive.

What it does

Descrow is a non-custodial multi-sig escrow dapp that is also designed for security and ease of use. It uses Stellar multi-sig and presigned transactions to implement a smart contract that is setup to implement the escrow and incentivize positive behavior by the transacting parties.

Descrow uses something I call "staked arbitration". In addition to the escrow amount, "buyer" and "seller" posts a 20% deposit (stake) in the event that third-party arbitration is needed. In most real-world cases, the transaction will complete amicably (full payment, partial payment, or cancellation). In these cases where seller and buyer can reach agreement, the arbitrator is not involved and the arbitration stakes are refunded, resulting in zero net fee for both parties. If arbitrator help is required, the arbitrator will make a decision on who is in the right, and receives the stake of the losing party as compensation.

The arbitrator is a trusted third party chosen by buyer and seller before starting the escrow. He or she could be a professional, well known member of the community or a mutual acquaintance.

How I built it

When using Descrow, users have sole custody of their keys. All transaction generation signing are done in browser using Stellar JS SDK.

User authentication to backend is implemented using SEP-10. Backend is implemented using node.js and postgres. It serves mainly as a smart contract metadata and multisig coordinator. No sensitive information is stored there. When user logs in directly with Stellar account, the dapp fetch all the escrows for which the account is involved as seller, buyer, or arbitrator.

Challenges I ran into

Non-deterministic initial sequence number for new accounts caused some trouble. I also had to be careful with sequence number of the temporary escrow account in presigned transactions.

Perhaps most challenging was figuring out an end user workflow that minimize the number of steps needed to use this dapp. I solve it to batch multiple transactions signing on contract setup.

For each escrow, Descrow sets up a Stellar account that is initially owned by the seller (when he creates the escrow) and then jointly owned by seller, buyer, and arbitrators after buyer deposits the required amount plus arbitration stake. The final multisig setup allows transacting when both sides (buyer and seller) agrees (best case scenario) or one side with an arbitrator. This setup supports up to 4 independent arbitrators for redundancy.

After seller has funded the initial escrow account, Descrow generates and lists all the transaction XDRs, with click through links to Stellar Labs. Seller then immediately presign the transactions that favor him ("buyer deposits", "buyer complete payment", and "arbitrate for seller").

To finalize the escrow setup, the buyer must send into escrow account the agreed to amount and his arbitration deposit. This same stellar transaction sets up the final multisig. After this contract is executed, buyer then presigns the other transactions that favors him ("seller refund" and "arbitrate for buyer").

After escrow setup, future operations require only one button click (signing) by the appropriate user.

Descrow currently accepts Stellar private key for signing in. While the key resides only in browser memory and is not known to server, I know accepting private keys this is not ideal. But it offers by far the best user experience because the dapp needs to sign multiple transactions (that number increases with multiple arbitrators) per user to setup an escrow. I am exploring hardware wallet. Users can always transfer what they need to a hot wallet

Accomplishments that I'm proud of

Getting it to basically work as intended :-) is operational on tesnet.

What I learned

This was my first time really working with Stellar multi-sig and presigned transactions.

What's next for Descrow- Multisig escrow dapp with staked arbitration

I'm hoping Descrow could be used to enhance some existing use cases involving payments. If there is enough interest, I could make it easier to integrate with other apps that want to setup escrows. I'm will also explore the impacts on user experience of hardware wallets.

Leave a Reply

All Today's Crypto News In One Place