TaraTritt / dn-auction-dapp

Discount Note Auction DApp built with React & Solidity for the Ethereum Network

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dn-auction-dapp

This repo is built on top of the dapp-starter repo. It shows you how you can extend that repo to create a more complex Ethereum DApp.

The purpose of this DApp is to auction off Discount Notes

Prerequisites

Install to your computer:

  • Node.js (LTS is fine)
    • If you already have node installed, make sure you have at least version 8.0.0 >= of Node.js. You can check your node version by running this command:
node -v

Install to your browser:

  • Metamask
    • After installing, create an account
    • Make sure you select the Rinkeby Test Network from the top left corner of the extension - by default the Main Ethereum Network will be selected

Navigate to and follow the directions below for the following:

  • Rinkeby Ethereum Faucet
    • Copy your address from MetaMask by opening up the extension and clicking the ... and then selecting the option "Copy Address to clipboard"
    • Follow the instructions on the Faucet webpage to get your Ether and choose the 18.75 ethers option
    • This faucet will give you Ether for free on the Rinkeby Test Network. This will come in handy later when you are interacting with the DApp
  • Infura
    • Sign up for Infura at https://infura.io/, you should recieve an email will all the public ethereum networks - save the Rinkeby Test Provider URL for later
    • This url will allow you to connect to a node provided by Infura, which is required to interact with any Ethereum Network

Getting Started

If you are on a Windows computer, please execute this command as an administrator below first:

npm install --global --production windows-build-tools
  1. Install dependencies with npm
npm install
  1. If you want to view all the functionality, including the Auction Factory Manager functionality, you also need to deploy another instance of the Auction Factory contract, else skip to step 6.

  2. Modify ethereum/deploy.js to use the accounts you generated with MetaMask & use the Infura provider you registered

  • Replace the <MetaMask Mnemonic phrase> with the MetaMask mnemonic phrase that you saved earlier
  • Replace the <Infura Provider URL with Access Key> with the Rinkeby Test Provider URL that you saved earlier
const provider = new HDWalletProvider(
  "<MetaMask Mnemonic phrase>",
  "<Infura Provider URL with Access Key>"
);
  1. Deploy the contract to the Rinkeby Network. Make sure to execute this command inside the ethereum directory. This may take a few minutes to finish executing. Make sure to save the contract address generated. It will also be written to the ADDRESS file in the root directory
node deploy.js
  1. Again modify ethereum/contract-instances/auction-factory.contract.js to get your deployed contract instance via the address that was logged to the console
  • Replace the current address 0x7EbaC0da20592d950932b3b5BB0A1F6d99C2bCe2 with the saved address from the previous deployment step
const instance = new web3.eth.Contract(
  JSON.parse(AuctionFactory.interface),
  "0x7EbaC0da20592d950932b3b5BB0A1F6d99C2bCe2"
);
  1. Modify ethereum/web3.js to use your Infura Rinkeby Provider URL, which will be the default provider for web3.js if the user does not have MetaMask installed, otherwise it will use the MetaMask injected provider
const provider = new Web3.providers.HttpProvider("<Infura Provider URL with Access Key>");
  1. Run your app locally on port 3000. Make sure to execute this command from the root directory of your project
npm start

About

Discount Note Auction DApp built with React & Solidity for the Ethereum Network


Languages

Language:JavaScript 100.0%