What are Smart Contracts?

Start course

This course explores the theoretical side of blockchain technology as well as the practical elements. You'll learn what the blockchain is and the difference between private and public blockchains. We'll also cover smart contracts, and Web 3.0.


In this lecture, I want to help you understand solidity and smart contracts on a theoretical level. Reason being they are perhaps the two most key terms to really understand the depth. Before we dive deeper, I want to give you a brief understanding of how they're intertwined. As they're called, smart contracts are programs that exist upon the Ethereum blockchain. A smart contract can be programmed to run a variety of functions, whether that's transacting ERC-20 tokens, record keeping, blockchain based lotteries, and so on. There are many tasks. You may have noticed I mentioned the term programmed not so long ago. Well, this is how smart contracts are put together, because a smart contract is just computer program. The most common languages in which smart contracts are programmed is solidity. So, let me dive into solidity a little more with you now. This high level programming language was created by several Ethereum core contributors such as Gavin Wood for the purpose of smart contract development. If you've ever come across or used solidity, you'll notice the similarity between it and JavaScript. Solidity does the process of verifying and enforcing the constraints at compile time as opposed to the runtime. Getting right to the point, solidity is there to develop and execute code in the EVM i.e. the Ethereum Virtual Machine. Now let me switch over and go a little deeper into smart contracts with you. So, this is very new technology, smart contracts, is basically a means to exchange money, shares, property, vehicles, in fact anything of value without any need for a middle person. Best of all, a smart contract helps us do this in a secure manner. Naturally as with a traditional contract, there are terms applied, whether it's consequences for late payments and so on. But rather than this being written in a text form as is with the traditional contract, these terms are automatically applied to smart contracts if and when programmed in, hence making these smart contracts self-executable. So, as you can tell, the actual relationship between solidity and smart contracts is one of huge importance. A smart contract can't be created without the use of the solidity programming language with Ethereum. Solidity just happens to be the most popular language. Smart contracts and solidity combined allow a great number of ways in terms of allowing contracts to intra-relate with each other and interrelate with other contracts. Remember that it's not possible to change the code of a published smart contract. Reason being it would defeat the purpose of the immutable nature of the blockchain. However, upgradable contracts, so that's something where by implementing a newly positioned version of the marked contract while fixing some bugs is something which is possible, but that's not for this lecture. So, just to wrap up now, let me give you an example of a workflow of what a process of publishing a smart contract upon the Ethereum platform would look like. One, the developer or developers would write the code of the smart contract using solidity. Two, once the code is finalized, it will be uploaded to the Ethereum Virtual Machine. Three, once the code is on the EVM, it will then be the same across all nodes. Four, each node will then evaluate whether the conditions in the contract were met. Five, if met, the Ether will be redistributed as was coded in, if not, the clause that was coded in will kick in. And remember this transaction could be anything, whether it was a contract to deliver a web design project, signing the deeds of a house over, signing vehicle over, and much more. I'll see you in the next lecture where I'll be showcasing just how popular decentralized applications currently are. You may be surprised at that.

About the Author
Learning Paths

Ravinder is an expert instructor in the field of cryptocurrencies and blockchain, having helped thousands of people learn about the subject. He's also the founder of B21 Block, an online cryptocurrency and blockchain school.

Covered Topics