Practical 1 Setting up environment - We need to connect our machine to etherium network. - To able to do transaction to etherium network we need to pay fees called gas which is distributed to miners - As buying ether is so expensive we can connect to test network instead of main network for learning purpose. - So to turn our browser into node for the test network use the metamask extenstion - get free ethers for sepolia network from these faucets https://faucetlink.to/sepolia - to use polygon amoy test network use this to add in metamask config https://support.polygon.technology/support/solutions/articles/82000907114-how-to-add-amoy-network-in-your-wallet- ```text Network Name: POLYGON AMOY TESTNET New RPC URL: https://rpc-amoy.polygon.technology/ Chain ID: 80002 Currency Symbol: MATIC Block Explorer URL: https://www.oklink.com/amoy ``` faucet for polygon amoy : https://faucet.polygon.technology/ - to buy real one https://medium.com/prepo/setting-up-metamask-and-getting-eth-matic-on-polygon-step-by-step-guide-fd55147a0f05 ### Coding - Use remix.etherium.org IDE Create a file named `Bank.sol` ```sol // SPDX-License-Identifier: MIT pragma solidity 0.8.25; contract Bank { int bal; constructor() public { bal = 1; } function getBalance() view public returns(int) { return bal; } function withdraw(int amt) public { bal = bal - amt; } function deposit(int amt) public { bal = bal + amt; } } ``` - This Bank.sol should be under contracts folder. This file is to be compiled - Also the file named `deploy_with_web3.ts` should be in scripts folder which will deploy it ```js // This script can be used to deploy the "Storage" contract using Web3 library. // Please make sure to compile "./contracts/1_Storage.sol" file before running this script. // And use Right click -> "Run" from context menu of the file to run the script. Shortcut: Ctrl+Shift+S import { deploy } from './web3-lib' (async () => { try { const result = await deploy('Bank', []) console.log(`address: ${result.address}`) } catch (e) { console.log(e.message) } })() ``` - Now run it like this  - switch to injected metamask instead of remix vm to deploy transaction on our network ### Front end Instead of running it and using it inside remix lets create a separate front end - Two things are required ie ABI from compiler section and Address of Bank(not ours) from 'Deploy and run transaction' section. - Now create html file and type ```html