Skip to main content

Nano contracts

info

Nano contracts feature is being progressively rolled out but is still in beta testing, and currently only available on Hathor Network testnet. It is not yet available on Hathor Network mainnet.

TL;DR

Nano contract is a type of smart contract exclusive to Hathor technology. Every smart contract deployed on Hathor blockchain is referred to as a nano contract. The distinguishing factor of a nano contract compared to a conventional smart contract is that Hathor platform provides contract templates, making it possible to create contracts on Hathor blockchain without needing to develop their code.

Introduction

This article talks about nano contracts. We will cover:

  • what nano contracts are;
  • how they are different;
  • what problems they solve;
  • what their advantages are;
  • what their capabilities are; and
  • how to use them.

Glossary

This term is used throughout this article:

  • Smart contract is a software that is stored on, executed by, and has its outputs recorded on a blockchain network.

What are nano contracts?

Nano contracts are an exclusive feature of Hathor that enables users to create smart contracts without needing to develop them, in a more secure, easy, and rapid manner. Nano contracts are Hathor's approach for smart contracts. Every smart contract deployed on Hathor blockchain is called a nano contract.

To create a nano contract, a user does not need to develop its source code. They may just select an available blueprint that can acommodate their use case, and define the values for the set of parameters that such blueprint needs to uniquely specify the use case.

A blueprint is the source code that models a general category of nano contracts use cases and serves as a template for creating a nano contract. Hathor platform provides its users with a catalog of blueprints. The catalog of blueprints is the set of all blueprints built in Hathor.

How are they different?

The following diagram depicts the difference between creating a conventional smart contract and a nano contract:

Conventional smart contract vs nano contract

For example, suppose a betting company wants to create a smart contract that implements a betting option. On other blockchain platforms, the company would need to design, implement (code), test, and audit the smart contract before deploying it on the blockchain network.

In turn, on Hathor, the company can skip the development, test and audit stages of the smart contract implementation. Hathor has in its catalog the bet blueprint. Bet is a blueprint that can be used to model betting options. Thus, the betting company can select the bet blueprint, and define the values for the set of parameters that the bet blueprint needs and that uniquely specify the betting option. Such set of parameters may include, for example, the description of the betting event, the odds, the possible results that bettors can place bets, etc.

What problems do they solve?

Nano contracts were conceived to address the major problems in the conventional approach to smart contracts, namely:

  1. High development cost
  2. High code complexity
  3. High security risks
  4. High auditing cost
  5. Low scalability
  6. High operational costs
  7. Immutability dilemma

What are their advantages?

For solving or at least mitigating the problems presented in the previous section, we can synthesize that nano contracts have four key advantages over conventional smart contracts:

  • Affordability
  • Usability
  • Security
  • Efficiency

Affordability

Nano contracts are more affordable. They are accessible to users who otherwise would not have the resources to use them. Some individuals and organizations would not have money, time, and personnel to develop conventional smart contracts, but they can have the resources to create nano contracts. Nano contracts make blockchain projects accessible to a vast number of previously overlooked users.

Usability

Nano contracts are easier to create. Creating nano contracts is both practical and convenient. The challenges of contract development, code complexity, code auditing, and security risks are all managed by blueprint developers, allowing users to focus solely on the use cases they aim to build on the blockchain.

Security

Nano contracts are more secure. With conventional smart contracts, it is up to the team to ensure the entire project's security, before deploying it in the blockchain, whereas with nano contracts the project team shares such burden with blueprint developers and Hathor community.

Efficiency

Nano contracts are more efficient. They rationalize the usage of capital and human resources of project teams, during the development stage. They rationalize the usage of computer resources of the blockchain networks, by preventing the deployment of poorly written smart contracts in the blockchain. And finally, they bring economy for contract users, by preventing high gas fees due to network bottlenecks.

What are their capabilities?

Nano contracts can be utilized for any use case that fits within a blueprint available in our catalog. Hathor community is working to expand the blueprints catalog to encompass the vast majority of common blockchain use cases.

How to use them?

Among our three official wallet applications (desktop, mobile, and headless), nano contracts are currently supported only by Hathor headless wallet, version 0.29.0 or later. The desktop and mobile wallet applications do not yet support nano contracts. New versions that include this feature will be released soon.

For third-party wallet applications that support Hathor Network, developers can add support for this feature using Hathor wallet library version 1.9.0 or later.

Key takeaways

In this article, we explained that:

  • Nano contracts are Hathor's approach for smart contracts, and every smart contract deployed on Hathor blockchain is called a nano contract.
  • Nano contracts work as off-the-shelf smart contracts. Thus, rather than passing through the entire cycle of development of smart contracts, one may just select a blueprint that is suitable for one's use case, and define the parameters that uniquely specify the contract based on this blueprint.
  • Nano contracts feature was conceived to solve several of the main issues with the conventional approach to smart contracts. Therefore, nano contracts are more affordable, easy to use, secure, and efficient.

What's next?