This repository contains the source code for a tutorial on building an oracle using the Celo blockchain. The project demonstrates how to create a smart contract, an off-chain server to fetch data from a RESTful API, and a client-side application to display the data submitted to the Celo blockchain. By following the tutorial and exploring this repository, you can create your own oracle to securely provide off-chain data to your smart contracts.
Clone this repository to your local machine:
git clone https://github.com/your_username/celo-oracle.git
Before you begin, ensure you have the following software installed:
- Node.js
- Truffle Suite
- Celo Extension Wallet (Chrome extension)
Additionally, sign up for a free API key from OpenWeather API.
Navigate to the project directory and install the required packages:
cd celo-oracle
npm install
- Update the privateKey and accountAddress variables in the server/index.js file with your own private key and MetaMask account address, respectively.
- Update the OPEN_WEATHER_API_KEY variable in the server/index.js file with your OpenWeather API key.
- Run the off-chain server:
cd server
npm start
Deploy the smart contract to the Celo Alfajores test network by running the following command in the project directory:
truffle migrate --network alfajores
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.