Smart contract – definition and example

A smart contract is a contract that functions automatically thanks to lines of code rather than relying on intermediaries. Lawyers and notaries, for example, are intermediaries. In other words, it is a self-executing contract. Lines of code contain the terms of the agreement between the parties. The code exists across a distributed blockchain network that is decentralized.

Many cryptocurrencies have implemented different types of smart contracts. A cryptocurrency is a type of digital currency, i.e., a currency that exists only in electronic form. Bitcoin, Ethereum, Ripple, and Litecoin, for example, are cryptocurrencies.

Smart contracts are computer protocols that aim to digitally verify, facilitate, or enforce the performance or negotiation of contracts.

They allow the performance of credible transactions with no need for a third party. Apart from being trackable, these transactions are also irreversible.

Nick Szabo, an American computer scientist, cryptographer, and legal scholar first coined the term in 1994.

Smart contract has the following definition of a smart contract: “Smart contract is a piece of code which is stored in the blockchain network (on each participant database). It defines the conditions to which all parties using contract agrees. So if required conditions are met certain actions are executed.”

Smart contracts exist in the blockchain

Put simply; a smart contract is an unalterable agreement that the blockchain stores. It has specific logic operations just like real world contracts do.

As soon as this type of contract has a signature, nobody can ever alter it.

Regarding the use of smart contracts, The Mission says the following:

“A smart contract can be used to define certain computational benchmarks or barriers that have to be met in turn for money or data to be deposited or even be used to verify things such as land rights.”

Smart contract – a computer code

It is a computer code that runs on top of a blockchain. It contains a set of rules under which the smart contract parties agree to interact with each other.

When the parties meet the rules within the code, it subsequently enforces the agreement. It does this automatically

Regarding smart contracts, BlockchainHub writes on its website:

“The smart contract code facilitates, verifies, and enforces the negotiation or performance of an agreement or transaction. It is the simplest form of decentralized automation.”

What is a blockchain?

Blockchains provide cryptocurrency chains’ validity. The blockchain is an expanding list of blocks or records. The records are linked and secured using cryptography.

Cryptography is the art of creating code and also deciphering code.

There is a hash pointer in each block. The hash serves as a link to the previous block. It also contains a timestamp and transaction data.

Thanks to the blockchain creators’ designs, the whole system is resistant to data modification.

Webopedia makes the following comment regarding blockchains of its website:

“Blockchain refers to a type of data structure that enables identifying and tracking transactions digitally and sharing this information across a distributed network of computers, creating in a sense a distributed trust network.”

“The distributed ledger technology offered by blockchain provides a transparent and secure means for tracking the ownership and transfer of assets.”

Smart contract security problems

In their book ‘Blockchain Revolution,’ Don Tapscott and Alex Taspcott describe a smart contract as follows:

“A computerized transaction protocol that executes the terms of a contract.”

All the users of a blockchain can see a blockchain-based smart contract.

However, this open visibility leads to a situation where everybody sees the bugs, but nobody can fix them quickly. This problem also applies to security holes.

In June 2016, a successful cyber-attack on The DAO drained $50 million in Ether. They were all draining away while developers desperately tried to find a solution that would gain consensus.

Fortunately, the DAO program had a time delay in place. The time delay prevented the hacker from removing the money.

The developers created a hard fork in the Ethereum software to retrieve the funds from the attacker. They did this successfully before the time limit expired.

In a study titled ‘A survey of attacks on Ethereum smart contracts,’ Nicola Atzei, Massimo Bartloletti, and Tiziana Cimoli wrote:

“Issues in Ethereum smart contracts, in particular, include ambiguities and easy-but-insecure constructs in its contract language Solidity, compiler bugs, Ethereum Virtual Machine bugs, attacks on the blockchain network, the immutability of bugs and that there is no central source documenting known vulnerabilities, attacks and problematic constructs.”

Video – What is a smart contract?

In this Simply Explained video, Savjee explains what a smart contract is. He uses the smart contract that the crowdfunding website Kickstarter employs as an example.