Asg3-ethereum-sep21 (1)

docx

School

Kennesaw State University *

*We aren’t endorsed by this school

Course

4823

Subject

Computer Science

Date

Feb 20, 2024

Type

docx

Pages

6

Uploaded by MagistrateScience5019

Report
IT4823 – Asg3 C rypto, Currency lab Total point: 100 Last Name: ___Imoukhuede___________________ First Name: _________Renua______________ Date: ___09/13/21________ Goal: This lab will teach you how to create a simple cryptocurrency token based on Ethereum, the next- generation smart contract and decentralized application platform, on your local virtual machine. Token systems and currencies are databases with one primary operation, which is subtracting X units from database A, and correspondingly adding X units to database B, with the following provision: 1. Database A has at least X units before the transaction. 2. The transaction is approved by A. This logic can be easily implemented into a contract based on Ethereum smart contract platform, many tokens have already been created and utilized for ICO (Initial Coin Offering) projects. Follow the following direction on how to create your own cryptocurrency token by writing a Solidity program. 1. Open the Remix Solidity IDE link:   https://remix.ethereum.org/   , you will see the default screen. Insure the folder icon on the left is selected. Pick SOLIDITY and contracts (see red ractangles) 2. Create a new Solidity Contract (New File) and call it whatever you like. I called my file rattlecoin. Copy in the code from below….Again see red rectrangles 1 | P a g e
3. Now, let us compile our code – Select the interlocking chevrons – see red rectangle. And then compile your file – compile rattlercoin.sol below in y example – 2 | P a g e   Code writing and editing section list of Solidity files – create rattlercoin pragma solidity ^0.5.3; contract RattlerCoin { string public name = 'RattlerCoin'; //currency name. Please feel free to change it string public symbol = 'rc'; //choose a currency symbol. Please feel free to change it mapping (address => uint) balances; //a key-value pair to store addresses and their account balances event Transfer(address _from, address _to, uint256 _value); //declaration of an event. Event will not do anything but add a record to the log constructor () public { //when the contract is created, the constructor will be called automatically balances[msg.sender] = 10000; //set the balances of creator account to be 10000. Please feel free to change it to any number you want. } function sendCoin(address _receiver, uint _amount) public returns(bool sufficient) { if (balances[msg.sender] < _amount) return false; // validate transfer balances[msg.sender] -= _amount; balances[_receiver] += _amount; emit Transfer(msg.sender, _receiver, _amount); // complete coin transfer and call event to record the log return true; } function getBalance(address _addr) public view returns(uint) { //balance check return balances[_addr]; } }
4. Deploy the rattlercoin contract a. Select the deploy arrow on left menu (highlighted red box below) b. When completed, view the debug information 3 | P a g e
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
5. Run the code via the Debugger. Debug the code. Make sure every step is executed. The information you need is on the debug information. Click the arrow next to Debug for details… 4 | P a g e
Part I: Once your currency is deployed a transaction summary will be displayed below the code writing area (in the debug area), fill the information below: [30 point] Part II [30 point]. Please do not skimp on your answer 1. Describe in detail what is happening for the Cryptocurrency lab above? 10000 units of the cryptocurrency is assigned to the user’s account. Then, the recipient’s address and units of the currency the user needs to transfer is noted. There is a function that deducts that amount from the user’s account and drops an equal amount to the account of the recipient. 2. What is the purpose of a nonce? The purpose of nonce is to protect private communications by preventing replay attacks. They are used for authentication for purchases, two-factor authentication, or other kinds of account recovery and identification. 3. What powers the Ethereum Virtual machine? Gas powers the Ethereum Virtual machine. 4. What is the purpose of a gas? The purpose of gas is to act as a token or pricing fee to run a transaction or contract in EVM. 5 | P a g e status true Transaction mined and execution succeed transactio n hash 0xcb210da7b36b2172797fe434d21347c7ae0ff6b73a9f76650e83235bf9fd5c2d contract address from 0x5B38Da6a701c568545dCfcB03FcB875f56beddC4 to ExchangeIfy.(constructor) gas 80000000 gas transactio n cost 80000000 gas execution cost 424281 gas hash 0xcb210da7b36b2172797fe434d21347c7ae0ff6b73a9f76650e83235bf9fd5c2d input 0x608...10032 decoded input {} decoded output - logs [] value [object HTMLTableRowElement] wei
___________________________________________________________________________________________________________________________ ___________________________________________________________________________________________________________________________ Part III: [40 point]. Please do not skimp on your answer. https://blockgeeks.com/guides/blockchain-jobs/ 1. According to the article, “Blockchain Jobs: Is One Right for you?” what is the first and second desired skill in the Q3 of 2017? Robotics specialist was the most desired skill, while blockchain specialist fell in second place. 2. What are Smart contracts? Smart contracts are self-executing contracts that have precise instructions written in code that automatically execute when terms and conditions in the contract are made. 3. What is Solidity? Solidity is a reduced, object-oriented, high level programming language used to create smart contracts, and it bares similarity to ECMAScript. 6 | P a g e
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help