Source link

In this quick 5-minute practice session, I’ll show you how to create a basic storage smart contract in Solidity using the setter and getter functions. It’s a hands-on walkthrough where I’m learning how to:

set: Store an integer value on the blockchain.
get: Retrieve that stored integer.
Perfect for beginners like me, experimenting with Solidity and learning how to use Remix IDE.

I’ve also written a blog post about this project on Medium. Check it out here: https://medium.com/@halimaholaolohun/setter-and-getter-functions-in-solidity-cf74281ead2a.

For more cybersecurity-focused content, subscribe to my other channel @mycrestacademy .

Don’t forget to like and subscribe if you’re also learning along the way🥂

#Solidity #SmartContract #Ethereum #RemixIDE #LearningBlockchain #SetterGetterFunctions #beginners #project #technology #programming #MyCrestAcademy #Cybersecurity

date : 2024-10-18 10:59:11

views : 37

likes : 10

rating :


Here’s a 300-word summary of the transcript:

In this Web3 DeFi tech editor’s tutorial, we explore the basics of smart contracts using Solidity, a programming language for Ethereum. The transcript explains a simple smart contract that stores and retrieves a number using two main functions: set() and get(). This contract is licensed under the MIT License, which allows for the use of the contract in any project that complies with the MIT License.

The code begins with the declaration of a container for the contract, “Storage”, which is a mapping of variables and functions. The first variable, “data”, is declared as an unsigned integer (U256), which means it can only hold positive numbers without decimals.

The get() function is the first function, which retrieves the stored number. It’s declared as public, meaning it can be accessed from outside the contract, and returns the stored value as an unsigned integer. The set() function is the second, which allows users to input a new number, which is then stored in the contract.

The tutorial demonstrates how to compile and deploy the contract, and then use the set() and get() functions to store and retrieve a number. The contract is deployed on a blockchain, and the get() function can be called to retrieve the stored number. The set() function can be used to update the stored number.

Some general Web3 facts:

* Web3 is the next generation of the internet, built upon blockchain technology.
* Solidity is a programming language used for developing decentralized applications (dApps) on the Ethereum blockchain.
* Smart contracts are self-executing contracts with the terms of the agreement written directly into lines of code.
* The MIT License is a permissive free and open-source software license.

This tutorial provides a basic understanding of how to create and use smart contracts, as well as the importance of understanding the functionality of getter and setter functions in different contexts.

LEAVE A REPLY

Please enter your comment!
Please enter your name here