We're adding major features you asked for! Reduced services until July 2023.

SafeEscrow Technical Specs

The following is a more technical specification of our SafeEscrow contract, aimed towards those who are familiar with smart contracts, with an eye towards programmers with previous Solidity experience. If you are looking for the easiest guide to use SafeEscrow, please refer to this “What is SafeEscrow?” guid here

As a recap, SafeEscrow A1 (the version currently live on our site right now) works in the following order in an ideal case:

1. The buyer deposits a payment P into the SafeEscrow contract.

2. The seller ships the good to the buyer.  The buyer receives it and inspects it to ensure it is good.

3. The buyer then forward the payment P onto the seller.

Paying with USDC via SafeEscrow

We use the Ethereum or Polygon mainnet blockchain to automate buyer protection and give buyers a sense of security when they purchase an item using our SafeEscrow contract.  The Ethereum mainnet source code is here, and the identical (modulo addresses) Polygon source code is here. In a successful purchase, the contract works as follows:

  1. The buyer sends money, typically the USDC token, to the SafeEscrow contract instead of the seller directly.
    1. This is implemented as the createTransaction function.
    2. Parameters of the function are set by the buyer, but need to meet seller specifications (namely, order number, correct order amount) for the seller to ship.
  2. The seller ships the item once the buyer’s money is in the SafeEscrow contract.
    1. This is handled off chain as a social agreement between the buyer and the seller.  In the case of WaterMelonMarkets, the seller is currently only WaterMelonMarkets itself, and you get all the shipping, satisfaction, and genuine guarantees of our site.
  3. The buyer releases the funds to the seller upon receiving the item and verifying that it is in good condition. If the buyer forgets to release the funds and does nothing, the funds are released automatically after a predetermined period, typically 30 days.
    1. Specifically, the timeUntilFundsReleasedAutomatically parameter is by default set to 30 days, to help buyers in case they forget to release funds.
    2. If the buyer wants to release funds early, she may use the unlockFunds function.

This process is as seamless as paying with credit cards as the buyer simply sends a payment, gets an item from the seller and doesn’t have to do anything else. Because the payment is done in USDC, the seller is shielded from currency fluctuations.

Automated Buyer Protection

If the seller doesn’t ship the item, the buyer can lock the funds in the escrow fund, such that the seller doesn’t receive them. Specifically, the flow would be as follows:

  1. The buyer sends money to the SafeEscrow contract instead of the seller directly.
  2. The seller fails to ship the item.
  3. The buyer locks the funds and contacts the seller.
    1. The buyer may use the lockFunds mechanism.
  4. The seller cannot get the money and can either refund the payment or send the item, such that the buyer chooses to unlock the funds.
    1. The seller may unilaterally issue a refund through this function.

By allowing the buyer to block payment to the seller, the smart contract incentivizes the seller to actually ship the item and make sure the buyer is satisfied. 

To be clear, once the funds are sent to escrow by the buyer, only the buyer can forward the funds through (after receiving the product).  And only the seller can refund the funds back (after being satisfied the buyer qualifies for a refund).  If there is no agreement, the funds are locked indefinitely; while this seems inefficient, it actually should be a rare outcome and enforces the good equilibrium. 

This is similar to a lawsuit: the legal fees of both sides are lost, so it is one-time inefficient.  However, the legal system serves so that most of the time, the correct equilibrium happens and you have a larger pie as a result.

Closing Thoughts

By using smart contracts and blockchain technology, we are able to reduce the costs of dispute resolution and provide you the customer with cheaper prices

X