Installing and Launching a Backend in Express.js
This document provides a step-by-step guide on how to install and launch a test backend.
Step 1: Set Up the Environment
Clone Git Repo
We are going to start by cloning a public repository with the essentials configured to deploy an example consumer.
git clone https://github.com/ddrr1337/eyeOracle_public.git
Now you have a minimal Hardhat project to deploy an example contract.
Enter the repository folder and:
yarn install
Setup your .env file
Create a .env file in the root of your project and put any arbitrary API_KEY, or leave this one setted, Fill the rest of the fileds of .env file with your own data.
Use Base Sepolia OracleRouter address.
BASE_SEPOLIA_RPC=<your sepolia https provider>
PRIVATE_KEY=<your wallet private key>
BASE_ETHERSCAN_TOKEN=<base sepolia etherscan token to verify your contract https://sepolia.basescan.org/>
ROUTER_ADDRESS=<OracleRouter address>
API_KEY=rnmdfgdfwer34234asdfsdf41mp&*cm6hw+tm0!a^sdfsdfwe35uqx1z4
Step 2: Run the Server
Run the following command in the terminal:
node testServer.js
Now your express server is listening on port 4000.
Note: Ensure that your server's IP address is accessible from the outside to allow the Oracle to interact with it. You may need to configure your firewall or router settings accordingly.
Remeber that if you are using WSL you will need to forward your port to your local machine.
Open a Powershell console as admin and:
netsh interface portproxy add v4tov4 listenport=4000 listenaddress=0.0.0.0 connectport=4000 connectaddress=[YOUR_WSL_IP]