1

I want to use the real time Buy price and sell price of commodities e.g GOLD/USD (XAU/USD) in my smart contract.

I know I can use API through chainLink, JSON parse the data and use it. But I do not want to expose my endpoint(from where I get the data from) in the smart contract.

The second alternative could be creating my own external adapter and put that endpoint here and use that external adapter's JOB-ID in my smart contract to get the data.

Is there any other way I could get the data from? Like chainlink provides priceFeed for some commodities, but its spot price. I want BUY and SELL both price.

2 Answers 2

1

For a smart contract to use the data, somebody needs to post the data on a blockchain. Either you or someone else.

  • If you don't want to expose the price feed endpoint, then you need to post the market price yourself

  • But because you are the only source of the price, there is no point to write smart contracts in the first place, because people are implicitly trusting you as a single entity and you can screw over any smart contract user in any way you wish

Thus, there has to be an independent source for this price data. If you do not do it yourself, then you need to pay some trusted independent party to do it on your behalf, like ChainLink or other oracle services like Pyth.

0

Check out Tellor, they can do spot prices like gold where you don't have to specify the endpoint (e.g. the price of BTC is just any valid bitcoin price). Check out here and just request the spot price of XAU/USD: https://docs.tellor.io/tellor/getting-data/introduction

If you want buy and sell prices or specific API's used, you can specify that too using a custom query: https://tellor.io/blog/how-to-query-custom-data-with-tellor/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.