Solidity. The programming language of Ethereum.

Gepubliceerd op 17 april 2022 om 10:02

Software is made by code. Each code is created according to a particular programming language. Websites, for example, are created by the programming languages HTML or CSS. Blockchain is also written using a programming language. No blockchain is obliged to choose an existing programming language. A blockchain is completely free in that choice.

A project can choose an existing programming language for its blockchain, but it does not have to. A project can also use a programming language for its blockchain that is developed by the developers of the project. A good example is the Ethereum blockchain. The Ethereum blockchain uses a programming language called Solidity. Solidity is developed by the Ethereum blockchain team.


What is Solidity?

Solidity is the programming language for the Ethereum blockchain and Solidity is used for writing certain applications on the Ethereum blockchain. These applications can then run on the Ethereum blockchain.

Solidity was developed by Gavin Wood in 2014. He is one of the co-founders of Ethereum. He was not the first with Solidity. Other programmers such as Christian Reitweissner have developed Solidity further. Programmers like Christian Reitweissner have made Solidity available to the public. Other programmers can also work with Solidity. There are books that explain how to program with Solidity for beginners. Have a look at this book here.

Solidity was developed so that other developers could build applications for smart contracts that run on the Ethereum blockchain. Smart contracts are the core of the Ethereum blockchain. A smart contract is a contract written down in code. If certain conditions are met, then an outcome will occur. If X then Y. Solidity is based on the ECMAScript Syntax. This makes it easy for developers to use Solidity. The ECMAScript is a basic code that can be found in other programming languages as well.

However, developers are not obliged to use Solidity to build applications. Developers can also use Serpent and Mutan. The advantage of Solidity is that it has a number of features that are advantageous for developers who want to get started with Solidity. Examples are the hierarchy and the structure of the programming language. These advantages make it easier for developers to build applications and to develop smart contracts further.

Solidity vs smart contracts

For writing smart contracts on the Ethereum blockchain, the programming language Solidity is important. I refer to this blog where I have previously written about smart contracts.

In short, smart contracts are code that is constantly checking certain conditions/variables to see if they meet certain values. If the values are met, then the application or specific function is executed. This happens completely automatically. The values that must be met are pre-programmed into the smart contract by Solidity. A big advantage is that by means of smart contracts no intermediaries are needed anymore. A notary is a good example. Suppose you want to buy a house. Then you have to go to a notary. The notary draws up a contract and the seller and buyer signs it. Thanks to smart contracts this is no longer necessary. The buyer and seller draw up a contract. The seller sends the details of the house to a smart contract. The moment the buyer transfers the right amount to the wallet (the smart contract), the smart contract will be executed automatically. This means that the data of the house is sent to the buyer so that the buyer has obtained ownership of the house (but still needs to get the key). The risk is that the smart contract must be programmed properly. The code is made by people, so human work. If there are mistakes in the code, the smart contract will not work that well. This is also a privacy risk (leaks of confidential documents).

Cons of Solidity

A major point of criticism of Solidity is that its security is not very good. There are constantly security holes to be closed. It is also claimed by many developers that the code can cause many problems. Solidity has also suffered reputation damage in 2016. It was claimed that a major hack was caused by Solidity. This hack was possible because there were all kinds of security flaws in the Solidity code.

Solidity code: example! 


// SPDX-License-Identifier: GPL-3.0

pragma solidity >=0.7.0 <0.9.0;

contract Owner {

address private owner;

event OwnerSet(address indexed oldOwner, address indexed newOwner);

modifier isOwner() {
require(msg.sender == owner, "Caller is not owner");
_;
}

constructor() {
owner = msg.sender;
emit OwnerSet(address(0), owner);
}

function changeOwner(address newOwner) public isOwner {
emit OwnerSet(owner, newOwner);
owner = newOwner;
}

function getOwner() external view returns (address) {
return owner;
}
}
view rawOwner.sol hosted with ❤ by GitHub

 

This address (account identifier) represents an owner, that has some specific privilege over the smart contract, for example to call some function or to access some value.  Click on the link to see and read more!

Reactie plaatsen

Reacties

Er zijn geen reacties geplaatst.