Escrows & How to Decentralize them

Rounak Datta
Jun 10, 2018 · 7 min read

What’s an Escrow?

Escrow technically means a bond of trust between two parties making a service deal with each other by involving a mediator in-between. Traditionally, escrows are conducted by the involvement of a third-party which is responsible of making sure neither of the parties involved in the service deal is defaulting. The service-demander (or buyer) deposits a negotiated amount of money in the escrow and demands the service to be done in a negotiated time. The serviceman (or seller) is notified of the deal and and the time period in which the service needs to be complete. Thus, the serviceman is responsible for completing the service within the negotiated time for the negotiated charge at an acceptable quality.

During the entire service period, it is the responsibility of the third-party to ensure the security of the money. Once the service is completely done by the serviceman, the serviceman lets the escrow know of the status of the deal. Next, it is the responsibility of the service-demander to approve / disapprove the service done by the serviceman before the contract period ends. If the service done is approved by the service-demander, the escrow will pay out the deposited money to the serviceman keeping a pre-decided percentage of the money as an escrow fee charge. If the service done is disapproved by the service-demander, the escrow will hold the money unless a decision is taken by either of the party (the serviceman improves the quality of service / both the parties decide not to go forward with the deal). Otherwise, at a time when an ongoing escrow has not ended, there might be a case that the serviceman doesn’t want to go further with the contract; then the serviceman requests a cancellation of the escrow. This awaits cancellation confirmation from the service-demander upon whose positive response the escrow contract is cancelled and the money deposited in the escrow is returned back to the service-demander keeping the pre-decided percentage of the money as the escrow fee charge. If the serviceman is unable to complete the service in the given time period, the deposited money is transferred back to the service-demander with the escrow fee being charged.

Do the traditional systems fail? Why?

Traditional escrow systems are highly centralized and therefore require a considerable amount of trust to be held by the escrow participants on the third party. Few issues in such a centralized escrow ecosystem could be :

  • Either / both of the parties might not be honest in making the deal — and this might result in locking up of one’s money in the escrow until the issue is resolved by involvement of legal authorities.
  • The third-party entrusted for the escrow might not be honest — and this might result in cases of contract manipulations, collusions, theft, unwanted troubles. Third-party involvements are always security-holes.
  • In case the escrow is a physical one, there might be general problems faced by a non-electronic system. There might also be the case of currency disagreements.

The Decentralized version

A decentralized escrow would refer to an escrow whose operations aren’t controlled by anyone, rather being transparent enough to be visible to everyone (or as intended). Ethereum is such a decentralized network (blockchain) which allows transactions to be carried out between any two transacting parties without the need of a centralised go-through intermediary (or so-called banks). Not only that, unlike Bitcoin blockchain, Ethereum network allows execution of code powered by gas. There comes the concept of smart contracts which are task-specific codes written to guarantee the particular task to be carried out in a decentralized way without the intervention of an intermediary.

So, escrows fall into this fitting use-case of decentralized network to perform transaction. The core idea is to have the smart contract to take care of the security deposit and prevent the transacting parties to default. Escrow over Ethereum makes sure the service-demander’s money isn’t fiddled with, the serviceman gets the service charge he deserves, and the service-demander gets the service he demands. So this ecosystem is called a ÐApp where the application is powered by the Ethereum network and not under the censorship of any organization.

  1. There’s a escrowOwner who is the one who creates the contract. There’s a variable eState tracking the current status of the escrow which will be set to unInitialized after this step.
  2. The escrowOwner will initialize the contract for the two parties by calling the initEscrow() passing seller address, buyer address, fee percentage and the final block number (which is the final block number denoting the service time). eState is set to initialized at this step. It’s ensured that none of the addresses of the buyer or seller is equal to that of the escrowOwner.
  3. Once the escrow is initialized, the buyer can make any number of deposits to the contract using depositToEscrow(); and events are also emitted for the same. This must be noted that the money deposited is owned by the contract and the escrowOwner has no control over it. eState will now hold a status of buyerDeposited.
  4. As transactions take place after this and the latest block number increases (i.e. service time passes).
  5. Once the service is complete by the seller (before the latest block number exceeds the given block number limit), the seller approves the escrow (i.e. marks the service by him to be complete).
  6. The buyer next reviews the service by the seller and

In case the service quality is acceptable,

  • Approves the escrow.
  • Since both the seller and buyer have approved the escrow, eState now changes to serviceApproved.
  • Next, the smart contract automatically initiates payment of fee charges to the escrowOwner — value of which is decided by the pre-decided fee percentage.
  • Next, the smart contract automatically initiates the payment of the remaining balance amount to the seller address. eState is now changed to escrowComplete.

In case the service quality is not acceptable,

  • The buyer does not approve the service.
  • After further negotiation, the seller can re-service or decide to cancel the escrow.
  • If the buyer too cancels the escrow, the entire amount of money deposited into the escrow will be refunded back the buyer with the escrowOwner keeping the pre-decided amount of sum as escrow fee charge. eState is now changed to escowCancelled.

The escrow is now in steady state and is ready to conduct another escrow. Otherwise, the escrow can be ended only by escrowOwner so that the contract is destructed.

Why does a decentralized system work better?

When a buyer deposits an amount into the escrow, who’ll take care of the deposited amount?

Cryptocurrencies stored into smart contracts are so safe that not even the contract owner can steal it. An open-source smart contract for the escrow will have all the functions for getting and posting info into the contract listed, and therefore the security factor. The cryptocurrencies will be retained into the contract unless the specified condition for transfer of money is achieved and the amount is transferred autonomously.

Why and how does this decentralized escrow service charge?

A ÐApp operating on the Ethereum network is powered by gas (the sustaining factor of Ethereum as well as overload-protection factor). So, the buyer and seller (and escrow owner) participating in the platform will be paying the gas charges to carry out each POST operation on Ethereum. Plus, as a business model of the platform, the escrow owner charges a nominal percentage of the entire deposit as the escrow fee.

What are the functions of the escrow owner?

Escrow owner is merely the creator of the escrow contract out of the factory, and is responsible for:

  • Registering the seller and the owner addresses within the escrow contract.
  • Registering the negotiated escrow fee and decided return date within the contract.

The escrow owner neither any power of regulating the state of the escrow nor is it allowed to transfer any funds.

What are some worst cases of the escrow operations?

There’s a dispute between the seller and the buyer. Either the buyer doesn’t acknowledge the service of the seller or the seller doesn’t agree to approve the deal. This case would require a legal intervention wherein a settlement needs to be reached.

What are some scopes of improvement of the escrow ecosystem?

Currently, the escrow system is powered by Ethereum i.e. the transactions on this platform are powered by ether cryptocurrency. But that always isn’t a pleasant situation. To outreach the entire community of sellers-buyers, local fiat currency is the best option. This requires a change in technology, migrating from the Ethereum blockchain to the HyperLedger Fabric. But that’s a future scope of such a platform.

You can get the complete code here

Looking for blockchain solutions (hyperledger, ethereum, Stellar, Corda), token sale (ethereum, neo, stellar) or Security Auditing? Get in touch with QuillHash.


Delivering Enterprise-grade blockchain technology to…

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store