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.
A live version of this demo app can be found at cf-web3.pages.dev.
- Clone the repo with
git clone git@github.com:cloudflare/cfweb3.git
- npm install in
contract
andfrontend
with:
cd cfweb3/contract
npm install
cd ../frontend
npm install
- Install Metamask, switch to the testnet and add funds (instructions below)
- Click on Metamask and then on the hamburger icon in the top right
- Click on "Account details"
- Click on "Export Private Key"
- Enter Metamask password
- Copy your private key
- In one terminal window, move into the
contract
directory and run:
dapk="YOUR_PRIVATE_KEY" npx hardhat node
- In a different terminal window, move into the
frontend
directory and run:
npm run dev
- Install Metamask
- Switch Metamask to the Rinkeby test network
-
Copy your Rinkeby account wallet address.
-
Go to the Rinkeby faucet
-
Post a Tweet or a Facebook status with your Rinkeby wallet address.
-
Enter the URL of your Tweet or Facebook post on the faucet website.
-
Claim the amount you want.
-
Delete the social media post (optional).