Oracles are a smart contracts' way of getting information from the external world. They are the bridge between centralized servers, external blockchains, and APIs, with smart contracts running on Ethereum. Essentially, they are a service that provides you with important information from places inaccessible with normal smart contracts, and they work by setting a centralized server listening to web3 events for your contract.
First, create a new project named oracle, run truffle init to be able to compile contracts, set up npm with npm init -y, and create a smart contract that generates events and handles Oracle.sol:
pragma solidity 0.5.4;contract Oracle { event GenerateRandom(uint256 sequence, uint256 timestamp); ...