Various integrated development environments (IDEs) have been implemented for writing smart contracts. the simplest being the Remix user interface developed by the Ethereum team, available online from here.

On the first page that appears, select the Solidity environment to display the Icon Panel on the left of all features related to this environment.

solidity

to create a new contact, press the button + from the left panel and enter a name for your contact in the popup box and then press the OK button.
Write the following code on the opening page:

In the first line you tell the Solidity compiler to use version 0.5.11 to compile this contact.

A contract is a set of functions and variables known with a unique address in the Ethereum blockchain, but the name of the contract may be similar to other contracts in blockchain. Our contract name is “FirstContract” and has a variable called number and two functions set and get. The contract address will also be assigned to Ethereum Blockchain after it is created.

Number is an unsigned integer of 256 bits used to store a number in blockchain.

The set function takes a number from the input and stores it in the number variable, and the get function is used to read this number.

In the Icon Panel, select the Solidity Compiler option to display the following options in the Side Panel.

solidity

Here you can change the compiler version and adjust it according to the first line of the contract you specified and press the compile button to display its error and if compiled without error the green will be displayed on the Solidity Compiler icon.

solidity

Now it’s time to make this contract in the Ethereum blockchain. to do this, in the Icon Panel, select Deploy & run transactions. in the panel that appears after setting the contract environment and selecting the contractor address, press the Deploy button.

Congratulations, you created the first contract on the Ethereum network in solidarity. You can view the status of the contract created and the contract address created in the Terminal environment. Also, in the Side Panel environment, click on the Deployed Contract list of the functions of this contract and invoke each of them if necessary.

solidity

You can enter the desired number by the texbox in front of the set button and by pressing the button you can enter this value in blockchain. It should be noted, however, that your request will be sent as a transaction to the nodes connected to the Ethereum network, and only after confirmation of this transaction, it will be stored in a block and stored in the Blockchain, along with the rest of the transaction. The get function of this number is displayed to the user.

Follow us for more information if you find it useful.

For more learning click here