Understanding Blockchain, Ethereum, Solidity and Smart Contracts

Understanding Blockchain, Ethereum, Solidity and Smart Contracts

HOW A BLOCKCHAIN WORKS

To understand what a blockchain is, it helps to understand what a database is and how it works. The difference between a typical database and a blockchain is that a database structures its data into tables whereas a blockchain like its name implies, structures its data into blocks that are chained together. A block is a growing list of transaction data linked using cryptography.

here's a pictorial representation of how blockchain works. source - investopedia

blockchain.webp

ETHEREUM

Ethereum is a decentralized, open-source blockchain with smart contract functionality.

On the heels of Bitcoin, Ethereum has become its own complex system, attracting engineers/developers from numerous industries.

Today, Bitcoin(denoted by the ticker symbol BTC) is used by people, governments, and corporations to transfer value and buy products or services. whilst Ether(denoted by the ticker symbol ETH) can be used similarly, it can also be considered a commodity, like fuel for the Ethereum network to run applications and services. So it has an additional dimension of intrinsic value over bitcoin; it is not just a store of value. You can check the Ethereum whitepaper to learn more.

SOLIDITY

Solidity is a statically-typed curly-braces programming language designed for developing smart contracts that run on Ethereum.

Solidity code can be used on the back-end of an application to add micro-payments, user accounts, and functionality to even simple computer programs, without the need for third-party libraries.

Written in a vacuum, much of solidity is intuitive for anyone familiar with Javascript, Java, or C languages. Although Ethereum applications aren't hosted on any single server, the guts of an Ethereum app are a series of simple contracts files that look like Javascript. You create them locally before deploying them to propagate around the whole network to be hosted in a decentralized manner. In this sense, Ethereum development combines both networking, app hosting, and databasing into one.

WHAT IS A SMART CONTRACT?

A contract in the sense of solidity is a collection of code that resides at a specific address on the Ethereum blockchain.

They are more like the concept of classes in conventional object-oriented programming. When developers speak of "writing smart contract", they are typically referring to the practice of writing code in the Solidity language to be executed on the Ethereum network.

// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.4.16 <0.9.0;

contract SimpleStorage {
    uint storedData;

    function set(uint x) public {
        storedData = x;
    }

    function get() public view returns (uint) {
        return storedData;
    }
}

//A simple smart contract

In conclusion you can build apps with solidity that run on the Ethereum network, but to do that there’s still a lot to learn about the language, I'd suggest you check the solidity documentation to get started. I’ll also be posting solidity coding tutorials on my blog for those interested. See you in the next one. bye for now!