I am a beginner learning blockchain development, and I am watching a tutorial on creating a simple dapp that transfers ether to another address, in the tutorial he creates a smart contract called transaction, then he proceeds to make the transaction using ethers.js, then what is the point of creating a contract if I am going to make the transaction using ethers js, and which to choose to use?
Transaction.sol
pragma solidity ^0.8.9;
contract Transaction{
event Transfer(address from, address receiver, uint amount, string message, uint256 timestamp, string keyword);
struct TransferStruct{
address sender;
address receiver;
uint amount;
string message;
uint256 timestamp;
string keyword;
}
TransferStruct[] transactions;
function addToBlockchain(address payable receiver, uint amount, string memory message, string memory keyword ) public{
transactions.push(TransferStruct(msg.sender, receiver, amount, message, block.timestamp, keyword));
emit Transfer(msg.sender, receiver, amount, message, block.timestamp, keyword);
}
function getAllTransactions() public{
}
function getTransactionCount() public view returns(uint256){
}
}