{"id":20878960,"url":"https://github.com/anaselii/ethers_oracle","last_synced_at":"2025-07-11T20:04:03.196Z","repository":{"id":250161305,"uuid":"833602392","full_name":"AnasElii/Ethers_Oracle","owner":"AnasElii","description":"A simple Ethereum oracle that fetches data from an external API and feeds it to a smart contract using ethers.js. This project serves as an example for learning how to create and use oracles in Ethereum smart contracts.","archived":false,"fork":false,"pushed_at":"2024-07-25T13:33:20.000Z","size":76,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-12T16:45:27.478Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AnasElii.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-25T11:30:59.000Z","updated_at":"2024-07-25T13:33:23.000Z","dependencies_parsed_at":"2024-07-25T15:31:52.128Z","dependency_job_id":"8cf4f3e2-eb4d-4f1d-af3c-9831bf14c88b","html_url":"https://github.com/AnasElii/Ethers_Oracle","commit_stats":null,"previous_names":["anaselii/ethers_oracle"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AnasElii/Ethers_Oracle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnasElii%2FEthers_Oracle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnasElii%2FEthers_Oracle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnasElii%2FEthers_Oracle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnasElii%2FEthers_Oracle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AnasElii","download_url":"https://codeload.github.com/AnasElii/Ethers_Oracle/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnasElii%2FEthers_Oracle/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264890087,"owners_count":23678833,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-18T07:14:42.603Z","updated_at":"2025-07-11T20:04:03.168Z","avatar_url":"https://github.com/AnasElii.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple Ethereum Oracle\n\nThis repository contains a simple Ethereum oracle that fetches data from an external API and feeds it to a smart contract using `ethers.js`. This project is intended for educational purposes to demonstrate how to create and use oracles in Ethereum smart contracts.\n\n## Features\n\n- Fetches data from an external API.\n- Updates the smart contract with the fetched data.\n- Uses `ethers.js` for blockchain interactions.\n- Simple and easy-to-understand implementation.\n\n## Prerequisites\n\n- Node.js (v12 or higher)\n- npm (v6 or higher)\n- An Infura project ID\n- An Ethereum wallet private key\n- An Ethereum smart contract deployed on the mainnet\n- Hardhat Framework, but you can use any other tool like Remix, Truffle, or even deploy it manually. \n\n## Getting Started\n\n### 0. Setting Up The Data Provider\nTo Setup the dataprovider you need to follow the instructions on the [`Football Data Provider/`](https://github.com/AnasElii/Ethers_Oracle/tree/master/Football%20Data%20Provider\n) directory.\n\n### 1. Clone the Repository\n\n```bash\ngit clone https://github.com/AnasElii/ethers_oracle.git\ncd ethers_oracle\n```\n\n### 2. Install Dependencies\n\n```bash\nnpm install\n```\n\n### 3. Set Up Environmentt Varaibles\nCreate a .env file in the root directory of the project and add the following environment variables:\n\n```bash\nINFURA_PROJECT_ID=your_infura_project_id\nPRIVATE_KEY=your_private_key\nCONTRACT_ADDRESS=your_contract_address\n```\n\n### 4. Update Contract ABI\nReplace the contractABI in index.js with your smart contract's ABI.\n\n### 5. Run the Oracle Service\n\n```bash\nnode index.js\n```\n\nThis will start the oracle service, which will fetch data from the specified API and update the smart contract every 1 minutes because Football-data.org only allow us to fetch data each minute.\n\n## Smart Contract\n\nThe smart contract (On-Chain Component) used in this project is a simple contract that allows the owner to update its data. Below is an example of the smart contract:\n\n```bash\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\ncontract SimpleOracle is Ownable {\n    uint256 public data;\n\n    event DataUpdated(uint256 indexed newData);\n\n    function updateData(uint256 _data) public onlyOwner {\n        data = _data;\n        emit DataUpdated(_data);\n    }\n}\n```\n\nDeploy this contract using a tool like Remix, Hardhat, or Truffle, and get the contract address to use in your .env file.\n\n## Contributing\nFeel free to fork this repository and submit pull requests. Any improvements or suggestions are welcome!\n\n## License\nThis project is licensed under the MIT License.\n\n```bash\nFeel free to adjust any parts of the description and README to better suit your specific project details.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanaselii%2Fethers_oracle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanaselii%2Fethers_oracle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanaselii%2Fethers_oracle/lists"}