By: Ermos Kyriakides

Digging a bit deeper into the applications of Blockchain and Cryptocurrencies, is something that has been on my radar for quite some time.

The time has finally come; in this post I will give a brief overview of smart contracts — one of the most radical and (now) mainstream applications of blockchain- in addition to talking about how they are executed. Furthermore, I will discuss how they promote decentralization and will present a case study on WandX and its smart contract-enabled asset trade capabilities.

What are Smart Contracts?

A ‘traditional’ contract is a set of terms and conditions describing a relationship between two or more parties, enforceable by law. The term smart contract was first coined and proposed by Nick Szabo, in 1994. The purpose of a smart contract is the same as a ‘traditional’ one, with the major difference being that this contract is enforceable by programmatic code. The code and the agreements contained that make up a smart contract, can be ‘stored’ across a network, often distributed and decentralized (i.e. the blockchain); these are called blockchain smart-contracts. These blockchain smart contracts are usually immutable and tamper proof.

For the rest of the post, I will use the term smart contact with the assumption that these are blockchain smart contracts.

How are they executed?

The magic of smart contracts is that they are self-executing pieces of code, which given a certain input, they execute a number of instructions, to produce an output. This piece of code is usually stored on the blockchain and is initiated by a party. To give you an idea how a smart-contract works, consider this simple trading example:

  • A smart contract holds a balance of 5 ABC Tokens and 5 XYZ Tokens, with an exchange rate of 1:1 (i.e. 1 XYZ costs 1 ABC).
  • Alice sends 1 ABC to this smart contract.
  • The smart contract automatically and autonomously executes this ‘trade’ and Alice is sent 1 XYZ Token.
  • Similarly, Bob sends 2 XYZ tokens to the smart contract.
  • As before, once Bob sends 2 XYZ Tokens to the smart contract, he receives 2 ABC Tokens in return.

What are the advantages of smart contracts?

Smart contracts are not just programmatically coded contracts; they offer much more than that.

  • Security & Record Immutability — Given smart contracts are stored on the blockchain, they acquire some of its properties; they are encrypted and distributed among nodes. This ensures that they can’t be lost or changed. In addition, the immutability of the blockchain, ensures transaction details are stored for future records, whilst also making them easily retrievable.
  • Guaranteed Outcome —The outcome of a smart contracts can’t be misinterpreted, unlike, their ‘traditional’ counterparts which are written in natural language and inherently leave room for ambiguity. In addition, smart contracts are always guaranteed to give you the same output, given a certain input. This characteristic makes smart contracts very appealing as the need for arbitration and courts could be greatly reduced or even eliminated.
  • Transparency —The contents of a smart contract (i.e. terms and conditions) can be made fully visible and accessible to all relevant parties. Once a smart contract has been deployed, there is no way to dispute it.
  • Trust — The nature of smart contacts removes any possibility of manipulation, dispute, or error (disregarding human error while coding the smart contract). Once initiated, a smart contract is executed automatically by the network it’s deployed on.
  • Efficiency & Savings — Since smart contracts are executed automatically once initiated, they eliminate a vast amount of middle-men in the value-chain (i.e. witnesses, lawyers, banks, etc.) thus increasing the efficiency of a process. Naturally, having a more efficient process results in greater savings.

From the list above, you can see how smart contracts can be the foundationof setting terms and conditions between parties in the future. However, there is the lingering question whether these are legally binding. This is a grey area in which research is still on-going but if you want to know more about the matter, check Clifford Chance’s research on the subject, here. Despite this, there is no denying that the self-executing properties of smart contracts, alongside everything else, are nothing short of revolutionary.

How do smart contracts promote decentralization?

A decentralized system is one in which no single person, institution, or machine is telling others what to do. Ethereum’s Co-Founder, Vitalik Buterin,categorized decentralization into 3 types:

  • Architectural (de)centralization — how many physical systems is a network made up of? How many of those systems can it tolerate stop working without bringing the network down?
  • Political (de)centralization — how many individuals or organizationscontrol the network?
  • Logical (de)centralization — does the network look like an organized well-structured design or a single monolithic object? If the system was cut in half, could it still function as two separate entities?

Smart contracts (and the platforms they are deployed on) mostly promote architectural and political decentralization.

  • Architectural Decentralization as they are distributed across various nodes that can tolerate any one (or more) of them going ‘offline’ at any point in time.
  • Political Decentralization as there is no central entity controlling the network.

Decentralization is extremely important as it brings attack resistance, collusion resistance and fault tolerance. All these are not possible in a centralized system as centralization allows the controlling party to determine actions for a system — good or malicious.

If you want to take a deeper dive into decentralization, you can check out Vitalik Buterin ‘s exceptional piece here.

A case study: WandX and smart contract-enabled asset trades

WandX “is a decentralized ecosystem that leverages smart contracts to enable crypto asset holders to create, trade and settle various crypto-financial instruments”.

WandX is a Decentralized Exchange (DEX) — a platform in which users, not the platform, have access to the funds. Additionally, trades are executed automatically and conducted directly peer-to-peer. Advantages of a DEX like WandX over typical Centralized Exchanges include, better security, anonymity, improved uptime and transparency. Although a number of DEXs face challenges that range from liquidity issues to lack of trading functionality and fluid user experience, one must remember that these are still early days of decentralized crypto-platforms.

What’s exciting about a DEX like WandX is the fact that it employs smart contracts for novel ways of trading and settling exchanges. Powered by smart contracts, it enables a variety of features, ranging from token basket & portfolio creation to escrow and payments.

For the purposes of this post, I’ll talk about WandX’s micro contracts. These are components of the platform which leverage smart contracts, in a simple and effective way, for intermediary-free crypto asset management.

A micro contract is similar to a smart contract but remains under the ownership of the creator, and contains the sell price for the tokens within. This micro contract works very similar to the smart contract example before:

  • Alice intends to sell 100 WAND for 0.05 ETH
  • Alice places an order
  • This triggers the creation of a ‘micro-contract’ which is then deployed on the blockchain and owned by Alice
  • Bob wants to buy 100 WAND
  • Bob sees Alice’s order (and contract address) and sends 0.05 ETH to it
  • The ownership of the contract is now transferred to Bob containing 100 WAND whilst Alice receives 0.05 ETH

The simplest use case of micro contracts is enhancing the chances of liquidity of a single or a basket of crypto assets. Combining this with the natural decentralization of the blockchain micro contracts allow crypto assets to be transacted efficiently and swiftly without intermedearies (i.e. an order book).

Conclusion

Taking everything into consideration, the marriage of smart contracts and the blockchain, bring a promise of great scale and scope. As honed by WandX, future transactions (financial, legal, and more) are increasingly going to be embedded in code, designed in such way to self-execute and substantially minimize the need for intermediaries and slash any added costs thereof.

As a matter of fact, the introduction of smart contracts propels us into an era where interventions by arbitrators, courts or financial regulators could be kept to a minimum and that’s a welcome proposition for creating a world of borderless and boisterous exchanges.

Having experimented with WandX, I believe that self-executing smart contracts in the areas of crypto portfolio & risk management, peer-to-peer payments and digital asset trade are definitely the way forward. This will undoubtedly reduce the barrier of blockchain adoption and alleviate the apprehension surrounding the long-term viability of cryptocurrencies.

Also, I encourage you to try out the WandX DEX by following the link, here. And do share your experiences with DEXs below.

By our friend Ermos Kyriakides. You can follow his Blog at https://medium.com/@ermos.k and on Twitter at https://twitter.com/ermos_k

Link to original blog here.