Write your own Smart Contract and deploy it…
In this article, we will watch how we write our own contract and deploy as I mentioned in my previous article that I learned why we need a smart contract and where we need I will provide you in a comment section where you can read all the stuff that is related to smart contracts. So, now in this article, I will practically teach how you will write your own Smart Contract. Now, you open your browser and search this online http://remix.ethereum.org/ this website. This is Ethereum Virtual Machine (EVM) where you can write your first contract. You can either copy the above-mentioned link and you can find your EVM machine.

Remix Online Editor

This is the page you can view when you open the link. To compile and deploy we need to activate the setting. For this, you click on the solidity black arrow is showing solidity button when you click on the button your setting will be activated. Next, open your new file click on the plus button red box is showing where is it.

Write any name, for example, my_name.sol

After creating the file you will view the blank page here is the code that I write for you write this code. Ok now I will explain to you what is going on here in this code. The first tells you that the source code is written for Solidity version 0.4.0, or a newer version of the language up to, but not including version 0.7.0. Pragma is common instruction for compilers about how to treat the source code. A contract in the sense of Solidity is a collection of code (its functions) and data (its state) that resides at a specific address on the Ethereum blockchain. And you can write any name of your contract for this demo we write myContract. Just like any other programming language, we take a string with a public keyword with a variable name is myname. This whole line declares a state variable. So now the question is why we need a public keyword. The keyword public automatically generates a function that allows you to access the current value of the state variable from outside of the contract. Without this keyword, other contracts have no way to access the variable. After we declare a function with name writeanyname and then we declare a parameter string. Now, why we used memory keyword. In functions without the memory keyword, then solidity will try to use the storage structure, which currently compiles, but can produce unexpected results. Memory tells solidity to create a chunk of space for the variable at method runtime, guaranteeing its size and structure for future use in that method. And says it public. The public keyword in the function that we call this function easily after deploying a contract. This is code that I write for you and for very beginners who are here and want to learn this solidity language.

Compile your contract press the compile button for me it is Compile hi.sol

Then click on the black box button and deploy your first smart contract click on the deploy button here we need some gas to deploy our smart contract here it is free. Click on the Deploy button and deploy your contract.

Here you view this open this and then.

Click on the myname button here you view you Hi World variable.

Here you can write any name, anything you can write with double string, and then click on the writeanyname button and then click on the nyname button where you find your own written name.

So, this is all of this. I hope after a lot of struggle you are happy face because after this article. You can successfully write your own smart contract and also deploy it. For now, take care, stay safe, and stay home.

Related Article:
['Umair Ansar']
['Blockchain Technology', 'Solidity', 'Etherem', 'Smart Contracts']