0% found this document useful (0 votes)
8 views5 pages

Raj DPatel BTPractical 2

The document outlines a practical exercise to write, deploy, and execute a basic smart contract using various data types in Solidity. It includes details about the software used, the contract code demonstrating different data types, and the deployment process. The conclusion emphasizes the understanding of Solidity data types and the controlled deployment of smart contracts.

Uploaded by

rdpatel.enacton
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views5 pages

Raj DPatel BTPractical 2

The document outlines a practical exercise to write, deploy, and execute a basic smart contract using various data types in Solidity. It includes details about the software used, the contract code demonstrating different data types, and the deployment process. The conclusion emphasizes the understanding of Solidity data types and the controlled deployment of smart contracts.

Uploaded by

rdpatel.enacton
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Enrollment No: 202103103510081​ ​ ​ ​ ​ ​ Date:23/8/2024

Practical - 2
Aim: To write, deploy, and execute a basic smart contract that makes
use of different data types in Solidity.

Software Used:
1)​ Remix IDE 0.53.1
2)​ Windows 11
3)​ Solidity 0.8.20

Description:
●​ We are going to demonstrate different data types in Solidity and their
uses along with some Special Data types used only for solidity.
●​ First of all, let’s start by writing down different data types in the solidity
file and understand how they work and how they can be used.
●​ Then, we’ll deploy them on remix testnet and understand how the
smart contract deployment looks like.

Contract Code:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

// To write, deploy, and execute a basic


// smart contract that makes use of
// different data types in Solidity.

contract RajDPatel2 {

// unsigned integers uint8 - uint256. only writing uint == uint256


uint8 raj_1 = 255;
uint16 public raj_2 = 65535;
uint32 public raj_3 = 4294967295;

// signed integers int8 - int256


int public raj_4 = 127;
int public raj_5 = - 128;

// Finding minimum and maximum values of a int/uint datatype

UTU/CGPIT/CE/SEM-7/Blockchain Technology
Enrollment No: 202103103510081​ ​ ​ ​ ​ ​ Date:23/8/2024

uint256 public raj_6 = type(uint256).max;


uint256 public raj_7 = type(uint256).min;

int256 public raj_8 = type(int256).max;


int256 public raj_9 = type(int256).min;

// Boolean
bool public raj_10 = false;

// Strings
string public raj_11 = "PATEL96";

// Solidity specific dataTypes that are useful in smart contract development.

//Address
// to store the address of any wallet or any contract this data type in used.
// It is a string of 40 hexadecimal values.
address public raj_12 = 0x039CA860A762dDDB916eE16e6dA23630A39F224A; //
My official Wallet address :P

// bytes(1-32)
bytes1 public raj_13 = 0xff;

// keccak256 generates a value os 32 bytes using the input seed


// same input seed will always generate same bytes of data.
bytes32 public raj_14 = keccak256("Raj D. Patel");

// Arrays
uint256[] public raj_15 = [1, 2, 3, 4, 5, 6, 7, 8, 9];
}

UTU/CGPIT/CE/SEM-7/Blockchain Technology
Enrollment No: 202103103510081​ ​ ​ ​ ​ ​ Date:23/8/2024

2.1: Solidity code

2.2: Deploy Command

UTU/CGPIT/CE/SEM-7/Blockchain Technology
Enrollment No: 202103103510081​ ​ ​ ​ ​ ​ Date:23/8/2024

2.3: Transaction hash & other Details

2.4: Call data

UTU/CGPIT/CE/SEM-7/Blockchain Technology
Enrollment No: 202103103510081​ ​ ​ ​ ​ ​ Date:23/8/2024

Result and Conclusion:


●​ Learned the data types of solidity and understood how all the
datatypes help the development process.
●​ Also understood the process of controlled deployment of smart
contracts.

UTU/CGPIT/CE/SEM-7/Blockchain Technology

You might also like