# Writing your First Smart Contract using Remix

## What is a Smart Contract?

> A smart contract, as defined by [Ethereum](https://ethereum.org/en/developers/docs/smart-contracts/), is just a program that runs on the Ethereum blockchain.

Much like traditional contracts, they can be used as digital forms of agreement. Executing a smart contract essentially creates a transaction on the blockchain and hence, these transactions are trackable and irreversible.

---

We can write smart contracts using the *Solidity* programming language. We'll use the Remix IDE which saves a lot of time in setup because it is online.

You can start working with Remix by following [this](https://remix.ethereum.org) link.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1674110014971/9ad7de5d-f531-4be2-825b-9b16df877b84.png align="center")

Open up the Remix IDE for the first time and it looks something like this. You'll have to agree to some stuff and then go through a first-time tour of the options in the sidebar.

The sidebar contains 4 options, the first one is the file structure, which shows you all the different files and folders in your workspace.

You then have a search button, a tab to choose the Solidity compiler (you can change versions here) and a tab where you can deploy your smart contracts.

---

## Writing your first Smart Contract

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1674110380423/38769b7b-4bdb-4035-ae98-a05bbead68d2.png align="center")

Create a new file with the name `FirstContract.sol`. You might've noticed that we use the *sol* extension, and you guessed it right, it is the extension we use for Solidity files.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1674110525323/ea378cdf-0459-41c8-93ca-dd7d574aaad2.png align="center")

I'm on this version of the Solidity compiler. You might have to change your compiler to this one if you want the same results.

Let's write our first contract now.

```solidity
pragma solidity ^0.8.0;

contract FirstContract {    
    string name = "";

    function setName(string memory _newName) public {
        name = _newName;
    }
}
```

We can deploy this contract on a JavaScript VM for now.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1674111239771/ca61e80a-4df2-4593-95be-e4bda08fb83b.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1674111313586/7c32c231-2eae-402d-b5ef-2e3de2929341.png align="center")
