This tutorial demonstrates how to write, compile, and deploy a basic Ethereum smart contract using Remix IDE, covering key concepts including data locations (storage, memory, calldata), the compilation process that translates Solidity code to EVM bytecode, and how to interact with deployed contracts through read and write functions.
Deploy Your First Smart Contract: Solidity & Remix IDE for Beginners
Added:Hey everyone, welcome back. In the last video, we learned what a smart contract is. If you haven't watched my previous video on what a smart contract is, go check it out. This one will make a lot more sense after that. Today, we're going one step further. I'll show you exactly how to write and deploy your first smart contract. Don't worry if you're a total beginner. I'll explain everything slowly. All right, so first we're going to use a tool called Remix IDE. Think of Remix like your notebook and pen for writing blockchain code.
It's completely online, so you don't have to install anything. Just open your browser and go to remix.ethereum.org.
When Remix opens, you'll see three main parts. One, file explorer. This is where your contracts will be saved. Two, editor. This is where we write our code.
Three, terminal console. This shows messages, errors, and results. Let's start by creating a new file. Click on the contracts folder. Then click the new file button and name it my first contract soul. The dots means it's a solidity file which is the language we use for Ethereum smart contracts. Now inside this file, let's start coding.
First line, SPDX license identifier MIT.
This is like a permission note that tells people what license our code has.
Next, Pragma Solidity 0.8.0.
This says we are using Solidity version 0.8.0 or above. It's like telling your friend, I only understand English from 2021 onwards, not the old version. Now let's write our first contract.
Let's break it down like a story. So this is our contract code that we wrote.
Contract my first contract. A contract is like a box where all your code lives.
String public message. This is a global variable. It's like a box inside our contract that stores words, a string.
Public means anyone can see it. Now you might be thinking why did we write string memory message in our constructor instead of just string message in solidity whenever we use complex data types like strings or arrays. We have to tell the compiler where that data will live while the function is running. This is called a data location. There are three main data locations in Solidity.
One, storage. permanent storage on the blockchain. It's expensive, but it stays forever. Two, memory, temporary storage that only exists while the function is executing. Once the function ends, it's cleared. And three is called data special. Temporary storage for function inputs that cannot be modified. So when we write string memory message, we're telling solidity, this message is just an input to the constructor. Keep it in temporary memory while we use it. After that, in our constructor, we copy it into a state variable which does live in storage on the blockchain. That's why your message is still there after deployment. If we didn't write memory, Solidity wouldn't know how to handle the string and it would throw a compile error. That's why we need to specify it.
Constructor. The constructor is a special function that runs only once when you deploy the contract. It's like moving into a new house and setting up your furniture for the first time. Here we set the initial message update message. This is a normal function that lets us change the message anytime after the contract is deployed. Before we run our contract, we first need to compile it. Now, you might be thinking, what does compile actually mean? Think of compiling as translation. We write code in Solidity, a language humans can read.
But the blockchain only understands very low-level instructions. The compiler takes our solidity code and translates it into byte code that the Ethereum virtual machine or EVM can execute. The EVM is like a tiny computer that lives inside every Ethereum node. When we compile, two important things are produced. One, byte code. This is the machine code that actually gets deployed on the blockchain and runs inside the EVM. Two, AI, the application binary interface. Think of it like a menu or a map of your contract's functions and events. Tools like Remix, Ethers,JS, or web apps use the API to know how to call your functions and what data to send or expect back. The compiler also checks your code for mistakes, syntax errors, wrong data types, visibility issues, and so on. If there's a problem, it tells you before you spend any gas. All right, let's do it in Remix. Click the Solidity compiler tab. Make sure the compiler version matches your Pragma. For example, if your file says Pragma Solidity 0.8.0, menu. Pick any 0.8x version, then click compile my first contract. If there's a green check mark, you're good to go. Now that our contract is compiled, it's time to deploy it on a simulated blockchain so we can test it out. Click on the deploy and run transactions tab in Remix. Under environment, choose Remix VM. This is like a mini blockchain that runs entirely inside your browser. No internet connection or real ETH required. It's perfect for quick testing because it resets every time you refresh the page. In the deploy section, you'll see it asking for a message. This is because our constructor in the contract expects an initial message when it's created. Let's type something like hello blockchain and click deploy. Boom.
You've just deployed your first smart contract. In a real scenario, this would cost gas and happen on the Ethereum network. But here, it's instant and free. Once deployed, scroll down to the deployed contract section. Click the drop- down arrow for your contract.
You'll see all its public functions listed here. Let's click the message button. This is a read function, so it doesn't cost gas. It just shows us the stored message. You should see hello blockchain appear. Now, let's change it.
In the update message field, type a new message like welcome to smart contracts.
And click the button. This is a write function, so it actually changes the data on the blockchain. Click message again, and you'll see the updated text.
That's it. You've just read from and written to the blockchain. This is the core of interacting with smart contracts. Reading data is free, but writing data requires a transaction. And that's it. You've officially written and deployed your smart contract. In the next part, we'll go even further and learn how [clears throat] to interact with contracts using real tools and networks. If this helped you learn something new, drop a like, write a comment, and hit subscribe.
Up Next

What Are Gas Fees in Crypto? A Complete Guide to Ethereum Network Costs
@CryptoAnimations
3K views•2021-12-01

Torrent File Format & Bencoding: A Technical Deep Dive
@AsliEngineering
12.5K views•2022-08-08

Operational Security Essentials: A Guide for Hacktivists (OPSEC)
@hitbsecconf
157.4K views•2012-11-26

Understanding Ethereum: A Comprehensive Beginner's Overview
@99Bitcoins
3.1M views•2018-06-26
Related Study Plans & Knowledge Roadmaps
Structured learning paths in Blockchain & Crypto



















![Learn Solidity: The COMPLETE Beginner’s Guide [Full Course] | Solidity Tutorial](https://i.ytimg.com/vi/9BZ0zjqwCPs/maxresdefault.jpg)

![Intro to Blockchain Programing [FULL COURSE 2023]](https://i.ytimg.com/vi_webp/cGQHXmCS94M/maxresdefault.webp)












