About Robert

Smart contract development for the Ethereum blockchain and other EVM compatible blockchains.

Inheritance in Solidity

Solidity supports multiple inheritance and polymorphism. There are of course many similarities with other high-level languages, but there are also particularities and gotchas you should be aware of when you are using inheritance in Solidity. Let's get started right away with some code examples. We will first look at the basics, then I will show you some more advanced concepts and at the end of the article I'll provide you with a quick summary of the most important rules and [...]

By |2023-05-21T13:08:22+00:00May 21, 2023|Solidity|0 Comments

Using Events in Solidity

  State changing smart contract functions cannot return any values when they are called by an externally owned address, they return a transaction hash. However, we still need a way to provide important data regarding that function call to the outside world - for example, to a web3 application that called such a function on behalf of an externally owned user account. Events allow us to log data to the transaction log. The transaction log is a specific data structure [...]

By |2023-05-21T12:47:14+00:00May 6, 2023|Solidity|0 Comments

Modifiers in Solidity

  Solidity provides us with special functions called modifiers that allow us to extend our standard functions with reusable code in a declarative way. Well, what does this mean? Let's take a look at an example: // SPDX-License-Identifier: MIT pragma solidity 0.8.17; contract Modifiers { address public owner; uint public value; constructor() { owner = msg.sender; } modifier onlyOwner() { require(msg.sender == owner, "You are not authorized"); _; } function changeValue(uint _value) public onlyOwner() { value = _value; } } [...]

By |2023-05-06T13:46:45+00:00May 6, 2023|Solidity|0 Comments

Arrays in Solidity

Arrays are reference types, which means, they don't store their values directly. Instead, reference types hold the address where the value is stored. This also means, the value of a reference type can be modified through different variable names that hold the same address. So, if you assign one reference type variable to another, you are not creating a copy of the actual data, instead you are passing the address that points to the memory location that holds the actual [...]

By |2023-03-22T19:57:01+00:00March 22, 2023|Solidity|0 Comments

Solidity Special Functions

  In our last article we were talking about functions in Solidity. However, we did not cover everything on that subject. In Solidity we have some additional features that could be called special functions. We have the following special functions in Solidity: Getter functions Constructor Receive function Fallback function Selfdestruct - rather a keyword than a function Ok, let's take a closer look at each them... Getter functions: We already talked about them in our last article. Whenever you declare [...]

By |2023-03-13T09:45:15+00:00March 9, 2023|Solidity|0 Comments

Functions in Solidity

In Solidity, we have 3 categories of functions: Functions that modify something on the blockchain - we can call them write functions. Functions that read data from the blockchain, but that don't modify anything - we can call them read functions. Those functions are labeled with the "view" keyword. And finally, we have functions that neither read nor write from the blockchain. Those functions are marked with the "pure" keyword and they are often used to perform some calculations without [...]

By |2023-03-30T08:33:26+00:00March 9, 2023|Solidity|0 Comments
Go to Top