GithubHelp home page GithubHelp logo

bedlam520 / hardhat-local-node Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thirdweb-example/hardhat-local-node

0.0 0.0 0.0 1.07 MB

Deploy your smart contracts to a local node and use the thirdweb SDK to interact with them

Home Page: https://hardhat-local-node.thirdweb-preview.com

JavaScript 22.59% TypeScript 33.79% CSS 33.41% Solidity 10.20%

hardhat-local-node's Introduction

Hardhat Local Node with thirdweb

Use the React SDK to interact with smart contracts deployed to a local Hardhat node.

The code is split into two directories:

  1. contracts: Contains the smart contracts and the scripts to deploy to a local node.
  2. application: Contains the React application that interacts with the smart contracts.

Setup

Clone this repository using the CLI.

npx thirdweb create --template hardhat-local-node

Install the dependencies for the project, in both the contracts and application directories.

cd application
npm install

cd ../contracts
npm install

Running a local node

Use the hardhat CLI to run a local node.

# From within the /contracts directory
npx hardhat node

Deploy the smart contracts

Use the CLI to deploy the smart contracts to the local node via the dashboard.

# From within the /contracts directory
npx thirdweb deploy

This command compiles your contract and produces a link to the dashboard where you can deploy the contract to a local node.

Use the Request testnet funds button to load your wallet with some funds to deploy the contract.

request-funds.png

Ensure to select the Localhost (ETH) network and click on the Deploy button!

deploy.png

Once deployed, copy your contract address from the dashboard:

copy-address.png

Paste it in the application/pages/index.tsx file, within the useContract hook.

const Home: NextPage = () => {
  const { contract, isLoading, error } = useContract(
    // Your contract address here!
    "0x..."
  );
};

export default Home;

Join our Discord!

For any questions, suggestions, join our discord at https://discord.gg/thirdweb.

hardhat-local-node's People

Contributors

jarrodwatts 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.