Smart Contracts and its role in Ethereum transactions

Smart contracts mean different things depending on the blockchain platform. Ethereum smart contracts are short computer programs that are stored on Ethereum’s blockchain, replicated across all the nodes, and are available for anyone to inspect. There are two steps that are performed separately:

  1. Uploading the smart contracts to Ethereum’s blockchain
  2. Making the smart contract run
smart contracts
Image Source Google

How do Smart Contracts operate?

A smart contract can be uploaded by sending the code to miners in a special transaction. If the transaction is successfully processed, the contract will then exist at a specific address on Ethereum’s blockchain. You may then make it run by creating a transaction that says ‘Please run the smart contracts found at address x’. A basic smart contract creates a token called ‘GavCoin’ that initially issues 1 million GavCoins to the creator of the smart contract and then allows them to send GavCoins to other users

For a real example of a smart contract, the smart contract that holds the balances of the Indorse ICO tokens can be found at the address 0xf8e386eda857484f5a12e4b5daa9984e06e73705. Once a contract has been uploaded, it behaves a bit like a jukebox. When you want to run it, you create a transaction pointing to the smart contract and supply whatever information the contract expects. You pay gas to the miner to run it.

As part of the mining process, each miner will execute the transaction, which involves running the smart contract. The miner who successfully wins the proof-of-work challenge will publish the winning block to the rest of the network. The other nodes will validate the block, add the block to their own blockchains, and process the transactions, including running the smart contracts. This is how Ethereum’s blockchain gets updated, and how the state of the EVMs on each node’s machine is synchronized.

Smart Contracts in Ethereum

Ethereum smart contracts are described, as ‘Turing complete’. This means that they are fully functional and can perform any computation that can be done in any other programming language.

Smart Contracts programming languages

Contract languages: Solidity / Serpent, LLL (Lisp Like Language)

The most common language that Ethereum smart contracts are written in is Solidity. Serpent and LLL can also be used. Smart contracts written in these languages will all compile and run on Ethereum Virtual Machines.

  • Solidity is similar to the language JavaScript. This is currently the most popular and functional smart contract scripting language.
  • The serpent is similar to the language Python and was popular in the early history of Ethereum.
  • LLL is similar to Lisp and was used mainly in the very early days only. It is probably the hardest to write in.

In the very next session on Ethereum, we take a look into the history and the Evolution of the smart Ethereum over time.

 

Suggested Topic

Ethereum and Bitcoin, a comparative and comprehensive study

 


If you like our blog and posts, please share them with your friends and spread the word. Please feel free to share your suggestions and feedback in our contact and help us to improve at this.


Latest Posts

Follows us on Social Media

[FaceBook] [Twitter] [Pintrest] [InstaPaper]