Ic-cdk=0.9.2 how to calculate the cycles used in http_request

Version: ic-cdk=0.9.2
citation path:use ic_cdk::api::management_canister::http_request::http_request;
The http_request method also needs to carry cycles when initiating a request

What is the calculation logic of this cycles? Is there a corresponding example? I am in
examples

Checked the similar but hard-coded, how to perform dynamic calculation

My error message is

The http_request resulted into error. RejectionCode: CanisterReject, Error: http_request request sent with 60_106_800 cycles, but 60_148_400 cycles are required.

How to calculate the required cycles in the canister is currently an unsolved problem that we’re aware of. If you’re ok hard-coding some values, you can find the formula here. Some of the numbers in there are outdated. I’ll fix these. But this table contains the current live values

1 Like