How To Use A Smart Contract Custody Exchange (“SCCE”)

The EtherDelta smart contract; the engine of the exchange.

Smart Contract Custody Exchanges (“SCCE”) were the very first generation of decentralized exchange mechanisms. They enable anyone with an Internet connection to trade between ETH and ERC20 pairs entirely on the Ethereum blockchain without providing any personal information.

SCCEs are made up of individual smart contracts that handle all aspects of a trade from custody, order book management, and trade settlement — all performed entirely on-chain. This is different from Relayers, which use a hybrid approach where order books are centrally managed off-chain and trades are settled on-chain.

This article provides a step-by-step overview of what it’s like to actually make a trade on from start to finish on the Ethereum blockchain. I chose to use EtherDelta, as it is one of the first (and most popular) SCCEs.

It only makes sense to trade very small amounts on SCCEs. As always, never spend more than you can afford to lose entirely.

🦊 Step 1: Download & Install MetaMask

MetaMask is the industry standard wallet for interacting with dApps. Download one of the browser extensions (I used the Chrome Extension).

Follow the instructions to setup your MetaMask wallet.

💸 Step 2: Fund your MetaMask Wallet

Once you’ve installed your MetaMask wallet, it’s time to fund it! Click the “” button on the top right and select either the “Show QR Code” or “Copy Address to clipboard” option to get your wallet address:

Use your exchange/wallet of choice to send ETH to your wallet address.

🌐 Step 3: Go to https://etherdelta.com

If you have not logged into MetaMask prior to going to EtherDelta, you will see the following message:

You need to log into MetaMask in order to use EtherDelta.

Log into MetaMask by clicking the fox logo in the top right of your browser window and entering your password:

Click the fox icon in the top right of your browser to bring up the MetaMask login screen.

Your screen should now look something like this:

Your screen should look like this after you’ve logged into MetaMask and gone to EtherDelta.

💎 Step 4: Select the Asset You Want to Buy

Click the PPT button in the top left to select the asset that you want to buy:

Click this button to choose the asset you want to buy.

I like ZRX for reasons stated in my previous article, so I chose that.

💰 Step 5: Deposit ETH

Now that you’re on the right order book, it’s time to deposit ETH! Enter the amount that you want to transfer from MetaMask and click deposit:

Clicking the “Deposit” button will cause MetaMask to present a notification; make sure you have sufficient gas settings (I recommend a Gas Limit of 250k and Gas Price of 25 GWEI) then click the “SUBMIT” button to continue:

I recommend a Gas Limit of 250k and Gas Price of 25 GWEI to ensure a quick deposit.

You should then see this confirmation from EtherDelta:

The resulting transaction for my deposit from MetaMask to EtherDelta.

You have now given custody of your ETH to the EtherDelta smart contract; once the transaction confirms you will be ready to trade!

🤝 Step 6: Make A Trade!

There are two ways to make a trade on EtherDelta — Limit and Market Orders.

Limit Order

Limit Orders are where you set the price at which you want to buy an asset and wait for someone else to take it — you are “limiting” the price at which you are willing to buy. Limit Orders give you the opportunity to buy at a price lower than the market price, but you must wait for someone to fill your order.

You can make Limit Order in EtherDelta using the NEW ORDER box:

My Limit Order to buy 3 ZRX @ 0.00158 ZRX/ETH.

You’ll see the following notice from MetaMask after clicking the “Buy” button. Don’t be alarmed — click the “Sign” button to give EtherDelta permission to place your order:

Don’t be alarmed by this notification— click Sign.

You will see your Order appear in the MY TRANSACTIONS box:

Default expiration time for Limit Orders is 10,000 blocks (approximately 41 hours).

Market Order

Market Orders are where you take a piece (or all) of someone else’s existing Limit Sell order. This can be accomplished by clicking the lowest-priced order that appears in red (the order closest to the ZRX/ETH divider):

Click the lowest-priced sell order to bring up the Market Order screen.

Clicking an order on the order book will bring up the order so you can fill it:

Enter the amount that you want to buy then click the “Buy” button.

You will again have to confirm this transaction with MetaMask; don’t forget to include sufficient gas:

Click the “SUBMIT” button to confirm your Market Buy Order.

You’ll then get a confirmation from EtherDelta:

The resulting transaction for my Market Buy Order.

❓ So Now What?

You now technically have ZRX “IOU’s” in the EtherDelta smart contract that are available to be withdrawn so that you actually own the tokens. Generally it is a good idea to withdraw tokens soon after you are done trading.

💸 Step 7: Withdraw Coins from EtherDelta!

Now it’s time to take back custody of your coins from the EtherDelta smart contract! You can withdraw back to the same MetaMask address used to send your deposit to EtherDelta or transfer to another ETH address.

Withdraw to MetaMask

Enter the amount of the token you want to withdraw then click the “Withdraw” tab in the BALANCE box on the top left:

This screenshot shows that I have a balance of 6 ZRX on EtherDelta and a , and I want to withdraw 3 ZRX.

Click the “Withdraw” button to trigger the MetaMask confirmation:

This confirmation screen should start to feel familiar by now…

As usual, an EtherDelta confirmation notice will follow:

The resulting transaction from my ZRX withdraw to MetaMask.

The ERC20 tokens will be transferred to your MetaMask wallet, but there are some additional steps that will need to be taken to see them in MetaMask:

A good tutorial on how to add ERC20 tokens to MetaMask.

Transfer to Another ERC20-Compatible Wallet

You may also transfer your freshly-acquired tokens to an ERC20-compatible wallet using the “Transfer” tab in the BALANCE box on the top left:

The “Transfer” tab allows you transfer tokens to a separate (non-MetaMask) ERC20-compatible wallet.

The “Transfer” button will display the familiar MetaMask confirmation:

Don’t forget to include enough gas!

Click “SUBMIT” to complete the withdrawal:

The resulting transaction from my ZRX withdrawal to an external ERC20-compatible wallet.

🎯 A Note About “Decentralization”

Many people would consider SCCEs like EtherDelta to be a “Decentralized Exchange” — and they wouldn’t exactly be wrong. However, if “Decentralized” is meant to imply that it is somehow more secure to stable, that is simply not true, as evidenced by the EtherDelta DNS hack in December 2017 and a service interruption as recent as March 1st this year:

EtherDelta uses a centralized Graphic User Interface (GUI) which is vulnerable to hackers and outages.

👎 Conclusion

Having to send a transaction for deposits and order creation/changes is expensive and time-consuming. This is where Relayers offer an advantage, as they use a hybrid approach of off-chain order book management and on-chain trade settlement. My next article will be a step-by-step overview of Relayers.

Bitcoin Compliance Professional