Blockchain Development(Day 5)

Blockchain Development(Day 5)

Introduction to Remix

"Remix: the ultimate Ethereum IDE! 🚀 Whether on the web or desktop, Remix is the open-source IDE for seamless Ethereum development. Start building effortlessly with its user-friendly interface and extensive plugin library. Compose Solidity code right in your browser, while testing, debugging, and deploying smart contracts to the blockchain.

Image

The left sidebar lets you navigate File Explorer, Solidity Compiler, Deployer, and Extensions. At the bottom, find the output panel for compilation, deployments, and function calls. The middle section is your code editor, currently displaying the IDE's home screen. Dive in and unlock the world of Ethereum development! 💡"

Discover the Remix Workflow: Navigate to the sidebar and explore the contracts folder, where Remix comes preloaded with 3 fundamental smart contracts designed to assist Solidity learning. Dive into 1_Storage.sol for a closer look.

Image

Behold, the code editor emerges!

Within the file explorer, a realm of possibilities awaits—creating fresh files or directories, uploading local files, or importing from the realm of Github.

To breathe life into our contracts, we journey to the Solidity Compiler tab, where the sidebar unveils a sight such as this.

Image

In this section, we have the flexibility to select the Compiler Version and the smart-contract programming language we're using (typically Solidity). We also have additional configuration options available.

Please note that Yul, listed as another programming language in Remix, is a lower-level language primarily used for intermediate compilation. It's closer to the hardware than Solidity. However, in the majority of cases, you won't be coding in Yul. You can learn more about Yul here: https://docs.soliditylang.org/en/v0.8.19/yul.html

By clicking on "Compile 1_Storage.sol," the contract will be compiled and prepared for deployment.

Image

Moving over to the Deployment tab, we will see something like this in the sidebar.

Image

The environment is the first thing to consider. In Remix, there's a built-in Remix VM (Merge) that simulates the Ethereum Virtual Machine (EVM) running the Merge Upgrade. It's useful for testing and debugging smart contracts quickly, but it's limited to local simulation. Fortunately, our Storage contract doesn't rely on other contracts, so we can test it in the Remix VM. When deploying to real networks, we'll switch to other options available (more details later).

Along with the Remix VM (Merge), Remix creates a set of fake accounts, all loaded up with 100 ETH, to test with.

Select the 1_Storage.sol contract from the dropdown, and click Deploy to deploy the contract.

Once the contract is deployed, you will see it under the Deployed Contracts section - where you can now call functions on your smart contract.

Calling the retrieve function will return a value of 0 right now, which is the default value for integers in Solidity.

Image

Also, we will see in the Output panel some logs about the call Storage.retrieve which is our function.

Now, let's try calling the store value with the number 5.

Image

Again, we see some logs in the output panel about the call to Storage.store. Now, if we try retrieve again, the output will be 5.

Image

Please note that the function calls and transactions made during this testing phase in Remix VM (Merge) do not open your actual digital wallet (Metamask). The Remix VM is a simulator that operates with fictional accounts. When deploying to a real network like Testnet or mainnet, transactions require confirmation and signing through your digital wallet for security purposes.

Our recommendation for learning more about Remix is as follows:

We suggest going through the documentation available at Remix IDE Docs.

Â