github.com/diadata-org/diadata@v1.4.593/documentation/oracle-documentation/README.md (about) 1 # ⛓ Oracle Documentation 2 3 Oracles are smart contract interfaces that bring data from an external source into a smart contract. Smart contracts run in an isolated environment in a virtual machine and can not "measure" any outside information by themselves. The only way to get external data into a smart contract is by executing a transaction with the external data as a payload. With that data, a smart contract can perform calculations and operations that depend on this data, such as calculating an interest based on the reference interest rates published by a central bank. 4 5 DIA is capable of publishing financial data with such an oracle so that any smart contract can read and use it from within the Ethereum virtual machine. By generating verifiable oracle data, any user can use financial data in smart contracts. For each of our asset classes, there is an example data set available in the oracle. 6 7 To learn how to interact with DIA oracle smart contracts 8 9 {% content-ref url="access-the-oracle.md" %} 10 [access-the-oracle.md](access-the-oracle.md) 11 {% endcontent-ref %} 12 13 ## Multi-chain delivery 14 15 DIA operates oracles on 25+ blockchains. To enable developers to test DIA's oracle services, DIA provides Development Oracles for each supported chain. These Development Oracle contracts are smart contracts that provide a selected range of asset prices on various blockchains for live testing on a respective Mainnet and Testnet. 16 17 Get an overview on the following link: 18 19 {% content-ref url="deployed-contracts.md" %} 20 [deployed-contracts.md](deployed-contracts.md) 21 {% endcontent-ref %} 22 23 ## Data Categories 24 25 ### Price feeds 26 27 {% content-ref url="crypto-assets.md" %} 28 [crypto-assets.md](crypto-assets.md) 29 {% endcontent-ref %} 30 31 {% content-ref url="fiat-prices.md" %} 32 [fiat-prices.md](fiat-prices.md) 33 {% endcontent-ref %} 34 35 ### Randomness 36 37 {% content-ref url="randomness-oracle.md" %} 38 [randomness-oracle.md](randomness-oracle.md) 39 {% endcontent-ref %} 40 41 ### Guest quotations 42 43 DIA provides oracles for several guest quotations. 44 45 {% content-ref url="guest-quotations/coingecko-quotations.md" %} 46 [coingecko-quotations.md](guest-quotations/coingecko-quotations.md) 47 {% endcontent-ref %} 48 49 {% content-ref url="guest-quotations/coinmarketcap-quotations.md" %} 50 [coinmarketcap-quotations.md](guest-quotations/coinmarketcap-quotations.md) 51 {% endcontent-ref %} 52 53 ## Other 54 55 {% content-ref url="polkadot-offchain-worker.md" %} 56 [polkadot-offchain-worker.md](polkadot-offchain-worker.md) 57 {% endcontent-ref %} 58 59 {% content-ref url="polkadot-medianizer.md" %} 60 [polkadot-medianizer.md](polkadot-medianizer.md) 61 {% endcontent-ref %} 62 63 {% content-ref url="solana-oracle.md" %} 64 [solana-oracle.md](solana-oracle.md) 65 {% endcontent-ref %} 66 67 {% content-ref url="near-request-oracle.md" %} 68 [near-request-oracle.md](near-request-oracle.md) 69 {% endcontent-ref %} 70 71 ## Immutable Oracle Feeds 72 73 The DIA oracle data can be accessed in an Ethereum [smart contract](https://etherscan.io/address/0xD47FDf51D61c100C447E2D4747c7126F19fa23Ef). This smart contract holds mappings from an index to an asset's name, its price value, and – if applicable – supply data. 74 75 By using the read function `getCoinInfo(coin_name)` it is possible to retrieve this data. Along with the actual data there is a metadata field for the timestamp of the last update. 76 77 Updates are supplied by the DIA Oracle service that periodically supplies updates into the smart contract. Each update also generates an event, so that the latest updates can be seen in the event view on Etherscan. 78 79 ## Example DApp: ECB FX Rates for Cryptos 80 81 As an example application, we implemented and deployed a [simple smart contract that converts crypto asset prices from our oracle from USD to EUR](https://etherscan.io/address/0xccb30bf12177705d41ac208802a6066482a76eaa). 82 83 Call `getAssetEurRate()` with a crypto asset name as argument in order to request the current crypto asset price from our oracle which is then converted to EUR by using the ECB exchange rate for EUR-USD, also published in the oracle contract. In the above link, you can use the "Read Contract" tab for easy web access. The rate is displayed in a fix comma format with five decimal digits. The source code of that example contract can be found at the "Code" tab. This shows how easy it is to integrate our oracle into any application: compile your application against the oracle interface and set the address where the oracle is deployed afterwards. Ideally, this should be done in a way that allows updates if the oracle address changes at any time in the future. 84 85 ## Gas Estimation 86 87 All DIA oracles use the go-ethereum gas estimation to estimate the gas costs for an update contract call. To ensure timely delivery of the transaction, the gas estimate is scaled to 110% of the original estimate.