visit
Fast forward to 2013, when introduced smart contracts to the world of blockchain through ‘Ethereum’. An open-source,
blockchain-based, distributed computing platform which supports smart contracts, quickly turned out to be a game-changer.
Smart contracts paved the way for a variety of trustless distributed applications () and encouraged a host of blockchain projects, each trying to bring about a paradigm shift in its own way.
Time-lock contracts are one of the simplest and most common forms of smart contracts. As the name suggests, digital assets deposited to these contracts are ‘locked’ for a pre-defined period of time, before the assets can be retrieved by the sender. Such contracts typically come with a
‘time-lock’ function, which sets a numerical timestamp for each deposit
address. Tokens can be withdrawn to a certain address only after the associated timestamp has expired; prior to that, the lock contract only accepts deposits.
Time-lock contracts are ubiquitous in DeFi applications.Services such as and, which let users loan their digital assets for a certain amount of time (and earn interest), make use of lock contracts to automatically allow users to retrieve their funds on expiry of the loan period. A special form of time-lock Contract, known as Hashed Time-Lock Contract (), is used in payment channels to eliminate the risk of counterfeit. In case of a HTLC transaction, the recipient of funds has to acknowledge the payment by submitting a cryptographic proof within a specified timeframe, otherwise the funds are returned to the original sender.Apart from the time-lock function, a HTLC also contains a hash-lock – a function that prevents the recipient from spending the funds until a certain cryptographic proof is publicly broadcasted.
, a scaling solution for Bitcoin transactions, is one of the most use cases of HTLCs.Funds can be between two users in a trustless manner user through interconnected payment channels (more on that later), even when they are not directly connected. HTLCs are also used in, where users can ‘swap’ cryptocurrency from one type to another, without the need of any centralized intermediaries.
use a smart contract to enable users to transact multiple times, without recording every single transaction on the blockchain.Intermediate transactions are recorded off-chain, and on completion, when the payment channel is closed, the final state of the participants is published on the blockchain.Irrespective of the number of transactions, only one block has to be mined when payment channels are used. As already mentioned in the context of Lightning Network, by creating a mesh of payment channels, a secure and distributed network connecting multiple users can be created.
However, simple time-lock or hash-lock features might be insufficient for payment channel smart contracts, and additional features might be necessary to make them robust. For example, the (check lock-time
verify) feature was introduced to such smart contracts to avoid. Other upgrades include time-locking transactions in a manner
such that the last state of the channel always has the lowest time-lock, and is the first one that can be broadcast on the blockchain.
, an open-source blockchain platform project, has recently implemented payment channel smart contracts in their version.These smart contracts consider 3 variables – the accumulated load that the sender loads into the channel, the accumulated payment that the sender has already paid, and the expiration timestamp beyond which the receiver can no longer accept funds. These three variables can only increase, which ensures the presence of a certain amount of funds in the channel for the receiver, and enables the recipient to withdraw the collected funds without waiting for the channel to terminate.
ALCs contain application specific code, which can work in conjunction with other smart contracts and programs on the blockchain.They aid in communicating with and validating communication between different IoT devices. Since there is no third-party required to oversee transactions, these smart contracts can effectively oversee micro-payments between different IoT nodes.
is one of the premier blockchain projects working in this field. Technically, it wouldn’t be correct to term it ‘blockchain’, as their data
structure is termed Tangle, but let’s not get into these technicalities
here.
In a recent, Iota stated that they would be developing their ALCs off-chain, outside the core protocol of the tangle.For on-chain smart contracts, every network node has to keep a copy of each contract’s program code and state, and execute the code when the smart contract is triggered. By transferring them off the tangle, Iota’s ALCs can be executed in a localized manner, greatly improving the network scalability.
A non-fungible token () is a cryptographic token that represents a unique digital asset. Fungibility is the property of an entity whereby the
individual units are interchangeable and indistinguishable from each other.
NFTs are being increasingly used in blockchain-based, to represent the ownership of unique items which are of value within the gaming ecosystem. Exchange of such items across different games is also possible through these smart contracts.
These NFTs are created using smart contracts. What sets non-fungible contracts apart from other smart contracts is that each such
contract represents only one unique token.
is one of the most prominent blockchain projects which make use of non-fungible smart contracts.In Decentraland's virtual environment, players can explore, create scenes and artworks, and own and exchange in-game NFT items, in a decentralized virtual reality world. Other games like and (the infamous) also issue in-game characters and items through non-fungible smart contracts.
PS – Being from a non-blockchain background, searching for different
varieties of smart contracts on the Internet turned out to be a notoriously
difficult task. Thank god for Binance Academy and the announcement posts of blockchain projects upgrading their smart contracts! If you know of any that’s worth a read, please do leave a comment here.