Investment Banking, Blockchain

In a report from the World Economic Forum, blockchain (distributed ledger technology) is considered to one of the emerging disruptive technological forces, along with Artificial Intelligence, Cloud, and Quantum Computing, that will reshape business and societies in the coming decades.

In this article, I’ll look explore the key concepts of blockchain, outline its benefits for investment banking and then go into an example of how to use blockchain to overcome the limited transparency, reporting, tracking and error-prone processes that underpins derivatives transactions.

Decentralization and Automation

Blockchain is a way of maintaining the security and integrity of transaction records without centralised control, regulation, or restriction of access. How does it do this? While the following description is extremely simplified and leaves out many important details, it may help to provide a bare-bones picture of the process:

  • A block contains one or more transaction records. You can think of it as the rough equivalent of a page from a ledger. After a block is verified as complete, new transactions are placed in a new block, which will become the next one in the chain.

  • Along with the transaction records, each complete block contains a hash (a long number, typically 256 bytes), generated mathematically from the data stored in the block.

  • The hash is consistent (the same procedure will always generate the same hash from the same data) and it is unique (any change in the original data will produce a completely different hash).

  • Each block also includes the hash from the previous block in the chain. This hash becomes part of the data used in calculating the block's own hash.

  • Any alteration in the data stored in a block changes that block's hash, which in turn changes the hash calculated for the next block, and so on down the chain.

  • The chain itself is stored in multiple copies, distributed across the Internet and updated automatically.

  • As part of the update process, each copy of the chain compares itself with the other copies. Any copy of the chain which is not identical to the majority of other copies is replaced; in other words, an automatic voting system maintains a consensus and guarantees consistency.

This means that if someone attempts to change a transaction record in a completed block, changing it and all of the subsequent blocks, the other copies of the chain will catch the alteration during the next comparison and undo it.

What Does it Offer?

From the point of view of investment banking, what does blockchain offer, and what problems does it present?

Increased Security

The main advantages that blockchain offers to banks, in general, are increased security and lower cost. With conventional ledger-keeping, security must be imposed externally or added to the system. Transaction databases need to be protected from intrusion and tampering, and an alteration to an individual transaction record may not be apparent without direct inspection of that record.

Blockchain automatically maintains the security and integrity of transaction records, down to the level of the individual transaction; even the most minor alteration in a record will become apparent almost immediately throughout the chain.

Increased Transparency

Typically, in a trade involving two or more parties, identical trade data is stored in the data system of each party, which not only involves a duplication of effort, but can lead to tricky data reconciliation problems across the front-, mid- and back-office systems of each party.

Because blockchain is a distributed technology, transactions can be simplified, streamlined and shortened, whilst reducing operating costs.

Lower Cost

The cost for establishing and maintaining the security of transaction records in the conventional banking world is significant. While adoption of blockchain is unlikely to eliminate security-related overhead entirely, it could eventually reduce such costs to a fraction of their current level.

Reuters recently reported that banks could save between $8 and $12 billion by 2025 by adopting blockchain technology based on an analysis of cost data from 8 of the world’s 10 largest investment banks.  

Smart Contracts

For investment banks in particular, blockchain technology offers another kind of advantage. It can be used not only to record transactions, but also (through the use of extended blockchain languages) to automate contracts, including such processes as execution, conveyance, payment, and escrow. This holds particular advantages in the case of extremely time-sensitive investments, or in markets such as commodities, where delivery may be contingent on multiple conditions.

Conceptual Views of Blockchain in Capital Markets

There are many blockchain technology use cases in the capital markets, including in the transactions of securities, and derivatives as well as the servicing of assets.

In this article, I’ll elaborate on a use case involving derivatives – specifically, total return swaps.

The diagram above shows the concept of a total return swap: it is an agreement in which one party makes payments based on a set rate, either fixed or variable, while the other party makes payments based on the return of an underlying asset, which includes both the income it generates and any capital gains. In total return swaps, the underlying asset, referred to as the reference asset, is usually an equity index, loans or bonds. The asset is owned by the party receiving the set rate payment. 

The total return swap allows one party to derive the economic benefit of owning an asset without putting that asset on its balance and allows the other, which does retain that asset on its balance sheet, to buy protection against loss in its value.

Hedge funds use total return swaps to obtain leverage on the reference assets: receiving the return of the asset, typically from a bank, which has a funding cost advantage, without having to put out the cash to buy the underlying assets.

The Problem with Total Return Swaps

Swaps pose a systemic risk to the global financial system for the following reasons:

  • Limited transparency

  • Immediate demand for liquidity through margin calls

  • Cumbersome tracking

  • Reporting errors

  • The settlement process is complicated, manual driven, inefficient and error-prone

  • Changes in the underlying asset value could trigger margin calls causing a drain on many cash-strapped financial institutions at once

Solution with Blockchain: ‘Contract as Code’

Blockchain can be used to overcome these problems, creating a ‘contract as code’, using the following steps.

  1. After terms are concluded, a swap agreement is coded into a smart contract with each counterparty’s cryptographic “addresses” with their identities and credit reputation “oraclized” (see below) and visible to both parties.

  2. Each party will have an asset account and a collateral account. The smart contract will calculate each party’s required collateral and post the amount to the collateral account.

  3. The associated contract documents are encrypted and stored in a distributed file system such as IPFS (https://github.com/ipfs/ipfs -  is a distributed peer-to-peer file system)  and the hash of the location information is registered as metadata of the contract.

  4. The smart contract will be compiled, “mined”, and posted to the blockchain.

  5. The smart contract will calculate the gain/loss of each party based on “oraclized” market data feed at a defined period and adjust collateral requirements accordingly. If either of the parties has exhausted its asset account to post additional collateral required, a margin call alert will be triggered for posting more money or terminating the contract. The values of both accounts will be visible to authorized parties.

  6. At the end of the contract term, the smart contact will settle the payout automatically.

What Does ‘Oraclize’ mean?

‘Oraclize’ services allow smart contracts to break free from their constraints by providing a trustless way to access data from the web. It allows blockchain applications to easily and efficiently access data from any data source (e.g. Web APIs): existing data sources can be used without needing to adapt them for the blockchain and can continue providing data via existing channels (typically a Web API).

‘Oraclize’ can be seen as an intermediary in a world designed to exist without intermediaries. While this can be seen as a “weakness”, it actually provides significant benefits.

Example Swap Contract in Solidity/Ethereum

Below is an example of a simple swap contract written in Solidity, a language for writing smart contract in the Ethereum blockchain. Another language for Ether is Serpent. A browser based solidity compiler (Remix)  is available this link.

Ethereum is a public blockchain originally developed for crypto-coin Ether, which currently has about 28 billion USD in market cap. This Ethereum white paper describes the proposal for its proposal a decentralized smart contract and application platform.


        
         contract Oracle{
    address owner;

    event Printuint(uint _value);

    modifier onlyOwner{if (msg.sender != owner){throw;}else{_;}}
    function Oracle(){owner = msg.sender;}
    struct DocumentStruct{uint value;}
    mapping(bytes32 => DocumentStruct) public documentStructs;

    function StoreDocument(bytes32 key, uint value) onlyOwner returns (bool success) {
        documentStructs[key].value = value;
        return true;
    }

    function RetrieveData(bytes32 key) public constant returns(uint) {
        var d = documentStructs[key].value;
        Printuint(d);
        return d;
     }
}

contract Swap {
  enum SwapState {available,open,started,ended}
  SwapState public currentState;
  address public counterparty1;
  address public counterparty2;
  uint public notional;
  bool public long;
  uint public margin;
  address public oracleID;
  bytes32 public endDate;
  address public creator;
  uint256 public startValue;

  event Printuint(uint _value);

modifier onlyState(SwapState expectedState) { if (expectedState == currentState) {_;} else {throw; } }
modifier onlyCreator{if (msg.sender != creator){throw;}else{_;}}

function Swap(address OAddress){
    d = Oracle(OAddress);
    oracleID = OAddress;
    creator = msg.sender;
    currentState = SwapState.available;
}

Oracle d;

  function CreateSwap(uint _notional, bool _long, bytes32 _startDate, bytes32 _endDate) onlyState(SwapState.available) payable returns (bool) {
      margin = msg.value;
      counterparty1 = msg.sender;
      notional = _notional;
      long = _long;
      currentState = SwapState.open;
      endDate = _endDate;
      startValue = RetrieveData(_startDate);
      Printuint(startValue);
      Printuint(margin);
      log0("Testing Log");
      return true;
  }

  function EnterSwap() onlyState(SwapState.open) payable returns (bool) {
      if(msg.value == margin) {
          counterparty2 = msg.sender;
          currentState = SwapState.started;
          return true;
      } else {
        throw;
      }
  }
    mapping(address => uint256) balances;
    mapping(address => mapping (address => uint256)) allowed;

  function PaySwap() onlyState(SwapState.started) returns (bool){
      var endValue = RetrieveData(endDate);
      var change = (notional * (startValue - endValue) / startValue) * 1000000000000000000; //convert wei to ETH
      var lvalue = change >= margin ? (this.balance) : (margin + change);
      var svalue = change <= -margin ? (this.balance) : (margin - change);
      var lparty = long == true ? counterparty1 : counterparty2;
      var sparty = long == true ? counterparty2 : counterparty1;
      if (lvalue > 0 ){
            lparty.send(lvalue);
      }
      if (svalue > 0){
          sparty.send(svalue);
      }
      currentState = SwapState.ended;
      return true;
  }

  struct DocumentStruct{
    uint value;
  }    
  function RetrieveData(bytes32 key) public constant returns(uint) {
    DocumentStruct memory doc;
    doc.value = d.documentStructs(key);
    return doc.value;
  }
}

        
      

Contracts can be visualized using solgraph and “dot”:

  • To install solgraph:  npm install --save -g solgraph

  • To convert to graph with dot:  solgraph swap-contract-example.sol > swap-contract-example.dot

  • To convert dot to png: dot -Tpng swap-contract-example.dot > swap-contract-example.png

Conclusion

There are many other promising use cases for blockchain applications in capital markets, especially in OTC securities such as swaps, to help reduce risks, frauds, and costs; automate processing and compliance. In the near term, there are still many challenges to overcome in realizing the potential of blockchains in the capital markets, including:

  • Fragmented architectures, protocols and development tools

  • Integration to existing systems, such as accounting and reporting systems

  • A need for easy-to-use and user-friendly cross-platform contract specification language, and contract analyzers, e.g. Oyente,  and testing tools

  • A need for standard an inter-ledger protocol

  • Bernard Lin

    Account Principal

    Bernard is an Account Principal based in New York. Bernard has extensive experience in financial services and capital markets. Bernard's experience includes high performance distributed application development, cloud computing architecture and DevOps, big data analytics, machine learning and blockchain technologies. Bernard had led large-scale cloud transformation/migration projects at global publishing and financial services corporations.