+
Skip to content

hadesbaker/nextjs-moralis

Repository files navigation

This is a Next.js and Moralis project bootstrapped with create-next-app.

Requirements

  • git
    • You'll know you've installed it right if you can run:
      • git --version
  • Nodejs & npm
    • You'll know you've installed nodejs right if you can run:
      • node --version And get an ouput like: vx.x.x
    • You'll know you've installed npm right if you can run:
      • npm --version And get an ouput like x.x.x
      • You might need to install it with npm
  • 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
  • Metamask
    • This is a browser extension that lets you interact with the blockchain.

Quickstart

First, run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev

Open http://localhost:3000 and you should see a small button that says "connect".

Hit it, and you should see metamask pop up.

Execute a transaction

If you want to execute a transaction follow this:

Make sure you have the following installed:

  1. You'll need to open up a second terminal and run:
git clone https://github.com/PatrickAlphaC/hardhat-simple-storage
cd hardhat-simple-storage
yarn
yarn hardhat node

This will deploy a sample contract and start a local hardhat blockchain.

  1. Update your page.js with the new contract address.

In your page.js file, update the variable contractAddress with the address of the deployed contract. You'll see it near the top of the hardhat output.

  1. Rebuild
yarn build
  1. Connect your metamask to your local hardhat blockchain.

PLEASE USE A METAMASK ACCOUNT THAT ISNT ASSOCIATED WITH ANY REAL MONEY. I usually use a few different browser profiles to separate my metamasks easily.

In the output of the above command, take one of the private key accounts and import it into your metamask.

Additionally, add your localhost with chainid 31337 to your metamask.

About

Basic NextJS & Moralis Application

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载