NES.TECH Documentation
  • πŸ‘‹Welcome to NES.TECH
  • Overview
    • πŸ’‘What we do
  • SDKs Guide
    • πŸ“ͺKickstart with our SDKs
    • ⛓️Blockchain SDKs
      • πŸ“ŒSolana SDK
        • ⛏️generateAccount
        • ⛏️getAccountFromSecretKey
        • ⛏️getBalance
        • ⛏️sendSOL
        • ⛏️mintNFT
        • ⛏️estimateTransferToken
        • ⛏️estimateMint
        • ⛏️estimateSOLTransfer
        • ⛏️estimateMintToken
        • ⛏️createToken
        • ⛏️transferToken
      • πŸ“ŒEVM Chains SDK
        • ⛏️BulkNFT
          • πŸ”—deployContract
          • πŸ”—bulkMint
        • ⛏️NFT
          • πŸ”—deployContract
          • πŸ”—mint
          • πŸ”—convertToVLRY
          • πŸ”—VLRYToUSD
          • πŸ”—VLRYToCRYPTO
          • πŸ”—transferOwnership
          • πŸ”—transfer
          • πŸ”—estimateFee
            • πŸ“ŒERC20
              • ⛏️deploy
              • ⛏️mint
              • ⛏️transfer
            • πŸ“ŒERC721
              • ⛏️deploy
              • ⛏️mint
              • ⛏️transfer
            • πŸ“ŒERC1155
              • ⛏️deploy
              • ⛏️mint
              • ⛏️transfer
            • πŸ“ŒSoulbound
              • ⛏️deploy
              • ⛏️mint
        • ⛏️Contracts
          • πŸ”—ERC20
            • πŸ“ŒdeployContract
            • πŸ“Œtransfer
            • πŸ“Œmint
          • πŸ”—ERC721
            • πŸ“ŒdeployContract
            • πŸ“Œtransfer
            • πŸ“Œmint
            • πŸ“Œapprove
          • πŸ”—ERC1155
            • πŸ“ŒdeployContract
            • πŸ“Œtransfer
            • πŸ“Œmint
            • πŸ“ŒbalanceOf
          • πŸ”—Soulbound
            • πŸ“ŒdeployContract
        • ⛏️Wallet
          • πŸ”—getBalance
          • πŸ”—sendEther
          • πŸ”—depositEther
          • πŸ”—checkIfAddress
        • ⛏️NFTMarketPlace
          • πŸ”—listNFT
          • πŸ”—buyNFT
          • πŸ”—getNFT
          • πŸ”—placeBid
          • πŸ”—transferNFT
        • ⛏️BlockchainInfo
          • πŸ”—availableBlockchains
          • πŸ”—availableContracts
      • πŸ“ŒTokenomics SDK
        • ⛏️createStake
        • ⛏️removeStake
        • ⛏️approveVolary
        • ⛏️transferVolary
        • ⛏️getBalance
        • ⛏️claimRewards
        • ⛏️addRewards
        • ⛏️swapVlry
        • ⛏️getSwapAmountVolary
      • πŸ“ŒStorage SDK
        • ⛏️uploadToIPFS
        • ⛏️fetchMetadata
      • πŸ“ŒCasper SDK
        • ⛏️generateWallet
        • ⛏️fetchWalletFromPrivateKey
        • ⛏️fetchAccountHash
        • ⛏️getBalance
        • ⛏️transferTokens
        • ⛏️deployNFTContract
        • ⛏️mintNFT
        • ⛏️mintFreeNFT
        • ⛏️checkNFT
        • ⛏️approveSale
        • ⛏️transferNFT
        • ⛏️getNftOwner
        • ⛏️bid
        • ⛏️startBidding
        • ⛏️closeBidding
        • ⛏️cancelAuction
        • ⛏️getUserData
        • ⛏️getNftInfo
        • ⛏️getContractDetails
        • ⛏️getWalletDetails
        • ⛏️checkPublicKey
        • ⛏️getAllAuctionNft
        • ⛏️transferWithRoyalty
        • ⛏️getPaymentAmounts
        • ⛏️transferPlaceBidAmount
      • πŸ“ŒXY-Finance SDK
        • ⛏️getRecommendedTokens
        • ⛏️getQuote
        • ⛏️approveSwap
        • ⛏️executeSwap
      • πŸ“ŒWallet SDK
        • ⛏️createWallet
        • ⛏️getKeys
          • πŸ”—btc
          • πŸ”—evm
          • πŸ”—sol
          • πŸ”—near
        • ⛏️transfer
          • πŸ”—evm
          • πŸ”—sol
          • πŸ”—btc
          • πŸ”—near
        • ⛏️estimateFee
          • πŸ”—evm
          • πŸ”—sol
        • ⛏️txStatus
          • πŸ”—evm
          • πŸ”—sol
          • πŸ”—near
        • ⛏️getBalanceByMnemonic
          • πŸ”—evm
          • πŸ”—sol
          • πŸ”—btc
          • πŸ”—near
        • ⛏️chainBalances
          • πŸ”—evm
          • πŸ”—sol
        • ⛏️testChainBalances
        • ⛏️getTotalBalanceInUSDByAddresArray
          • πŸ”—evm
          • πŸ”—sol
        • ⛏️isAddress
          • πŸ”—evm
          • πŸ”—sol
        • ⛏️isPrivateKey
          • πŸ”—evm
          • πŸ”—sol
        • ⛏️isMnemonic
          • πŸ”—evm
      • πŸ“ŒExplorer SDK
        • ⛏️getLatestTxsOfAddress
        • ⛏️getLatestTxs
        • ⛏️getTransferFromAddress
    • πŸ€–AI Guide
      • πŸ“ŒOverview
      • πŸ“ŒFace Recognition
        • ⛏️faceRecoRegisterUser
        • ⛏️faceRecoCompareFaceWithId
        • ⛏️faceRecoCompareFaceWithFace
      • πŸ“ŒCheck Toxicity
        • ⛏️checkToxicityImage
        • ⛏️checToxicityTest
      • πŸ“ŒCaption and Tag Generator
        • ⛏️generateCaptionAndTagsFromImage
      • πŸ“ŒStable Diffusion
        • ⛏️stableDiffusionGenerateImage
      • πŸ“ŒImage Similarity
        • ⛏️imageSimilarityTrain
        • ⛏️imageSimilarityTest
  • Template Library
    • πŸ› οΈGet Started
    • πŸ•΅οΈTechnical Overview
    • πŸ‘·Smart Contracts
      • πŸ“ŒERC721
      • πŸ“ŒERC721A
      • πŸ“ŒERC1155
      • πŸ“ŒSoulbound
      • πŸ“ŒERC6551
        • πŸ“ŒAccount
        • πŸ“ŒRegistry
      • πŸ“ŒFractional
      • πŸ“ŒBiDirectionalPaymentChannel
      • πŸ“ŒSwap
      • πŸ“ŒERC2981
      • πŸ“ŒFlashloans
      • πŸ“ŒVault
      • πŸ“ŒERC884
      • πŸ“ŒPlay To Earn Contract
      • πŸ“ŒEscrow
      • πŸ“ŒUpgradableNFTContract
    • βš–οΈTemplates Library
      • πŸ₯‡Music Tracks/Album
      • πŸ₯‡Loyalty Point System
      • πŸ₯‡Real Estate Ownership
      • πŸ₯‡Artwork Authentication
      • πŸ₯‡Crowdfunding Platform
      • πŸ₯‡Social Tokens
      • πŸ₯‡Food and Recipe
      • πŸ₯‡Scientific Research
      • πŸ₯‡Educational Certification
      • πŸ₯‡Trading Cards
      • πŸ₯‡Digital Fashion
      • πŸ₯‡Bulk Digital Fashion
      • πŸ₯‡Governance Token
      • πŸ₯‡Content Licenses
      • πŸ₯‡Membership Cards
      • πŸ₯‡Bulk Membership Cards
      • πŸ₯‡Artifacts
      • πŸ₯‡Debt Instruments
      • πŸ₯‡Bulk Debt Instruments
      • πŸ₯‡Profit Sharing
      • πŸ₯‡Digital Souvenirs
      • πŸ₯‡Fractional Ownership of Intellectual Property
      • πŸ₯‡Digital Autographs and Signature
      • πŸ₯‡Bulk Digital Autographs and Signature
      • πŸ₯‡Film and Media Rights
      • πŸ₯‡Bulk Film and Media Rights
      • πŸ₯‡Sports Achievements
      • πŸ₯‡Bulk Sports Achievements
      • πŸ₯‡Digital Comics and Graphic Novels
      • πŸ₯‡Bulk Digital Comics and Graphic Novels
      • πŸ₯‡Proposals and Voting
      • πŸ₯‡Music Royalties
      • πŸ₯‡Gaming Royalties
      • πŸ₯‡Art Token Aggregation
      • πŸ₯‡Medical Token Aggregation
      • πŸ₯‡Charity Token Aggregation
      • πŸ₯‡Travel Token Aggregation
      • πŸ₯‡Time-Limited Access Tokens
      • πŸ₯‡Virtual Art Exhibition
  • KRYPTOKASE
    • πŸ› οΈKryptoKase: Overview
    • πŸ•΅οΈTechnical Overview
    • πŸ‘·Functionalities
      • πŸ“ŒCreate Token
      • πŸ“ŒMint Token
      • πŸ“ŒTransfer Tokens
      • πŸ“ŒAirdrop Token
      • πŸ“ŒSchedule Vesting
      • πŸ“ŒToken Analytics
  • AERIE
    • πŸ†Introduction
      • πŸ“ŒOverview
      • πŸ“ŒUse Cases
    • πŸ“–User Guide
      • πŸ“ŒDashboard
      • πŸ“ŒManaging Assets
        • πŸ”—Creating Assets
      • πŸ“ŒWallet Management
        • πŸ”—Overview
      • πŸ“ŒClient Management
        • πŸ”—Adding Client
        • πŸ”—Managing Members
      • πŸ“ŒInvoice Management
        • πŸ”—Managing Tickets
    • πŸ“ŒFeatures
      • πŸ”—AI Image Generation
      • πŸ”—Portfolio Management
      • πŸ”—CDN Analytics
  • ROMULUS
    • Contracts
      • Dynamic NFT
      • Rental NFT
      • ERC 998
      • Fractional NFT
  • Layer 1
    • πŸ—‘οΈDAG-EVM Hybrid Layer 1
    • ⛓️Setting up an RPC/RO Node
    • πŸ‘ΎNode Functions
      • πŸ“ftm.call()
      • πŸ“ftm.chainId()
      • πŸ“ftm.contract()
      • πŸ“ftm.currentEpoch()
      • πŸ“ftm.estimateGas()
      • πŸ“ftm.feeHistory()
      • πŸ“ftm.fillTransaction()
      • πŸ“ftm.filter()
      • πŸ“ftm.getAccounts()
      • πŸ“ftm.getBalance()
      • πŸ“ftm.getBlock()
      • πŸ“ftm.getBlockByHash()
      • πŸ“ftm.getBlockByNumber()
      • πŸ“ftm.getBlockNumber()
      • πŸ“ftm.getBlockTransactionCount()
      • πŸ“ftm.getBlockUncleCount()
      • πŸ“ftm.getCode()
      • πŸ“ftm.getCoinbase()
      • πŸ“ftm.getCompilers()
      • πŸ“ftm.getEvent()
      • πŸ“ftm.getGasPrice()
      • πŸ“ftm.getHashrate()
      • πŸ“ftm.getHeaderByHash()
      • πŸ“ftm.getHeaderByNumber()
      • πŸ“ftm.getHeads()
      • πŸ“ftm.getMaxPriorityFeePerGas()
      • πŸ“ftm.getPendingTransactions()
      • πŸ“ftm.getProof()
      • πŸ“ftm.getProtocolVersion()
      • πŸ“ftm.getStorageAt()
      • πŸ“ftm.getTransaction()
      • πŸ“ftm.getTransactionCount()
      • πŸ“ftm.getTransactionReceipt()
      • πŸ“ftm.icapNamereg()
      • πŸ“ftm.isSyncing()
      • πŸ“ftm.namereg()
      • πŸ“ftm.sendRawTransaction()
      • πŸ“ftm.signTransaction()
    • 🎫Admin Node Functions
      • πŸ“admin.addPeer()
      • πŸ“admin.addTrustedPeer()
      • πŸ“admin.exportChain()
      • πŸ“admin.getNodeInfo()
      • πŸ“admin.getPeers()
      • πŸ“admin.importChain()
      • πŸ“admin.removePeer()
      • πŸ“admin.removeTrustedPeer()
      • πŸ“admin.startHTTP()
      • πŸ“admin.startWS()
      • πŸ“admin.stopHTTP()
      • πŸ“admin.stopWS()
    • πŸ“„Oracle Contracts
      • πŸ“ŒTraffic Feed Contract
      • πŸ“ŒAir Quality Feed Contract
      • πŸ“ŒFootball Player Feed Contract
      • πŸ“ŒStock Price Feed Contract
      • πŸ“ŒWeather Feed Contract
      • πŸ“ŒCrypto Price Feed Contract
      • πŸ“ŒRandom Number Contract
Powered by GitBook
On this page
  • Introduction
  • Technical Description
  • Usage
  • Smart Contract Implementation
  • Contract Functions
  1. Layer 1
  2. Oracle Contracts

Crypto Price Feed Contract

Introduction

The Crypto Price Feed Oracle is a decentralized smart contract designed to fetch real-time cryptocurrency price data and provide it to other smart contracts. Acting as a bridge between blockchain applications and external data sources, this oracle enables smart contracts to securely and transparently access real-world cryptocurrency price information.

Technical Description

The Crypto Price Feed Oracle is implemented as a smart contract on a blockchain platform such as Ethereum. It listens for cryptocurrency price data requests, fetches real-time price information from an external API, and stores the data in a decentralized manner. This ensures accessibility, security, and immutability.

Workflow

  1. A user invokes the contract by providing a _symbol_crypto (e.g., "ETH").

  2. The contract makes an external API request to fetch the latest price of the specified cryptocurrency.

  3. The retrieved data is stored in the contract’s storage, and an event is triggered.

  4. Other smart contracts or users can monitor this event and retrieve the stored cryptocurrency price data.

Key Features

  • Secure and tamper-proof storage of cryptocurrency price data.

  • Transparent and publicly accessible data.

  • Pay-per-use model for requesting cryptocurrency price information.

  • Event-driven updates that notify subscribers when new data is available.

Usage

To interact with the Crypto Price Feed Oracle, follow these steps:

1. Deploy the Contract

Deploy the contract to the blockchain using the following Oracle Contract address:

0x380fAbAB6DbcCB27E0030B5C4aD1272aF10D5546

2. Request Cryptocurrency Price Data

Call the function:

requestCryptoData(_symbol_crypto, _sender_address)
  • _symbol_crypto: The ticker symbol of the cryptocurrency (e.g., "ETH", "BTC").

  • _sender_address: The address of the user making the request.

  • This is a payable function, meaning the user must pay a certain amount of Ether to access the price data.

  • On successful execution, the function returns a unique request ID.

3. Retrieve Cryptocurrency Price Data

Once the data is available, call:

retrieveData(id)
  • id: The request ID received from the previous function.

  • This function retrieves the latest cryptocurrency price data.

Smart Contract Implementation

// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;

interface CryptoPriceFeedOracle {
    function add(string memory symbol, address payable sender) external payable returns (string memory, address, int);
    function getCryptoData(uint _id) external view returns (string memory);
}

contract CryptoPriceFeedContract {
    address public cryptoOracleAddress;
    
    constructor(address _oracleAddress) {
        cryptoOracleAddress = _oracleAddress;
    }

    function requestCryptoData(string memory _symbol_crypto, address payable _sender_address) 
        public payable returns (string memory, address, int) 
    {
        return CryptoPriceFeedOracle(cryptoOracleAddress).add{value: msg.value}(_symbol_crypto, _sender_address);
    }

    function retrieveData(uint id) public view returns (string memory) {
        return CryptoPriceFeedOracle(cryptoOracleAddress).getCryptoData(id);
    }
}

Contract Functions

1. Constructor

constructor(address _oracleAddress)
  • Initializes the contract with the address of the CryptoPriceFeedOracle smart contract.

2. Request Cryptocurrency Price Data

function requestCryptoData(string memory _symbol_crypto, address payable _sender_address) public payable returns (string memory, address, int)
  • Allows users to request price data for a specific cryptocurrency.

  • Requires a payable transaction where users must send Ether to access the data.

  • Takes in _symbol_crypto (cryptocurrency ticker symbol) and _sender_address (user's address).

  • Calls the add function on the Oracle contract to store the requested data and generate an ID.

  • Returns:

    • symbol_crypto: The requested cryptocurrency symbol.

    • sender: Address of the requester.

    • id: Unique request ID.

3. Retrieve Cryptocurrency Price Data

function retrieveData(uint id) public view returns (string memory)
  • Fetches stored cryptocurrency price data for a given request ID.

  • Calls getCryptoData function on the Oracle contract.

  • Returns:

    • price: The latest price of the requested cryptocurrency.

Last updated 3 months ago

πŸ“„
πŸ“Œ