Giter Site home page Giter Site logo

ethersv5's Introduction

Ethers.js Demo Scripts

Description

This repo contains demo node modules (javascript files) for interacting with the Ethereum blockchain using the Ethers.js library.

Assumed Knowledge:

  • node.js console applications
  • .env and the dotenv npm package
  • basic shell commands
  • asynchronous javascript (if editing existing scripts)

Setup Requirements

  • Infura account
    • Visit infura.io to set up a new account
    • Create a new project in your Infura account
    • The new project will have a ProjectID and secret that will be used in running the scripts
  • Node & NPM
  • VS Code (or similar)
  • Terminal window (VS Code inbuilt, powershell, gitbash)
  • Compiler requirements

Setup

  1. Copy & rename .env_example to .env
  2. Update projectId and projectSecret with credentials from your infura account
  3. Navigate to the folder location in a terminal window (cd C:\path\to\project\folder)
  4. Install npm i -g truffle to install the Ethereum contract compiler library globally
  5. Run npm install to install npm packages

Run the First Script (t1_generateAccounts.js)

  1. Run node t1_generateAccounts
  2. Add test network (rinkeby) value to account1:
  3. Update .env file with the account information that has been output to the console window

Run the first script containing contracts (tc1_createFungibleContract.js)

  1. Run truffle compile
    1. If this fails, check compiler is installed and requirements are met
  2. Run node tc1_createFungibleContract
  3. Update .env file with the contract address information (ftAddress)

Tasks/Demos:

  • node t1_generateAccounts: Generate new Ethereum Accounts
  • node t2_getBalance: Get the balance of an Ethereum Account
  • node t3_transferEth: Transfer Eth balance between two Ethereum Accounts
  • node t4_createFT: Create a new contract using ERC20 spec (Fungible Token)
  • node t5_transferTokens: Transfer tokens between accounts
  • node t6_createNFT: Create a new contract using ERC720 spec (Non Fungible Token)
  • node t7_transferNFT: Transfer an NFT between Ethereum Accounts

ethersv5's People

Contributors

severalpens avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.