cloudflare / cfweb3

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CFWeb3

CFWeb3 is a Web3 demo application. It uses Hardhat and Solidity to create an Ethereum smart contract. This code is a proof-of-concept showing how to build Web3 applications with Cloudflare, and should not be used as a production example.

The contract offers 2048 tokens which can be minted via the frontend Svelte application. The entire app runs on the Rinkeby test network.

Demo

A live version of this demo app can be found at cf-web3.pages.dev.

Building locally

  1. Clone the repo with git clone git@github.com:cloudflare/cfweb3.git
  2. npm install in contract and frontend with:
cd cfweb3/contract
npm install
cd ../frontend
npm install
  1. Install Metamask, switch to the testnet and add funds (instructions below)
  2. Click on Metamask and then on the hamburger icon in the top right
  3. Click on "Account details"
  4. Click on "Export Private Key"
  5. Enter Metamask password
  6. Copy your private key
  7. In one terminal window, move into the contract directory and run:
dapk="YOUR_PRIVATE_KEY" npx hardhat node
  1. In a different terminal window, move into the frontend directory and run:
npm run dev

Adding funds to your Metamask test account

  1. Install Metamask
  2. Switch Metamask to the Rinkeby test network

Metamask switch to testnet

  1. Copy your Rinkeby account wallet address.

  2. Go to the Rinkeby faucet

  3. Post a Tweet or a Facebook status with your Rinkeby wallet address.

  4. Enter the URL of your Tweet or Facebook post on the faucet website.

  5. Claim the amount you want.

  6. Delete the social media post (optional).

About

License:Apache License 2.0


Languages

Language:JavaScript 46.7%Language:Svelte 26.0%Language:Solidity 12.3%Language:CSS 10.5%Language:TypeScript 3.0%Language:HTML 1.5%