Solidity is the programming language used by smart contracts on the Ethereum blockchain.

It’s a statically-typed, object-oriented programming language.

Solidity uses a semantic versioning scheme and, at the time of writing, the latest version is 0.8.9.

Laptop Showing Code

Programming languages such as C++ and JavaScript inspired the Solidity language.

Remix is an online IDE that enables you to write and debug your Solidity code.

When you first visit Remix, you should see a landing page similar to the one below.

Remix Editor landing page

Writing Your First Smart Contract

First, click theCreate New Fileicon in the File Explorers tab.

The icon looks like a page of paper with a corner folded over.

Name the new filehelloWorld.sol.

Solidity compiler button

Use the.solextension to show that the file contains Solidity code.

you’re free to now copy the code below to your new file.

An explanation for each line follows below.

Compile helloWorld File

The first line shows the license under which somebody may use and distribute the software.

That is, >= 0.8.1 to < 0.9.0.

It’s also important to include this line to avoid incompatibility between your code and compiler version.

Deploy and Run Smart Contract

Related:What Is Solidity and How Is It Used to Develop Smart Contracts?

There are usually minor changes, or patches, within the x.y.Zversions.

Breaking changes are normally present in x.Y.z versions.

This is why thepragmadirective doesn’t include the 0.9.0 version in the above code.

Solidity is an object-oriented language.

Thecontractkeyword on line four is similar in use to theclasskeyword in other object-oriented languages.

Contracts can contain functions, state variables, and other advanced types.

The contractFirstContractcontains an unsigned integer (unit) calledvar1.

you might define a function with the keywordfunctionfollowed by the function name and parentheses.

In the parentheses, you could declare the parameters which your function will take.

Related:What Is Monero and How Does It Protect Your Privacy?

Notice that the definitions of theset()andget()functions contain the keywordpublic.

This declares that any other contract can call them.

Compile and Deploy

To compile your code, hit theSolidity compilerbutton.

Now tap on the button that readsCompile helloWorld.sol.

If the compiler doesnt encounter any errors, then youll have successfully compiled your first smart contract.

To deploy your code, select theDeploy & run transactionsbutton.

This button is just below theSolidity compilerbutton in the left-hand menu.

While on this page, ensure that your contract name displays correctly above theDeploybutton.

These are blockchain-based applications that run on a permissionless connection.

This is the beauty of Ethereum smart contracts.

You’ll have the ability to create powerful P2P applications on Ethereum.