Coder Social home page Coder Social logo

nextjs-smartcontract-lottery-fcc's Introduction

NextJS Smartcontract Lottery (Raffle) FCC

This is a section of the Javascript Blockchain/Smart Contract FreeCodeCamp Course.

⌨️ (16:34:07) Lesson 10: NextJS Smart Contract Lottery (Full Stack / Front End)

Full Repo

App

Example App here! Example App on IPFS here!

Built with ❤️ using: NextJS Solidity Chainlink Moralis web3uikit Ethers Hardhat IPFS

This project is a part of the Hardhat FreeCodeCamp video.

Video coming soon...

Getting Started

Requirements

  • git
    • You'll know you did it right if you can run git --version and you see a response like git version x.x.x
  • Nodejs
    • You'll know you've installed nodejs right if you can run:
      • node --version and get an ouput like: vx.x.x
  • Yarn instead of npm
    • You'll know you've installed yarn right if you can run:
      • yarn --version and get an output like: x.x.x
      • You might need to install it with npm or corepack

Quickstart

git clone https://github.com/PatrickAlphaC/nextjs-smartcontract-lottery-fcc
cd nextjs-smartcontract-lottery-fcc
yarn
yarn dev

Typescript

If you want to get to typescript and you cloned the javascript version, just run:

git checkout typescript

Optional Gitpod

If you can't or don't want to run and install locally, you can work with this repo in Gitpod. If you do this, you can skip the clone this repo part.

Open in Gitpod

Formatting in VSCode

To have VSCode extension prettier auto-format .jsx and .tsx, add the following to your settings.json file:

  "[typescriptreact]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[javascriptreact]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  }

Usage

  1. Run your local blockchain with the lottery code

In a different terminal / command line

git clone https://github.com/PatrickAlphaC/hardhat-fund-me-fcc
cd hardhat-fund-me-fcc
yarn 
yarn hardhat node

You can read more about how to use that repo from its README.md

  1. Add hardhat network to your metamask/wallet
  • Get the RPC_URL of your hh node (usually http://127.0.0.1:8545/)
  • Go to your wallet and add a new network. See instructions here.
    • Network Name: Hardhat-Localhost
    • New RPC URL: http://127.0.0.1:8545/
    • Chain ID: 31337
    • Currency Symbol: ETH (or GO)
    • Block Explorer URL: None

Ideally, you'd then import one of the accounts from hardhat to your wallet/metamask.

  1. Run this code

Back in a different terminal with the code from this repo, run:

yarn dev
  1. Go to UI and have fun!

Head over to your localhost and play with the lottery!

Testing

I didn't write any front end tests 😢

If you'd like to create some tests for this repo, please make a PR!

Deploying to IPFS

  1. Build your static code.
yarn build
  1. Export your site
yarn next export

Note: Some features of NextJS & Moralis are not static, if you're deviating from this repo, you might run into errors.

  1. Deploy to IPFS
  1. Copy the CID of the folder you pinned

IPFS

  1. Get IPFS companion for your browser (or use Brave Browser)

  2. Go to ipfs://YOUR_CID_HERE and see your ipfs deployed site!

Deploy to IPFS using Fleek

You can also have Fleek auto-deploy your website if you connect your github. Connect to fleek and follow along the docs there. You'll get an IPFS hash and a "regular" URL for your site.

Linting

To check linting / code formatting:

yarn lint

Thank you!

If you appreciated this, feel free to follow me or donate!

ETH/Polygon/Avalanche/etc Address: 0x9680201d9c93d65a3603d2088d125e955c73BD65

Patrick Collins Twitter Patrick Collins YouTube Patrick Collins Linkedin Patrick Collins Medium

nextjs-smartcontract-lottery-fcc's People

Contributors

patrickalphac avatar robocrypter avatar buikhacnam avatar ferrarosoftware avatar denchance avatar uday03meh avatar arrky avatar joonakauranen 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.