Bilateral Smart Derivatives with BAPI

Let’s start with some background; Nfq Advisory Solutions is a company specialised in consulting services on capital markets (wholesale banking, risk finance, asset management, and private banking). One day we took the decision to jump on board the latest technology wave, blockchain. More particularly, Ethereum, the network where anything unimaginable can be built. And, that’s why for such network, we decided to develop a platform that applies to the industry we work on, Finance.

Here is a quick demo of the platform’s look:

https://www.youtube.com/watch?v=Z1Cc7uxAlhw&t=5s

Allow me to explain to you the reasons for this platform to exist.

When talking about the financial industry, we can summarise the current state of the industry feelings with the following picture:

The industry is about to go under very big transformative changes. That is why they need to look at blockchain technology with bright eyes to help improve the current systems to a level never imagined before. The BAPI platform is a small initiative developed in Spain to show how current technologies such as smart contracts and digital tokens can help transform the wholesale markets.

What does the platform offer?

Financial institutions can enter into binding legal agreements through the use of the Ricardian contracting style. Financial instruments can be represented and tied to the execution of one or various smart contracts. These contracts manage the institution’s collateral in a totally transparent and decentralized manner.

The tools around the platform:

In order to operate in the network, all parties have access to the following tools.

  • The Platform is the tool used to interact with other peers, Smart Contracts and the blockchain. It will be used to craft all of the agreements.
  • The Smart Contract Factories are handled by the Platform. This means that parties are not the owners.
  • The Ad-Hoc Smart Contracts will not be controlled by the platform. They will be controlled, only and only, by the parties involved in the agreement. In other words, both parties the private keys of the contracts.
  • The Blockchain is in charge of hosting the Smart Contracts that will automatically execute all of the agreed conditions without the need for any manual intervention.
  • A smart oracle is used to connect real-world market data and feed it to the smart contracts.
  • The valuation engine is connected to the derivatives Smart Contract so all of the parties know the value of all of their operations.
  • The Smart contract verifier is used by the parties to validate that no line of code has changed in the contracts deployed.

But, how do all these parts interact with one another:

The Contract Deployment Process

Let’s say that Two Financial Institutions, that are members of the network, would like to start trading bilateral derivatives with each other. In order to do so, they access the platform and hop over to the template’s agreement tab to draft the contracts. The first agreement both parties need to sign is the ISDA Master Agreement. Once both parties have signed it, a smart contract call to the ISDA Factory is activated, creating a Smart Contract that represents the ISDA contract.

Now, in order to continue the process, the parties need to agree on the terms of the Credit Support Annex. It is imperative to introduce the address of an active ISDA in order to draft a CSA. If not the contract will not be allowed to be executed. After both parties have signed, a smart contract call to the CSA Factory is activated, creating a CSA smart contract.

Finally, to create a derivative contract, the parties must introduce the Address of an active ISDA and the address of an active CSA. Both parties can now engage in bilateral trading. Once both parties have signed, a smart contract call to the Derivatives Factory is activated, creating a Smart Contract. Due to the nature of blockchain, since all contracts are linked together, there is a perfect trail for all the operations conducted.

Each Derivatives Smart Contract will have tokens embedded which will operate in a fully autonomous way. The ERC-20 tokens are intended to represent the notional amount and are used for internal contract payouts. All of the Derivative Smart Contracts interact with a series of Smart Contracts that are intended to make the management of the contract life-cycle easier. At the same time, they are connected to another Smart Contract that acts as an Oracle. This Oracle is in charge of providing the necessary financial data for the contract’s execution (for example, currency pairs, Euribor, etc).

Meanwhile, on a daily basis, all of the Derivatives Smart Contracts are connected to a valuation engine that writes each of their valuations into a Smart Contract. Since this Derivatives Valuation Smart Contract is connected to the CSA Agreement, the total valuation of all of the operations is registered daily. This way, the collateral held under the contract can be managed automatically. In order to manage all of the collateral, the CSA Agreement is also connected with a Smart Contract that acts as a Fiat-Crypto Bridge. This bridge allows companies to create unique tokens to be used as collateral for their counterparties.

Asset Tokenization

The Fiat Crypto Bridge process works in the following way: In order to create tokens, such as cash or asset titles, the financial institution will need to connect its current platforms via an API to the Smart Contract. The goal is to establish a 1:1 Ratio between the parties’ real-world assets and the tokens they own across the network. Once the smart contract receives the message that the party has transferred the cash or asset, it creates a ERC-721 unique token. Now the Financial Institution owns tokens that are pegged to real-life assets. These Tokens can now be shared across network participants, for example, using them as collateral, or, as a mean of payment between parties. If parties want to cash in their tokens, they need to burn them in order to claim the cash or asset they represent in the real world. Once all of the network participants have confirmed the burning of the tokens, the party will no longer be able to use them in the network.

Overall Benefits

While using the BAPI platform, financial institutions can benefit in many ways:

Some of the market benefits obtained are:

1. Automatic Contract Variables Update with Blockchain Oracles.

2. Increase in transparency due to the nature of Blockchain networks,

3. Better Price Distribution

4. Peer to peer Liquidation between contract participants

Some of the Business benefits obtained are:

  1. Consensus on the valuation of the financial instruments due to the implementation of a trustable data in a valuation engine.
  2. Automatic collateral management by connecting smart contracts to the valuation engine
  3. Non-custodial contracts, where no one besides the parties involved in the contract has control over the tokens deposited in the contract.
  4. Digital Identification system for every actor involved in any manner in the contract life cycle.

Some of the benefits that lower the entities costs are:

  1. Massive Reduction in both Manual and Paper-based tasks.

2. Automatic contract conciliation with the rest of the entities’ systems.

3. Real-time risk analysis of the financial entities balance sheet

4. Instant Contract Data reconciliation with all the counterparties.

Technology Behind the Platform:

The platform can work in any Ethereum compatible networks (Quorum) but has a special focus on the Alastria Network. There, we can use the privacy features to embed the contracts into the private communication channels between the nodes of the networks. Since Alastria network is only available for members, we decided to move the platform to Ethereum, and wait until developments such as zero knowledge proofs or ZK Snarks improve the privacy on Ethereum.

Initially, while we were building our platform, we took advantage of the Kaleido platform services. Thanks to their platform, we were able to test how our product would be configured and how it could connect with third party services such as Openlaw. Once, we finished developing the contracts, we used MythX opensource tools to audit our contracts. Thank you for the great tool that helps you deploy smart contracts with peace in mind. Once we finished our platform, we connected it with Openlaw’s platform. It was the last piece of the puzzle, by using Openlaw tools we were able to connect our smart contract architecture with a legal interface for them. See the video for more info. Lastly, we connected the smart contracts with the appropriate oracles so they could self execute without any intervention. Thank you Chainlink for providing us with a way to bring real-world data into the blockchain. Thank you Infura for providing us a node to connect all the smart contracts calls. And lastly, Szena Risk, the valuation engine developed inhouse at Nfq.

Big mention to Openlaw (thank you #davidroon, #jarrel #priyadesi, #awright) without your help, the platform would not be as complete as it is.

Let’s decentralize the future of banking!

Developed by Javier Fraile, Jesús Gil, Carlos Matilla and Alex Viñas Salles at NFQ Advisory Solutions.