NaiveOracle is a student project for CSCD71 at the University of Toronto Scarborough, which seeks to understand the inner workings of oracles, and in particular: Decentralized Oracle Networks. We accomplish this by taking inspiration from the Chainlink Oracle Network v.1 following the methodology of the orginal white paper
Currently the architecture is an extremely simplified version of chainlink. The client contract hooks into the Oracle Network by using the IServerLevelAggrement interface which contains the broadcastOrder method which broadcast an order the oracle network for a request to completed
When UserContract sends a request to SLA
-
That means the user agrees to the rules we set up in our SLA**.**
-
The SLA is designed as a TOOL that accepts customized requests.
-
So SLA has minimum subjective operations, which means:
- To maintain the scope of using this tool, the tool never blocks an oracle.
-
i.e., for any oracle no meter hows their history (performance/reputation), there exist some customized requests allow this oracle to generate the answer for any user wants it to happen.
-
Customization allows the user has complete control of defining the "accuracy" and balancing between accuracy and cost to meet their specific requirement.
When SLA communicates with an Oracle
- we are not limiting the on-chain part of the oracle (contract)
- we are not limiting the off-chain part of the oracle (node)
- therefore the oracle(on/off-chain) is allowed to be fully customizable
- as long as they compatible with our SLAgreement
Note: this possibly makes the difference from Chainlink
NaiveTokens are intended to be the ERC20 tokens of our proof of concept network. User contracts will pay the tokens in exchange for access to the oracle network. Similarly oracle orperators would be require to stake coins in exchange for operating as an oracle node to incentivize good behaviour.
The Oracle represent the on chain component for oracle operators it is responsible for forwarding the answers to the SLA contract as will as being a contract which recieves and stakes NaiveTokens.
The user contract is an example contract on how user contracts in our network could be used.
To demonstrate the usecase we have a simple front end which calls a predefined user contract on chain which will call our oracle network for the price of eth/usd. Due to time constraints this part of the frontend is extremely simplified and some basic functionality such as Tokens and Reputation is not implemented.
The oracle node clients is responsible for listening to on chain contract for orders broadcasted by the user contract. Once it hears a order broadcasted event it will accept the order from the SLA retrieve the data needed and commit as part of a commit reveal scheme to the SLA contract. Once the SLA recieves every single commit it will move on to the reveal phase where the retrieved value is revealed to SLA contract.
- In contract folder, run
npx hardhat run scripts/deploy.ts --network goerli - Copy
TOKEN_ADDR,ORACLE_X,ORACLE_Y,ORACLE_Z,SLA,USER_CONTRACTfrom terminal and add them tooracle-node/.env - Extract
oracle-node/abi/Oracle.jsonandoracle-node/abi/SLA.jsonfromcontracts/artifacts/contracts/Oracle.sol/Oracle.jsoncontracts/artifacts/contracts/SLA.sol/SLA.json- By only copy the abi list
- In oracle-node folder, run
npm run startto execute oracle contractoracle-node/src/index.ts- you could run up to 3 nodes by switching the
process.env.ORACLE_{X,Y,Z}
- you could run up to 3 nodes by switching the
- In oracle-node folder, run
npm run testto execute user contractoracle-node/test/test.ts
- verifiable random number
- chainlnk v2
- Soso Song (Zhifei Song)
- Nikhil Lakhwani
- Peter Chou

