Commodity Prices
Commodity Price Oracle
Lumia provides real-time commodity price feeds through an on-chain oracle system, allowing developers to access current market prices for various commodities including precious metals, energy products, and agricultural goods.
Overview
The commodity price oracle provides real-time price data for:
Precious Metals (XAU/Gold, XAG/Silver, XPT/Platinum)
Energy (Brent Oil, Natural Gas)
Agricultural (Wheat, Corn, Sugar, Milk, Barley)
Industrial Metals (Copper, Aluminum)
How to Use
Contract Details
Mainnet
Oracle Contract Address:
0x146447574c02deB3B802A1d4c9447CB7648aA56DSender Address:
0x1ad5b38c108feca340398538e45c4e3abcce7401
Testnet
Oracle Contract Address:
0x146447574c02deB3B802A1d4c9447CB7648aA56DSender Address:
0x682e737dcd1d679cb0dbfd34b137038480d45ead
Integration Example
Here's a simple example showing how to query commodity prices in your smart contracts:
Available Commodity Keys
Each commodity has a unique key for price queries. Here are the available commodities and their corresponding keys:
Precious Metals
Gold (XAU/USD)
Mainnet Key:
0x1A4CF14646A65ED92B0F79291D4B537D4D634DAF4AE7BDEA7F95E16AFC106676Testnet Key:
0x8A8DF5C5476AD99D933701968710B3E18D16864A1D08F10916F09ED75E638DBBData Source: investing.com/currencies/xau-usd
Silver (XAG/USD)
Mainnet Key:
0xBB2F960A195C867A42E2AA5340AF4B3C62E789C0568FBBCE1925417E0FC62024Testnet Key:
0xF6743B90FD9E84F36C8E4D4D44A1642360BEFEBB48804CA013A613447930D311Data Source: investing.com/currencies/xag-usd
Energy
Brent Oil
Mainnet Key:
0x08250CF04C3D466C046942A4C0968A955202155F43CADB5699065CC1CD966BA7Testnet Key:
0x694848F20CA37676DF8E14670A53CD521332673EAFEC2F6735D0D3064891BE82Data Source: investing.com/commodities/brent-oil
Natural Gas (NG)
Mainnet Key:
0x598B52FA996FB56351A0B86CEFB0D12210D046DA2372044271F3495FC36081C9Testnet Key:
0x5AADF097C2159913CAA090D92F4947F7423FBC2404F6F6CDE21382E81B499198Data Source: investing.com/commodities/natural-gas
Industrial Metals
Copper (XCU)
Mainnet Key:
0x3C66B438005B1823E9544AC4BCA1BF1F3F70E40F75EBCD0F6E2DB3E968EF46E5Testnet Key:
0xEB93D2CB02A06E6CE522A66C58A90300E2A41B1226EED095141AD0B8B759BCF7Data Source: fxempire.com/commodities/copper
Aluminum (ALU)
Mainnet Key:
0xC746629AF536F44CA9EB4CEC98D18FE161700538200FABD786095A8D4894E0C2Testnet Key:
0xE5CE8F97E49B8C566DB4B97E61B0D89E6C08ED27D014A26C657D134C0A16199EData Source: markets.businessinsider.com/commodities/aluminum-price
All keys available on Mainnet and Testnet
💎 Precious Metals
Gold (XAU/USD)
Data Source: investing.com/currencies/xau-usd
Mainnet Key:
0x1A4CF14646A65ED92B0F79291D4B537D4D634DAF4AE7BDEA7F95E16AFC106676Testnet Key:
0x8A8DF5C5476AD99D933701968710B3E18D16864A1D08F10916F09ED75E638DBB
Silver (XAG/USD)
Data Source: investing.com/currencies/xag-usd
Mainnet Key:
0xBB2F960A195C867A42E2AA5340AF4B3C62E789C0568FBBCE1925417E0FC62024Testnet Key:
0xF6743B90FD9E84F36C8E4D4D44A1642360BEFEBB48804CA013A613447930D311
Platinum (XPT/USD)
Data Source: investing.com/currencies/xpt-usd
Mainnet Key:
0x6B3C26B2E54C43133545F29AD5EFA218C33B971ECFA3D416BBE124CCE36E3C23Testnet Key:
0x7F37D17D21F56D6F66D6A24DEC201D9E71E687FD4532EADF0B0C5E97C486135B
⚡ Energy
Brent Oil
Data Source: investing.com/commodities/brent-oil
Mainnet Key:
0x08250CF04C3D466C046942A4C0968A955202155F43CADB5699065CC1CD966BA7Testnet Key:
0x694848F20CA37676DF8E14670A53CD521332673EAFEC2F6735D0D3064891BE82
Crude Oil (CL1)
Data Source: marketwatch.com/investing/future/cl.1
Mainnet Key:
0x439A675FE33C23051E2204B402F68B3D91A1CAD75671D04508F74336BAF85C58Testnet Key:
0x24507204DC7AFD2FE0DE6DE7E2332C2337C21CBC4EFCAF19B76AF78C2875E9A8
Natural Gas (NG)
Data Source: investing.com/commodities/natural-gas
Mainnet Key:
0x598B52FA996FB56351A0B86CEFB0D12210D046DA2372044271F3495FC36081C9Testnet Key:
0x5AADF097C2159913CAA090D92F4947F7423FBC2404F6F6CDE21382E81B499198
🌾 Agricultural
Soybeans (S1)
Data Source: marketwatch.com/investing/future/s.1
Mainnet Key:
0xB9A774F78B3BBDD683742DDE0B16358520EDD8AB27E647957C86F8BE64F7714ETestnet Key:
0x0580E41830824C4E6A5D33AE323333CAABD928DC86A460AB56BC4C671951ABDE
Sugar (SB1)
Data Source: marketwatch.com/investing/future/sb.1
Mainnet Key:
0x54E8C6E777BC98A2524B5796C806D60CF679F095A1E6EF7BD1115386504130AATestnet Key:
0x95EF16A79150121C34CF3CCCF617868B3CB328390645017CC8824184317258F5
Wheat
Data Source: markets.businessinsider.com/commodities/wheat-price
Mainnet Key:
0xD44B850488E674DB7B52C7BA53F62952AAA0F7736DDEC400EFC926125E6CE631Testnet Key:
0x841CB2F3A7D406F8DA0C35D33EF75B568748D6E16572B5FAFBC9D0EA02903125
Milk
Data Source: markets.businessinsider.com/commodities/milk-price
Mainnet Key:
0xC8B9A93B99CAC793A3E9BC0D3F0C148E8BB74C2BA17ACF338AC9B68C4D3245A3Testnet Key:
0x4B7629AE8E616818C1BE5893CBD393AC2F03F9C3C826891C7B33F481B65498BE
Corn (C1)
Data Source: marketwatch.com/investing/future/c.1
Mainnet Key:
0x1BFEC616411F9068149BDBB93E09A3382BD7CF1DD64087C2233904729DBD22BATestnet Key:
0xF00B0505C993C9E8D602A2F620F38F3C3372A964504EDF087798BB2DE2326810
Barley (NBLc1)
Data Source: investing.com/commodities/ncdex-barley-futures
Mainnet Key:
0x750C1DE2A1D628DFDC0D1B03CF4071B7CB7DBC83043DECC61F0297565074CABBTestnet Key:
0x39C7337A5313B996E08A34446AB8A6A005830AC1BAED6AD1C529027528223222Note: Price converted from INR to USD
Hard Red Winter Wheat (HRN00)
Data Source: marketwatch.com/investing/future/hrn00
Mainnet Key:
0xB683174E54D13CD5CE8F3775A79CE55ECA20060D76A9FADA1962BFCA2D70E810Testnet Key:
0x17FEB2E491F2D704607BD2CE00313564A732091B4844AE7C460532C2F1B1EEF3
🏭 Industrial Metals
Copper (XCU)
Data Source: fxempire.com/commodities/copper
Mainnet Key:
0x3C66B438005B1823E9544AC4BCA1BF1F3F70E40F75EBCD0F6E2DB3E968EF46E5Testnet Key:
0xEB93D2CB02A06E6CE522A66C58A90300E2A41B1226EED095141AD0B8B759BCF7
Aluminum (ALU)
Data Source: markets.businessinsider.com/commodities/aluminum-price
Mainnet Key:
0xC746629AF536F44CA9EB4CEC98D18FE161700538200FABD786095A8D4894E0C2Testnet Key:
0xE5CE8F97E49B8C566DB4B97E61B0D89E6C08ED27D014A26C657D134C0A16199E
Testing the Oracle
You can test the oracle integration using the Neeedle UI:
Mainnet: Neeedle UI Mainnet Link
Testnet: Neeedle UI Testnet Link
To test:
Connect your wallet to the appropriate network (Mainnet or Testnet)
Use the
readAsUint256ByKey()functionInput the sender address and commodity key
Click "Read" to get the current price
Best Practices
Error Handling: Always implement proper error handling when interacting with the oracle
Gas Optimization: Cache oracle responses when possible instead of querying frequently
Validation: Verify returned prices are within expected ranges before using them
Update Frequency: Consider the update frequency of the price feeds when designing your application
Technical Considerations
Price feeds are updated regularly but may have slight delays
Check and confirm decimal places for each feed
Prices are sourced from reliable market data providers
The oracle contract is non-upgradeable for security
Support
For technical support or questions about the commodity price oracle:
Review the contract on Explorer
Last updated
Was this helpful?