Tuesday, November 30

How to create your first Smart Contract? Together with laBITconf 2021 we show you how to do it totally free

During the laBITconf 2021 hackathon conferences that took place throughout this Monday, November 15 and Tuesday, November 16, Solange Gueiros, blockchain developer, speaker and professor was leading a panel dedicated to Smarts Contracts, also called smart contracts. In addition to his explanation on the subject, he devoted part of his presentation to a workshop that allowed live attendees and those who attended virtually to create their first Smart Contract on the Ethereum Blockchain. If you want to know how to create your first smart contract totally free, here we tell you.

To start with the practical part, you must first know that smarts contracts are more than a virtual currency transfer, we are talking about doing more things than in Bitcoin. Solange Gueiros explained that it is a computer program like any other with the difference that it is published on the Blockchain. A smart contract is a computer program that facilitates, secures, enforces and executes registered agreements between two or more parties.

Now, since this technology is running on the network, it cannot be changed. After being published it works autonomously. In addition, it does not have intermediaries and is decentralized. This was specified by Gueiros during the BITconf 2021, who added that the data that runs here is immutable.

What is immutable in the smart contract?

In other words, they cannot be modified, nor can the code be corrected. However, the panellist stressed that there may be room for some modifications as long as the smart contract has been designed for it: “it can have a function that changes that information, previously programmed,” she indicated. He also pointed out that all these transactions that are made remain registered in the Blockchain which allows (if necessary) to do a search in the histories of all the changes made in the contract and it will appear. What also works as an audit.

The main objective of these smart contracts is to allow two anonymous parties to trade and do business with each other, without the need for an intermediary and without trust in the other contractor being a fundamental element when deciding their celebration.

Smart contracts en Ethereum

Specifically, Solange Gueiros spoke at laBITconf 2021 about the smarts contracts that run on the Ethereum network and explained it during her presentation for the most beginners, stating that Ethereum is one of the most famous projects in the sector of smarts contracts. . It is a distributed computing platform based on a public blockchain like Bitcoin and that also allows P2P smart contracts to be executed (between nodes, without central servers) in a decentralized virtual machine called Ethereum Virtual Machine (EVM).

Going to the practical part, he invited attendees to open their laptops and follow a series of recommendations and steps to execute a smart contract that, for many, was the first. Here we show you the step by step.

Open the following link

The first thing he provided was this link, and invited each participant to write their name on one line. We did the indicated step by step. Now it’s your turn.

Locate yourself in your MetaMask wallet

Then, he invited to locate us in our MetaMask wallet. If you don’t have it, through this link you can proceed to the download in Chrome.

MetaMask Wallet Download

Select the Red Goerli network

Once opened, or downloaded as appropriate, select the Goerli testnet from your MetaMask wallet.

Copy and paste your name and wallet

Write your name followed by a dash next to your wallet address on the Goerli network. Copy and paste it as we show you below:

Now, you need ETH to post your first smart contract. Yes, to interact with a smart contract, you must pay for an API. That is, the program that allows one software application to interact with another. In other words, a API it is a messenger that takes requests and tells the system what you want it to do and then returns the response from the system.

But, no need to worry, you don’t need to spend real ETH. Here we show you the tools for you to continue creating your first smart contract for free.

Faucet: How to use it and what do we have it for?

The faucet is an application that gives us, fake Ethereum. To use this Faucet You will only need an account on Twitter or Facebook.

The next thing you should do is copy the address of your wallet, Georli in Metamask and click on the tweet on Georli’s main page.

Copy your wallet address in the tweet

Then, copy and paste your wallet address in the tweet that the faucet page directed you to. Substituting what is indicated in red, by the address of the wallet mentioned above.

Now, finish posting this tweet. Copy the link from the newly posted tweet and go back to the faucet.

Go back to the faucet to get the ETH

Once the above is done, copy the link of the tweet and paste it in the faucet as indicated in the image. Select the largest amount of ETHER that they offer you in the tab next to it.

Check in MetaMask the availability of ETH

Now, go back to your MetaMask wallet and check the amount of ETH selected.

Now we have the necessary funds to make your first smart contract.

Your first smart contract on Ethereum

To continue, you must enter the tool remix which will allow you to finally make your first smart contract. You will need to click the second button on the left side (file explorer). And, select create a new file.

You will be located in the upper left part and you will select file explorers, add new contract. Then, you will write the name of the contract, in this case we use: register.sol.

Fill out a smart contract

You will go again to this link and you will copy the lines from 160 to 173, you will paste it in registre sol and you will select the third icon from the upper left screen of remix: Solidity Compiler. If you enabled automatic compilation (autocompile), the smart contract is already compiled.

Implementation and transactions

Once this is done, you will continue to scroll down the buttons and select the fourth: Implement and execute transactions. Here you must select the web3 that will automatically connect with MetaMask. With this, you will send the transactions with your wallet.

It will open a pop-up window that you must approve so that it is connected with remix. Here you will verify that the network is Goerli.

Name and address of your smart contract

Then, you will come across an orange button that says to deploy. You will select it and it will connect you again with MetaMask to authorize the transaction. That is, I would be asking you if you agree to spend your ETHER in this publication of the smart contract.

Once the transaction is confirmed, your first smart contracts have been published successfully.

How can I view my smart contract?

From the remix tool, you can do it, in the same display section. But, you must bear in mind that in remix, the options in blue do not spend gas, since they do the query internally. While, the orange options do have transaction costs.

For more interaction you can leave your name and the address of your smart contract that is already published on the Ethereum network. So that they can be consulted by others and that you can do the same verification exercise for those who visit this link del workshop del laBITconf 2021.

Your smart contract is already an executable code that is stored in a Blockchain, is executed by Blockchain transactions and reads and writes data contained in this technology. You are ready to make a digital value transfer through a totally immutable system.


Leave a Reply

Your email address will not be published. Required fields are marked *