Skip to content

What You Will Learn

This is the official tutorial for the Morpher Oracle. In this comprehensive guide, you will build a complete Oracle-enabled DApp from scratch.

By the end of this tutorial, you will have created this DApp: https://morpher-oracle-silver-nft-demo.vercel.app/

You will gain:

  1. A deep understanding of how the Morpher Oracle works
  2. Experience deploying and unit testing Oracle-enabled smart contracts
  3. Knowledge of implementing Oracle-enabled transactions in your UI
  4. Familiarity with data feeds provided by the Oracle
  5. Insights into the Oracle's internal workings to build any Oracle-enabled application that relies on live price feeds

Final Product

The final product of this tutorial is a fully functional NFT minting website that leverages real-time price feeds from the Morpher Oracle. Users can mint NFTs that are priced according to the current market value of Silver, with prices sourced directly from traditional commodities exchanges.

When interacting with the website, users will experience a seamless minting process powered by account abstraction (ERC-4337). Behind the scenes, the system creates a Meta-Transaction (UserOp) that gets processed by a specialized bundler. This bundler understands the data dependencies of your transaction and automatically injects the required real-time price information before forwarding everything to the ERC-4337 Entrypoint.

The smart contract integration uses Data-Dependent requests to ensure price accuracy, while the NFT itself implements the ERC-721 standard. Each minted NFT captures a unique moment in time by storing the exact Silver price (with 18 decimal precision) as an NFT trait, visible on marketplaces like OpenSea.

You can track the entire transaction flow through JiffyScan, where you'll see how the Oracle data, user operation, and final transaction come together in a single atomic operation. This architecture eliminates common issues like front-running while maintaining perfect price accuracy at the moment of minting.

Video Walkthrough

We've created this comprehensive video tutorial to complement the written guide, as we understand everyone has different learning preferences. For the best learning experience, we recommend keeping both the video and written tutorial open in separate tabs to follow along.

This end-to-end walkthrough covers:

  1. Making smart contracts Oracle-enabled to fetch real-time:

    • Stock prices
    • Commodity prices
    • Index values
    • Crypto data
  2. Technical Integration:

    • Integrating a Foundry project within a NextJS application
    • Unit testing Oracle-enabled smart contracts
    • Deploying smart contracts on Polygon using Forge scripts
    • Verifying contracts on Polygonscan
  3. Advanced Features:

    • Implementing data-dependent ERC-4337 UserOps
    • Building real-time blockchain applications
    • Working with Oracle price feeds

Follow along to build your first Oracle-enabled real-time blockchain application today!

Target Audience

This tutorial is designed for experienced blockchain developers who:

  • Have a strong understanding of Ethereum and EVM-compatible chains
  • Are familiar with smart contract development and Solidity
  • Have experience with Web3 frontend development
  • Understand the basics of Account Abstraction (ERC-4337)
  • Are looking to integrate real-time price feeds into their DApps

Prerequisites

Before starting this tutorial, ensure you have:

Technical Knowledge:

  • Advanced Solidity programming
  • Experience with smart contract testing frameworks
  • Understanding of ERC standards (ERC-721, ERC-4337)
  • Familiarity with React/NextJS development
  • Knowledge of TypeScript and Web3 libraries

Development Environment:

  • Node.js v18+ installed
  • Git configured
  • A code editor (VSCode recommended)
  • MetaMask or another Web3 wallet
  • Some test MATIC/POL tokens on Polygon network

Concepts:

  • Understanding of Oracle systems and price feeds
  • Knowledge of account abstraction and meta-transactions
  • Familiarity with gas optimization patterns
  • Experience with EIP-712 signatures

What we cover in this tutorial

Now that you've seen what we're building, we take a structured approach to build that from scratch. In this tutorial I assume you have some knowledge about Ethereum Development and Account Abstraction already, if you don't I'll link learning resources below that help you get up to speed quickly. I will keep the code parts brief and explain things line by line throughout the video. If you have any questions, or want to stay up to date, feel free to join our community - link also below.

Video Tutorial about Account Abstraction

Morpher Oracle Telegram Community