Smarts Contracts

Smart contracts were first described in 1994 by Nick Szabo, an American computer scientist who invented a virtual currency called “Bit Gold” in 1998, as a computerised transaction protocol which execute the terms of a contract. Terms of the agreement between parties, that can represent contractual clauses like property rights, employment and marriage could be defined in the code, which controls the acceptance and fullfillment of the transactions and the actions to be followed when those transactions are being executed.

Although defined years before the invention of Bitcoin, which marked the the introduction of blockchain technology to the world, smart contracts were not able to runs in a decentralised, immutable and permissionless network, and these digital contracts relied on centralised registries and trusted parties. Bitcoin made it possible!

Thanks the development of Ethereum, initially described and developed by Vitalik Buterin, the smarts contracts could be deployed in the network and get integrated to the web apps easily, bringing wide adoption of the Ethereum network and making Smart Contracts term better known by the IT community and the general public.

Smarts Contracts are blockchain (and tech) agnostic but most of the projects are being done in Ethereum, that can eventally be deployed in a public or private network. Contracts deployed in ethereum network are immutable, all transactions are traceable and the code and transactions are public if deployed in the public network. Those characteristics prevent the deployer of the contract to change the rules, the registries are never lost and allows anyone to verify the code when in public network.

Some Smart Contract patterns to highlight with real usage are the fungible (ERC20,ERC777) and non-fungible (ERC721) tokens.

Fungible vs. Non-Fungible

Fungible tokens which represent the overwhelming majority of tokens are digital assets built so that each individual token (or fraction of a token) is equivalent to the next. The owner of the token sends it to another person, allows someone to use it or burn it.

Non-fungible tokens are designed to be special, think collectible items such as precious gems. They come in all different sizes, grades, and cuts. This makes it difficult to determine if any two gemstone – diamond for example – hold the same value.

Non-fungible tokens represents things that are unique and each unit has its own characteristics (which can be similar, equal or totally different) such as property rights, car’s ownership, a project’s labor, a book and many others things that exists in real world.

Blockchains are not suitable to store large contents due to blocks (sets of transactions) size limit; and the cost of transactions depend on the size of the blocks. However, they’re perfect as identifiers of large contents stored in centralised databases (sql and no-sql centralised databases like MySQL, MongoDB, ElasticSearch or storage systems like GoogleDriver, AWS S3, Dropbox) or decentralised storage networks (IPFS, Storj, Swarm, Sia), allowing smarts contracts such as non-fungible tokens to refer to large amount of data without increasing the cost associated with the storage of the token’s attributes.

Smarts contracts deployed in Ethereum network can not communicate directly with other systems outside the blockchain but systems can react to smarts contract’s transactions and their emited events. This allows systems to perform off-chain operations such as a bank payment, getting data from other sources and returning them by sending another transaction that contains the location of the data, edit a registry in a centralised database and many others use cases.

Smarts Contracts allow transparency and traceability of agreements or actions done between parties, representing a great tool to increase the speed and reduce the cost of processes like bureaucratic operations, transfer of anything of value, supply chain of merchandises and so on. Alongside other technologies such as Blockchain and decentralised storage systems like IPFS, Smarts Contracts have a huge potential to represent real contracts; systems can behave according to the rules defined in or the events emited by these contracts, which is a great deal for Internet of Things (IoT) and many other applications.