Error while trying to use XRC

Hello

I’m trying to use XRC to get coin price but its failing with following error. I have tried depoyingXRC canister locally with a lot of cycles but i still get the same error

My App

2024-05-29 18:44:12.236987292 UTC: [Canister br5f7-7uaaa-aaaaa-qaaca-cai] [xrc] Timestamp: 1717008180, Asset: Asset { symbol: “BTC”, class: Cryptocurrency }, Error: Failed to retrieve rate from Coinbase: http_request request sent with 0 cycles, but 4_770_400 cycles are required.
2024-05-29 18:44:12.236987292 UTC: [Canister br5f7-7uaaa-aaaaa-qaaca-cai] [xrc] Timestamp: 1717008180, Asset: Asset { symbol: “BTC”, class: Cryptocurrency }, Error: Failed to retrieve rate from KuCoin: http_request request sent with 0 cycles, but 4_772_400 cycles are required.
2024-05-29 18:44:12.236987292 UTC: [Canister br5f7-7uaaa-aaaaa-qaaca-cai] [xrc] Timestamp: 1717008180, Asset: Asset { symbol: “BTC”, class: Cryptocurrency }, Error: Failed to retrieve rate from Okx: http_request request sent with 0 cycles, but 4_775_200 cycles are required.
2024-05-29 18:44:12.236987292 UTC: [Canister br5f7-7uaaa-aaaaa-qaaca-cai] [xrc] Caller: bkyz2-fmaaa-aaaaa-qaaaq-cai Timestamp: 1717008180 Request: GetExchangeRateRequest { base_asset: Asset { symbol: “BTC”, class: Cryptocurrency }, quote_asset: Asset { symbol: “USDT”, class: Cryptocurrency }, timestamp: None } Error: CryptoBaseAssetNotFound
2024-05-29 18:44:12.236987292 UTC: [Canister bkyz2-fmaaa-aaaaa-qaaaq-cai] #Err(#CryptoBaseAssetNotFound)

I read the following in the forum but i dont know how to “set your local network to be a system subnet”

The XRC lives on a system subnet where making outcalls is free, so it’s not necessary for it to attach cycles. If you want it to work locally you have to set your local network to be a system subnet, too

You have to configure it in networks.json, which is located at the place where dfx info networks-json-path points you to. It follows the schema that you can print with dfx schema --for networks. My networks.json to use a system subnet looks like this:

{
  "local": {
      "bind": "127.0.0.1:8080",
      "type": "ephemeral",
      "replica": {
        "subnet_type": "system"
      }
    }
}
1 Like