Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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.

Open the Remix Solidity IDE link: https://remix.ethereum.org/

  1. Create a new Solidity File, On the far left of the screen press the plus sign within the solid circle name your cryptocurrency whatever you like.
  2. Modify, copy and paste the following code into the Remix Solidity IDE code writing and editing section:
  3. 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. Now compile

  5. Now, click Run button on the right side. It generates a new transaction with parameters
  6. Now under the Run tab, hit Deploy to create your own cryptocurrency.
  7. Once your currency is deployed a transaction summary will be displayed below the code writing and editing section, fill the information below:
    1. After filling in the information,write the pseudocode for the Cryptocurrency
      1. transaction hash-

        contract address-

        from-

        to-

        gas-

        transaction cost-

        execution cost-

        hash-

        input-

        decoded input-

        decoded output-

        logs-

        value-

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mastering Real Time Analytics In Big Data A Comprehensive Guide For Everyone

Authors: Lennox Mark

1st Edition

B0CPTC9LY9, 979-8869045706

More Books

Students also viewed these Databases questions

Question

What is paper chromatography?

Answered: 1 week ago

Question

Explain the cost of capital.

Answered: 1 week ago

Question

Define capital structure.

Answered: 1 week ago