What is smart contract in the blockchain?

Blockchain Hat
2 min readApr 7, 2022

--

To understand what a smart contract is, you need to first understand what a regular contract is.

Definition of contract:

As a noun: a written or verbal agreement

As a verb: entering a formal and legally binding agreement

A smart contract is a regular contract except that it is created on top of a blockchain and exists as computer code. Inside this computer code, the rules agreed upon by the parities of the contract are defined, which once met, result in the execution of the smart contract code.

smart contract

Blockchain Hat provide personalized blockchain technology service and solution in a very smart way. We provide enterprise blockchain solutions all over the world. Our popular services are ICO/ST/IDO Development, DEFI Development, NFT Development, Tokenization, Dapp Development, Crypto Marketing service, and many more. Start your decentralized business with Blockchain Hat.

For example, lets take two parties, Naif with address 0x123 and James with address 0x456 on the Ethereum blockchain. I can create a contract to which I deposited 1 Ether which does the following:

  • If James with address 0x456 deposits 50,000 DAG (Constellation) tokens to this contract before 27th of Feb 2019, move the DAG tokens to Naif’s address and send 1 Ether to James address.
  • If James deposits this after the 27th of Feb 2019, refund his deposit and send back 1 Ether to Naif’s address.
  • If James hasn’t deposited the tokens, allow Naif to withdraw his Ether after the 27th of Feb, 2019
  • If Naif attempts to withdraw prior to 27th of Feb, 2019, reject this attempt.

In this smart contract, Naif and James have agreed to exchange DAG for ETH. Naif wants 50,000 DAG in exchange of 1 ETH. Naif has given James 3 weeks time to arrange these tokens.

--

--