简体   繁体   中英

Approximating cost of using Chainlink for custom API

I am planning out a new project in which I need to connect one particular Fiat payment gateway to my smart contract. I don't want to have a system with a centralized backend, so I am exploring the possibility to use Chainlink to communicate with API and then pass response to my smart contract. I know that Chainlink allows any contract to access any external data source through their decentralized oracle.network. The problem is I can't approximate how much LINK it will cost me to get a response from 1 oracle. Is there some average cost of a 1 response from an oracle and what determines such cost

I tried to look up this information, but it does not seem that this topic is discussed much. Also probably I didn't look in the right place

The problem is I can't approximate how much LINK it will cost me to get response from 1 oracle.

Nobody can. When you make a request to oracle, you are calling a smart contract function and this will cost you gas which varies depending on the congestion in the system. if system is busy, it will cost more gas. Also when you interact with the chainlink, you are actually passing data to chainlink smart contract which makes some calculations, so you pay for those gas too.

Calling one oracle is sending a request to one oracle. oracle is a chainlink node operator, and it set its own price. But sending a request to only one node is not a decentralized approach even though each node have multiple data resources. you should make a request to several nodes meaning that you need to pay each node operator. when you make a request to several nodes, you receive the average of those responses.

The service you want to use is Chainlink Any Api , and in the service the cost of LINK depends on the node operator you are using.

There is a fee required by node operator. When you send a request, you actually require Chainlink node to provide a service. Usually the service is not free and the fee of a request is set by the node operator. The fee varies across different node operators. If you are only a consumer to use service provided by node operators, you just need to check the fee of different node operators .

you, of course, also has to pay gas fee for your transaction, but that it it costed in ETH rather than LINK (as you asking how much LINK it will cost, I assume you know it).

If you are a node operator and want to run the service for yourself, you may want to consider the following 2 factors:

  1. Congestion of the system mentioned by @Yilmaz. When the blockchain you are using is very busy, the gas price is high so that the more gas fee, which is the result of (gas price) x(gas limit) , will be cost more.

  2. The logic of fulfill function in your contract. Fulfillment function is the "callback" function of Chainlink Any Api. Oracle node will fetch the data demand in the request and then call the fulfill function in consumer contract. In fulfill function, logics varies from simply saving the data in a variable or doing some calculations. The more complex logics, the more gas limit required.

Hope it helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM