-
Note
For a comprehensive coverage of blockchain development in Ethereum or mastering Solidity programming, taking our below self paced courses is highly recommended:
Recap
In our previous article (How Ethereum Manages Transactions), we discussed how Ethereum process and manage transactions in a blockchain application.
In this article, we learn how blockchain smart contracts work in Ethereum.
Smart contract
A smart contract is an executable code that is digitally signed by the contract creator as part of contract account creation. It is like a scripted agreement between transacting parties; the code built into the contract is stored on the Ethereum blockchain and cannot be tampered with or removed. This greatly increases the credibility of the legal document.
Typically, DApp developers write smart contracts in some high-level programming language and then compile them into the bytecode. It is the bytecode living on the blockchain and executed within the EVM. There are not a lot of choices in determining which programming languages to use. The following are a couple of options that the developers may consider:
- Solidity: Solidity is the most popular one in the market for developing smart contracts. It is a JavaScript type language and is Turing complete.
- Vyper: Vyper is a general-purpose, experimental programming language that compiles down to the EVM bytecode, as does Solidity. It is a contract-oriented, Pythonic programming language that targets smart contract development language. Vyper aims to be auditable, secure, and human-readable. Being simple to read is more important than being simple to write.
- Serpent: Serpent is another pythonic programming language for smart contract development. It is largely deprecated. Serpent is compiled using LLL, a Lisp-like low-level language similar to Assembly.
Folks may wonder which one to use, Solidity or Vyper? For the majority of use cases, this is a personal preference. Solidity is the most popular one and has all tools and utilities in place for developing end-to-end decentralized applications. Vyper is still in the earlier experimental stage. On purpose, it omitted several programming constructs for being more secure, auditable, and human-readable. If your use case requires these, use Solidity instead of Vyper.
We will focus on the Solidity programming language in our article series. As covered in our future article series, we will show you, step-by-step, how to design and develop, test and debug, and deploy and monitor decentralized applications using Solidity, Ethereum, and various tools and utilities in Ethereum ecosystems.
One-to-One Live Blockchain Classes
Coding Bootcamps school offers One-to-One Live Blockchain Classes for Beginners.
Next Article
In our next article (How Ether and Gas Work in Ethereum), we discuss how Ether and Gas work in Ethereum.
This article is written in collaboration with Brian Wu who is a leading author of “Learn Ethereum: Build your own decentralized applications with Ethereum and smart contracts” book. He has written 7 books on blockchain development.
Resources
coming soon