The One Question bounty closes Thursday 10 December.

Join in
We Them Media logo We Them Media Support us

Web3bridge Students (Cohort XII) Share What They’ve Learned: Solidity, Functions, and Data Locations

The picture loads from YouTube. The player loads only when you press Play. Turn on captions in the player if you need them.

Nnenna Okoye gives a Web3 Bridge recap of Solidity basics: static typing, variables, primitive and reference data types, functions with four visibility levels, pure and view functions, and storage versus memory. The talk ends with the usual layout of a contract file.

Not by We Them Media Channel: Web3Bridge. Published Saturday 29 March 2025.

Titles are the owner’s. It plays from their channel.

Transcript

This transcript may contain errors. This video belongs to Web3Bridge. Letters mark each change of speaker.

These are the speakers’ own words. We have not checked their claims.

0:00 A: My name is Nnenna Okoye. We are here to bring you a recap from Web3 Bridge called SWOF.

0:06 B: In this video, we'll be talking about Solidity,

0:08 A: its functions,

0:10 B: data allocations. Solidity is a statically typed language, which means that all the types of every variables must be specified. Talking about variables, Variables are containers that store data. Variables also help developers to manipulate data at runtime. We also have data types. We have the primitive data types and the reference data types. Under the primitive data types, we have the uint, the unsigned integers that contains positive integers. uint has uint8, uint128, uint256. int is signed integer which contains positive and negative integers. We also have address. Address is a keyword used to store addresses. We also have boolean. Boolean returns true or false. Okay, let's talk about the reference types. The reference types, we have the struct. The struct is a user-defined, um, data that contains different data types. For example, let's assume I want to store my data, my name, which is a string, my age, which is uint, my address, which is the address. So the struct will contain everything there. Under reference data type, we also have array. Array is a collection of data, data which only stores the same type of data. We also have, um, the string. The string is a collection of characters. Under reference data type, we also have mapping. Mapping is a key-value data type which stores key to value in the sense that if you want to retrieve data, you will use the key to retrieve a particular data from the mapping.

2:27 A: So functions are reusable pieces of code that can be used to perform a specific task in the smart contract. It helps and aids interactivity within the state, and it also helps eliminate the need to write code again and again. To call the function, you need the function keyword, the unique name, the parameter which is used to pass in the arguments, then the curly brace which is used to cover the block of codes. There are function modifiers and visibility functions. There are 4 types of visibility functions. There are private, public, internal, and external. So private functions are functions that can be called within the contracts. It can't be called externally, while public functions can be used or called within the contract and outside the contracts. Internal functions can be called within the- can only be called within the contract and contracts derived from it, while external functions cannot be used or called within the contract but outside the contract. So for function modifiers, we have 2 types. There are pure and view functions. Pure function can either read from the state or modify the state, but view function can only read from the state but cannot modify the state.

3:58 C: So on the EVM, we have 2 types of data allocations. We have the storage and the memory. So on the storage, data can be stored permanently on the blockchain using the storage allocations. While for memory, data are stored for a temporal period of time. That means they exist for a limited period of time. And we store, um, state variables in the storage location and we store local variables in the memory locations. Um, you can write and read to these locations. You can write to the storage location and you can read from memory locations. So we have what we call the control structure. So for the control structure, there is a, um, way we write our codes. In Solidity. So the first line is, um, for the structure, the first line is the license. So you have to specify your license in the structure. And second, the next thing is the pragma version. So this is where you specify the version for your compiler. And then you go down to the contract name itself. So you write the contract, then write the contract name, contract my name, then curly brackets. Then inside the brackets, then you declare your state variables. So this is, these are stored, this will be stored in the Storage location. Then after your state variable, you write your functions. So in these functions, this is where the local variables are stored. So they are stored in the memory.

5:13 A: Thank you for watching this video to this point. If you like this video, please like, subscribe, and share. Thank you.

More from this hub

Something wrong, or a video you want off this page? Write to wethem.xyz@gmail.com and it is fixed or taken down within 48 hours.