Smart Contract

Decentralized Insurance for Smart contracts

Computer keyboard with post title

One of the largest events that has impacted the smart contracts ecosystem is the lack of security and an ever increasing number of vulnerabilities in the decentralized space. A very detailed account of vulnerabilities in this smart contract ecosystem has given analysts, security firms such as trail of bits a lead in detecting and to some extent recommending best practices. That being said, there are too many of these issues to be tracked by teams building Dapps across the world. Very often these teams are understaffed and automation with tools such as Slither – which does static code analysis, and Echidna – a fuzzer for smart contract code accomplishes only so much. According to this detailed report by Trail of Bits, there are more than 246 different types of vulnerabilities that they discovered.

This is virtually impossible to detect and test using any type of automation, across all the millions of smart contracts that exist out there. As a result, Firms such as Nexus mutual have introduced a pooled insurance policy for smart contracts.

Their workflow is documented here : https://nexusmutual.gitbook.io/docs/use-cases

Whenever, a smart contract deals with finances of individuals or contracting parties, nexus mutual’s funds provide a significant fallback to users. Nexus Mutual allows individual users to provide guarantees for use cases that are not tested and that tend to loose funds or operate unexpectedly. Insuring smart contracts is also a community activity in which all those users who have participated in a particular smart contract system, can pool in resources to an insurance pool and be compensated in times of a crisis.

On the overall, what we see is an insurance plan that can protect people against the downside. however adoption questions remain

a. Will decentralized finance users who have no insurance subscribe to nexus mutual?

b. Will non decentralized finance users take up insurance using nexus mutual?

c. What about insurance products that are not dependent on code per-se and can protect investments or locked up funds in contracts against market fluctuations?

Securitization of Physical Assets through smart contracts

The true power of the crypto-ecosystem and blockchains lies partly in the fact of creating legally viable “mechanisms” of trade that is overseen by the network, and is truely location agnostic. For example, if one were to own the rights for an asset (say a music streaming service or rights to a particular song), then one would have to negotiate with the musician or his/her representative directly to purchase the rights and then create a physical contract. This mechanism is true for any asset, physical or digital. In the research paper published in Managerial Finance on security tokens, I provide an architecture for converting physical and digital assets can be made tradeable – using ethereum based smart contracts. Deloitte consultancy recently released a whitepaper that outlines many advantages of securitization here.

Advantages of Securitization

Some of these advantages include – a reduction in trade friction i.e., in the example above, the buyer does not need to negotiate with the seller (i.e., musician or his agent each time), since the terms of trade are already existing on the network, or have been templatized and are accessible on the smart contract platform. Secondly, the buyers and sellers can engage in a partial trade i.e., instead of selling the whole right or property, the seller could part-sell his asset similar to equity. Thirdly, innovative financial instruments similar to options or reinsurance could be offered against these tokens- as smart contracts. Fourthly, while the physical world guarantees a value for an asset through a known mechanisms of “valuation”. E.g., home owners could find the values of their homes based on valuation metrics, etc. While these “valuation” metrics are usually based off – of past valuations, they often do not incorporate current price discovery based on market capacity.

A securitization exercise could often lead to a “price” discovered that is often different than existing “valuation” metrics, often providing a bigger advantage to both the seller and smart buyer. Finally, an advantage that is increasingly becoming important is that of providing an “extended unfettered” access to physical assets irrespective of location or country of origin or even source. For example, a buyer from Russia could own an asset in Zambia that has been securitized..

Each of these advantages, that were identified are now becoming a reality, slowly. For example the DAI platform recently voted to bring in physical assets. While the technical implementation of such a system that converts physical assets (or other virtual assets) into trade able securities is easily accomplished using smart contracts on a host of platforms, the socio-legal challenges for such an approach persist. For example, what would happen if a buyer purchases equity in a property at an inflated price e.g., a collection of songs from a musician. What happens if the owner decides to liquidate the property or decides to sell the rights to another buyer. How would jurisdictional prudence – play a role in enforcing the smart contract, suppose one of the parties to the contract. What jurisdictions would bind such an agreement? Are reputation systems sufficient to attract and maintain such a marketplace where real physical assets are bought and sold and valuations can quickly sky rocket?

Reference:

Subramanian, H., 2019. Security tokens: architecture, smart contract applications and illustrations using SAFE. Managerial Finance.

Introduction To Bitcoin Lightning Network

Lightning Network

The Bitcoin Lightning Network is a payment protocol that operates on blockchain network. It enables faster bitcoin transactions between participating nodes and has been suggested as an off-chain solution for the bitcoin scalability problem. The Lightning network provides a peer-to-peer framework for creating micropayments of cryptocurrency(bitcoin) through a network of bidirectional payment channels between two nodes by creating a smart contract.

Bitcoin Blockchain Scalability Problem

The main scalability problem in bitcoin blockchain is the number of transactions per second and block size. As per the Lightning Network white paper proposed by Joseph Poon and Thaddeus Dryja, up to 7 transactions per second  can be facilitated with a 1-megabyte block size  limit in bitcoin blockchain. The block size limit is an artificial “hard coded” value for the number of transactions which can be recorded in a particular block. If there are more transactions, they have to be put into further or newer blocks ,as new mining takes place. The block-size limit combined with the mining limitation reduces the throughput of the bitcoin network greatly.

Payment networks like Visa currently enable 45,000 transactions per second  (i.e., about 150 million transactions per day).  If bitcoin has to support 45000 volume transactions, according to some estimates, the block size would have to be set to  8 gigabytes,  since mining is limited to 1 block every ten minutes. It is  physically impossible for the personal computers or mining machines or even nodes to operate with this kind of bandwidth and speed, given the complexities.

To reduce this transaction scalability problem                         

Joseph Poon and Thaddeus Driya proposed a network called lightning network to solve this. The Lightning Network creates a second layer on top of the bitcoin blockchain network which enables micropayment channel option for bitcoin through a network of bidirectional payment channels between two nodes by creating a smart contract(HTLC). Once the transaction is done between two nodes in the micropayment channel,  this transaction will be an off-chain transaction. The channel balance is reflected without broadcasting a transaction on the blockchain. Once everyone starts to create a micropayment channel between nodes this reduces the scalability problem.

Bidirectional payment channel

To initiate this channel the two nodes Alice and Bob should lock some funds to the channel. Once funds are deposited,  Alice and Bob will have full access with security cover, on the network. With the duplex micropayment channel and lightning network,  Alice and Bob can send and receive funds from to each other in a secure mode. By connecting (n) number of micropayment channels, Alice and Bob can make (n) number of payments between different nodes.

HTLC – Hashed Time lock contract

Once the payment channel is set up, Alice and Bob need a contract between sender and receiver.  A smart contract called Hashed Time Lock Contract enables this transaction, that will create an output which is redeemable only by the final recipient. The receiver first generates random data R and hashes the message R using hash(R) to produce H. This information is provided directly by the final recipient to the sender along with his bitcoin address. The sender initiates this fund transaction to the receiver. When the transaction is updated in the micropayment channel, the receiver can redeem the transaction by revealing the random data(R). This will debit the funds from the sender. If the receiver fails to produce random data R within three days then this transaction will be invalid and funds are locked within the contract.

To participate in HTLC the sender and receiver require a message R.

Eg… Let see how Alice and John transfer funds through a multi-hop system.

  1. If Bob can produce to Alice an unknown 20byte random input R. Within three days, then Alice will settle the contract by paying 0.05BTC to Bob.
  2. If Bob has not disclosed the R before three days then this transaction will be invalid. Both parties must not attempt to settle or claim after three days.Bitcoin Lightning Network

Once a channel is setup between Alise and bob, then the same channel can be used in a multi-hop process to send funds to John.

Alise, has an open channel with Bob, and John has an open channel with Smith, and Smith and Bob have a channel together, a payment can be transferred by connecting these different micropayment channels together and this is called Multi-hop transfer.

The Current State of the Bitcoin Lightning Network

Currently Lighting network has more than 3250 nodes as on 17Feb2019  and 25580 active channels on this network. The total bitcoin circulation in this network is 695.907 BTC (2,530,194 Usd).

Active Channels in Lightning Network
Active Channel in Lightning Network

Lighting Network channel
Lighting Network Nodes

Bitcoin capacity across all channels
Bitcoin capacity across all channels

Source – https://bitcoinvisuals.com

Applications like ACINQ and Blockstream are working on lightning network development.

 

Introduction to ENS and Smart Contract Functionality

Domain name Vs Ether Graph

Ethereum Name Service

ENS (Ethereum Name Service) is an entirely decentralized system. Launching new domains with the “.eth” (e.g., “notesnewtech.eth”) is handled by an auction process that runs on the Ethereum blockchain and anyone can participate in the auction process to reserve a domain for themselves. ENS which allows Ethereum users to replace long addresses0x44ef629E2f83D64a9b25E519bc84C0e7a8726F98  with human-readable names attached to a .eth domain.

The process of buying and using a .eth domain is similar to buying and using a domain for a website. The difference is that instead of using the domain to host a website, you use it to receive Ethereum.

Benefits of Owning an ENS domain:

  1.  The owner of an ENS domain can point it to whatever resource he chooses. Eg, wallet address. Or another ENS domain.
  2.  One can also create a subdomain of the main domain and assign them to different addresses. E.g., <blog.notesnewtech.eth>,Here is the future of Subdomain market.
  3. Ens domains and Subdomains can be resold in marketplaces such as enslisting.com, namebazaar.io.

Most Valuable Domain Names

Here are the top 10 domain name and its value:

Domain name Vs Ether Graph

Source – https://etherscan.io/ens?filter=mostexpensive

Smart Contract Functionality:

Smart contracts are written in a solidity programming language which can use the domain directly to replace complex numerical codes. Imagine a contract that needs 10 different wallet addresses. It is definitely simpler addressing using the .eth domain. ENS registry consists of a single central contract that maintains a list of all domains and subdomains, The owner of a domain may be either an external user or a smart contract.

A registrar is solely a smart contract that owns a domain, and issues subdomains of that domain to users that follow some set of rules outlined within the contract.

Owners of domains in the ENS registry can :

  1.  Set the Resolver for the domain
  2. They can transfer the ownership of their domains
  3.  They can assign new ownership to subdomains.

Here are the updates on the state of the Ethereum Name Service, and plans for this year.

 

 

 

Decentralized Insurance – Etherisc

Etherisc

Etherisc  is a decentralized insurance platform and protocol. It addresses issues for expanding the scope of smart contracts in real-world applications.

The role of smart contracts in Insurance

Etherisc is a protocol for building smart contracts for risk monitoring, modeling and decentralized applications (Dapps) for insurance products. A Dapp is formally defined as a piece of software, which includes a user interface and a decentralized back end that makes use of the Ethereum blockchain and smart contracts An Etherisc insurance application, for example Flight Delay, runs on the EVM blockchain and can be used without human interface to automatically, reliably, and securely trade, issue, and settle payouts for flight delay insurance contracts over the internet.

The Etherisc protocol standardizes the syntax for creating insurance products from smart contract-based infrastructure. A necessary external component of such contracts is the use of 3rd party data sources for triggering contracts via APIs, which are called “oracles”.  Etherisc applies smart contracts to encode an entire insurance workflow from policy pricing, to issuance, to claims, and settlement.

Decentralized blockchain-based approach to insurance is to decrease the conflict of interests embedded in ordinary insurance contracts, in which insurance firms are profit-maximizing and design overly restrictive contracts because of a financial interest to not pay out claims. The incentive derived from utility for each party in a contractor (i.e. insurance provider) and the insured are completely different. By using the blockchain to automate insurance transactions and record critical data on the blockchain.

Current products built on the Etherisc platform

Flight Delay, HurricaneGuard, Collateral Protection, Crop Insurance, and Social Insurance. Each product uses modified smart contracts with a backend of the Etherisc protocol, Ethereum blockchain and 3rd-party APIs to price, underwrite, monitor, trigger, and payout.