In order to buy an NFT, you need to interact with a smart contract. But what exactly is a smart contract? Let me explain.

What is a smart contract?

A smart contract is a program on a blockchain, such as Ethereum, that runs when certain specified conditions are met. In addition to this automatic response to predefined events, smart contracts also have the benefits of not requiring an intermediary.

To put it simply: developers use code to write ‘if-this-then-that’ statements on the blockchain. The network of computers forming the blockchain verify that the conditions have been met, execute the dependent action and then record the completed transaction.

A smart contract executes a transaction between two or more parties. One or more of the parties can be anonymous. The parties do not need to know each other, the trust lies in the blockchain, or rather the decentralised and distributed nature of the blockchain. Part of the very purpose of smart contracts is to enable such transactions without thee need of a middle man.

What can be in a smart contract?

Smart contracts are currently widely used to mint, buy and sell NFTs of digital art. In the case of buying an NFT, when you transfer your ETH, you meet the requirements of the smart contact and the NFT is transferred to your wallet on the blockchain.

A smart contract could be used in the transaction of almost any digital or physical item. You can put any terms or requirements into a smart contract, but it must be possible for the requirements to be represented or transmitted as data on the blockchain. For example, you could write a contract that says ‘if Ola climbs to the top of the mountain, then transfer Ola 1 ETH’. Ola’s presence at the top of the mountain might be verified by satellite data or a face scanner at the top of the mountain. Whichever mechanism was used, it would need to be connected to the internet and the information sent to the blockchain.