Home > Courses > Blockchain Programming > Solidity Programming and Smart Contracts > Creating dApp With Solidity | Blockchain Coding | Intro

Creating dApp With Solidity | Blockchain Coding | Intro

Creating dApp With Solidity | Blockchain Coding | Intro

Here is a clear line-by-line Solidity coding guide to start creating your own Blockchain solutions, dApps or anything you like at the crypto universe. Let’s clarify all the basics.

We are getting closer to the Internet revolution right now. It’s gonna be decentralized again like in good old times. Peer-to-peer technologies as Torrent proved the efficiency and real value to everyone. By the way, I’m a big fan of the TV show “Silicon Valley”. I really love the idea of the company with a strange name Pied Piper to decentralize data storage and spread all files between all people using their smartphones. We haven’t already got the prototype of Pied Piper code in the real world (by the way, Filecoin project is making something similar), but I know what can help to get closer and scale it not only to data storage. It’s the Blockchain technology.

Blockchain for back-end development

Backend code is a set of commands for the server, the way it should deal with all the data. It is usually performed with such languages as PHP or Python. The main problem here is that code could be changed and manipulated in the way beneficial for some group of people. Imagine it can’t. 

Blockchain code could also be used for backend programming. And the fun part here is that no changes could be made. You can only deploy new code at the new directory. But the old code lives in the original form. Furthermore, no operations or transactions could be changed. All of them will be stored at the Blockchain ledger forever.


One of the most popular Blockchain programming languages right now is called Solidity. It has been created by Vitalik Buterin, the primary author of Ethereum. Solidity is used for making smart contracts. Let’s remember, the smart contract is a code which defines the rules for all participants, controls and penalizes for breach of obligations.

The most practical and popular usage of Solidity nowadays is the development of dApps (decentralized applications). 

Here is the list of areas for solutions available at the dApp market right now:

  • Games

  • Exchanges

  • Collectibles (something like rare and unique baseball cards but on Blockchain)

  • Casinos

  • Video streaming

  • Trading signals


I believe the scope of possible application is way more huge. We just need some time to adapt the technology and build awesome products. And we are writing this guide today exactly for this purpose. I guess every person could benefit from Blockchain technology especially if he/she understands the basics. Who knows, maybe YOU are the person who will make a revolution of the Internet.

So, let’s move on to Solidity coding principles.

 Our first smart contract

Let’s make a code in Solidity. Have a look at the finished version: 

pragma solidity ^0.4.17;
contract Whatsup {
    string public message;
    function Whatsup (string firstMessage) public {
        message = firstMessage;
    function setMessage(string newMessage) public {
        message = newMessage;
    function getMessage() public view returns (string) {
        return = message;

At first sight, it looks a bit confusing...
And what does this code do?

It allows anyone to write a text message to the Blockchain. Then anyone can write another message and the program will update (replace) the first message by the second message. All these actions will be saved at our Blockchain forever. 

Explanation of the code

No reason to be scared. Like any programming language, Solidity has the basic commands and functions. So we need a bit of practice to feel comfortable with it.

Let’s clarify our smart contract code line by line: 

pragma solidity ^0.4.17;

We declare the version of Solidity here, which will be used by a compiler program. Compiler program translates Solidity to something called Bytecode, which is used by Ethereum network to understand our smart contract. One of the best and popular compilers is Remix. We will use it later at our guides.
Solidity is updated regularly, and for reason, the code does not contradict to new rules, we have to state the version which we know and which meets our requirements. It doesn’t mean our code could become old-fashioned. It always depends on the tasks we perform. So if old version meets our requirements, we can use it. You can find the manuals for all the versions at Solidity website

contract Whatsup {

We create a smart contract named “Whatsup”.

 string public message;

We make a variable and set a name as “message”
The type of variable is a “string”. It’s just a piece of text. It’s not an integer, comparison, address (Ethereum address is a type at Solidity), array, or bool (“true” or “false”).  

“public” means the variable will be accessible by everyone.

function Whatsup (string firstMessage) public {
 message = firstMessage;

We add a function (its name will be “Whatsup”, the same name as our Contract name) which will save our “message” after we write it to the box “firstMessage”. 

If the function has the same name as the contract (“Whatsup”), then it is called Constructor Function. Constructor Function is called automatically after smart contract deployment to Ethereum network.

function setMessage(string newMessage) public {
 message = newMessage;

This function named “setMessage” will let everyone (“public”) to change our variable “message”. 

And we can change it to a new variable (with a name “newMessage”) with the “string” type (see an explanation of string type above). It means that anyone can write the text line to the Blockchain and it will be saved as our “message”.

 function getMessage() public view returns (string) {
 return = message;

The function we called “getMessage” shows (“return”) everyone (“public view”) our updated “message” variable. “returns” is used to clarify the type of value (“string”) which function will give.

By the way, every time making a function, we need to set some arguments for function and they need to be in brackets. Functions call arguments and perform some operations with them. As you see in the function getMessage(), it has no arguments as it doesn’t need them in this case, it just shows our “message”.  

One more thing about “getMessage” function. Basically, we don’t need it at all. The reason is that we get our “message” anyway with the first constructor function “firstMessage”. So the function “firstMessage” perform the same action as “getMessage” function by default.


That’s it. Not so complex, agree? 

Programming is just a game. You have a goal and you have some weapons. Practice makes perfect, bit by bit you become a ninja.

We need to know also:

- more commands and their usage

- how to deploy the smart contract to the real Blockchain

- how to connect frontend (website or mobile app) to the backend (Solidity)

- real-life cases to apply Blockchain in

Next time we will make something more exciting and practical. 

Check our list of Blockchain programming courses available online.

Stay tuned! 

Jim Sanders


Scroll to top