Connect your Ethereum smart contract to any real world API using the oracle pattern!

Overview

Minimal Viable Oracle (MVO) - An effective way to Build your own oracle with Solidity

Licence Tweet Fork

Smart contracts cannot access off-chain data directly. This repository demonstrates how to connect Ethereum to any real world API using the oracle pattern.

Check out the associate blog post here.

This project is only tested on macOS

1. Deploy contracts

npx hardhat run scripts/1_deploy-contracts.js --network rinkeby

This script will deploy and verify the contracts.

2. Listen to ethereum events (open two separate tabs)

npx hardhat run scripts/2_listen-to-oracle-requests.js --network rinkeby npx hardhat run scripts/2_listen-to-client-fulfillments.js --network rinkeby

The 2_listen-to-oracle-requests.js must run in order to respond to the request from the client!

3. Draw some cards (finally!)

npx hardhat run scripts/3_draw-cards.js --network rinkeby

The script will draw 52 cards in one go (and without reshuffling after every request). You can change this behavior if you want. Make sure you have some testnet Ether in you wallet, since every every request sends 0.001 ETH to the oracle.


Disclaimer: This code has not been professionally audited. Use at your own risk. Also keep in mind that centralized oracles are a point of failure. Always use decentralized oracles if possible.

You might also like...

Jogo da Forca em JavaScript - Alura Challenge - Oracle ONE

Jogo da Forca em JavaScript - Alura Challenge - Oracle ONE

❗ Jogo da Forca | Segundo Desafio Proposto | Alura - ONE | 💾 Tecs Utilizadas ⭐ ⭐ ⭐ ✍🏻 Descrição Clássico jogo da forca que marcou nossas infâncias,

Nov 16, 2022

Proyecto de encriptasion, echo para el curso de Oracle Next Education 2022

Encriptador Proyecto de Encriptador, echo para el curso de Oracle Next Education 2022. Link directo al proyecto desplegado Link al Encriptador Instruc

Dec 28, 2022

Decentralised Oracle Network for Subjective Data Feeds (testnet).

deOracle.xyz deOracle.xyz is a decentralised P2P oracle platform with a cross-chain reputation system for digital identities. Our goal is to bring rel

Oct 28, 2022

♦ Crowd funding project using Smart Contracts on the Ethereum. Created with Next.js and Tailwind CSS.

♦ Crowd funding project using Smart Contracts on the Ethereum. Created with Next.js and Tailwind CSS.

Crowdcoin ♦ Crowd funding project using Smart Contracts on the Ethereum. Created with Next.js and Tailwind CSS. Project from "Ethereum and Solidity: T

Dec 14, 2022

Using a Decentralized Application (DApp) to Sell artwork on the Ethereum blockchain with smart contracts written in Solidity.

Decentralized Applications For Selling Limited Time Artwork This repository houses the Solidity, JavaScript, and HTML code for a Decentralized Applica

Mar 20, 2023

Ethereum Smart Contracts for locking your Ether and ERC20 tokens based on time and price conditions

SmartHold - a simple way to lock and hold your ETH or ERC20 in a smart contract This is a BETA software that has not been audited for security. USE AT

May 5, 2022

✍️ Easily sign any message using your Ethereum wallet

wallet-sign Easily sign any message using your Ethereum wallet Use the app here: https://marcusmolchany.github.io/wallet-sign Depolyment yarn deploy D

Nov 26, 2022

Hands-on real world projects that will help you exercise your knowledge of TypeScript.

Learning TypeScript Projects Hands-on real world projects that will help you exercise your knowledge of TypeScript. Welcome to the repository housing

Dec 26, 2022

First smart contract deployed on Rinkeby.

First smart contract deployed on Rinkeby.

Inbox-Contract First smart contract deployed on Rinkeby. It has a basic constructor which accpets a string and assigns the string to the message varia

Dec 26, 2021
Owner
Noah
Noah
Your Ethereum control panel. Interact with smart contracts on Ethereum.

etherfunk Your Ethereum control panel. Interact with smart contracts on Ethereum. ?? https://etherfunk.io ?? Devleopment First, run the development se

Tom Quirk 23 Sep 24, 2022
chain-syncer is a module which allows you to synchronize your app with any ethereum-compatible blockchain/contract state. Fast. Realtime. Reliable.

Chain Syncer Chain Syncer is a JS module which allows you to synchronize your app with any ethereum-compatible blockchain/contract state. Fast. Realti

Miroslaw Shpak 10 Dec 15, 2022
Connect Web Integration illustrates the integration of Connect-Web in various JS frameworks and tooling

Connect Web Integration Connect Web Integration is a repository of example projects using Connect-Web with various JS frameworks and tooling. It provi

Buf 43 Dec 29, 2022
A web app to post emoji implemented in connect-go and connect-web.

emotter Emotter is an app to post and share single emoji. This is an example app of connect. Example https://emotter.syumai.com API: Cloud Run Web cli

syumai 11 Oct 30, 2022
🔐 Protect your Smart Contract Proxy from storage collisions upon upgrading, by running this action in a CI on each of your Pull Requests!

?? ??️ Foundry Storage Upgrade Seatbelt Protect your Smart Contract Proxy from storage collisions upon upgrading, by running this action in a CI on ea

Romain Milon 11 Dec 24, 2022
Write "hello world" in your native language, code "hello world" in your favorite programming language!

Hello World, All languages! ?? ?? Write "hello world" in your native language, code "hello world" in your favorite language! #hacktoberfest2022 How to

Carolina Calixto 6 Dec 13, 2022
Web3-citizens-app - React application based on smart contract using web3 and MetaMask extention.

Citizens App (web3-react-redux) React application based on smart contract using web3 and MetaMask extention. Start the applicarion Recomend to install

Denys Voloshyn 3 Aug 25, 2022
In this repository, I try to perform a mainnet fork and then simulate popular smart contract exploits on various DEFI Protocols using Hardhat Framework.

defiHacks_via_Hardhat 1. Alchemix Access Control Bug Any user could have called setWhitelist() to give an attacker the ability to call the harvest fun

null 34 Dec 27, 2022
Pull a smart contract from mainnet onto your local chain.

hardhat-copy hardhat-copy helps you import an Ethereum mainnet smart contract onto your local Hardhat node, enabling you to rapidly experiment with pr

Alexander Thomas 6 Aug 21, 2022
Alura Challenge Oracle One Logica de Programacion Latam

Alura Challenge Oracle One Logica de Programacion Latam Desafio 1 Encriptador de texto Este repositorio fue creado como solución al Challengue #1 prop

null 2 Jan 31, 2022