Our great sponsors
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
-
metamask-extension
:globe_with_meridians: :electric_plug: The MetaMask browser extension enables browsing Ethereum blockchain enabled websites
-
hardhat
Hardhat is a development environment to compile, deploy, test, and debug your Ethereum software.
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
OpenZeppelin's Ownable, an access control mix-in that allows us to implement functions that only the contract's owner (the address that deploys the contract) will be able to call.
Here we import hardhat and axios, which we'll need to request random numbers from the RANDOM.ORG API.
We will need a browser-based Web3 wallet to interact with the Replit Testnet and our deployed contracts. MetaMask is a popular and feature-rich wallet implemented as a WebExtension. You can install it from MetaMask's download page. Make sure you're using a supported browser – Chrome, Firefox, Brave, or Edge.
We'll write our data provider as a simple Node.js application, using the Hardhat Ethereum development environment to help us interact with the blockchain. This environment provides a host of features for writing, testing, and deploying smart contracts, and for building applications that interface with the blockchain, such as this one. It includes a slightly modified version of the ethers library, which is the main component we'll be using.
We'll also need to create a simple Node.js Express application to render the frontend. Create a file named frontend.js in your repl and add the following code to it: