# Rust

**URL:** https://forum.dfinity.org/c/developers/rust/30.md?page=4

[Latest](https://forum.dfinity.org/latest.md) · [Categories](https://forum.dfinity.org/categories.md) · [Tags](https://forum.dfinity.org/tags.md)

**Page:** 5

---

## [Canbench : Debug and print](https://forum.dfinity.org/t/canbench-debug-and-print/41853)

<div class="topic-metadata">

**Author:** [@vicky0004](https://forum.dfinity.org/u/vicky0004)\
**Replies:** 14\
**Last updated:** [March 19, 2025, 4:30am UTC](https://forum.dfinity.org/t/canbench-debug-and-print/41853 "2025-03-19T04:30:26Z")

</div>

Hi Everyone I am encountering an issue where none of the printing statements seem to work within canbench bench functions. I have tried the following: eprintln!("Error occurred: {:?}", error); ic\_cdk::println!("Startin…

---

## [Getting Failure on mainnet deployment](https://forum.dfinity.org/t/getting-failure-on-mainnet-deployment/41963)

<div class="topic-metadata">

**Author:** [@yash-rana0101](https://forum.dfinity.org/u/yash-rana0101)\
**Replies:** 5\
**Last updated:** [March 18, 2025, 4:21pm UTC](https://forum.dfinity.org/t/getting-failure-on-mainnet-deployment/41963 "2025-03-18T16:21:51Z")

</div>

I deployed a canister seven days ago and verified that all API endpoints were functioning correctly. However, after reaching 42 users, the canister started failing when calling the create\_an\_account API, while all other …

---

## [How to Handle Race Conditions in ICP Canisters](https://forum.dfinity.org/t/how-to-handle-race-conditions-in-icp-canisters/42438)

<div class="topic-metadata">

**Author:** [@jyotirmaygithub](https://forum.dfinity.org/u/jyotirmaygithub)\
**Replies:** 6\
**Last updated:** [March 18, 2025, 7:43am UTC](https://forum.dfinity.org/t/how-to-handle-race-conditions-in-icp-canisters/42438 "2025-03-18T07:43:07Z")

</div>

I’m building a finance application on the Internet Computer (ICP) where users can borrow tokens. I’m facing a race condition issue where multiple users can borrow tokens at the same time, leading to an incorrect state. E…

---

## [Cargo format toml](https://forum.dfinity.org/t/cargo-format-toml/42139)

<div class="topic-metadata">

**Author:** [@peterparker](https://forum.dfinity.org/u/peterparker)\
**Replies:** 6\
**Last updated:** [March 16, 2025, 11:34am UTC](https://forum.dfinity.org/t/cargo-format-toml/42139 "2025-03-16T11:34:17Z")

</div>

Hey, dumb Rust noob question: cargo fmt does not format the Cargo.toml and config.toml right? How do you auto-format those files in your projects?

---

## [Help Needed: "bitcoind" Not Opening on Mac - Malware Warning](https://forum.dfinity.org/t/help-needed-bitcoind-not-opening-on-mac-malware-warning/42211)

<div class="topic-metadata">

**Author:** [@successaje](https://forum.dfinity.org/u/successaje)\
**Replies:** 3\
**Last updated:** [March 13, 2025, 5:56pm UTC](https://forum.dfinity.org/t/help-needed-bitcoind-not-opening-on-mac-malware-warning/42211 "2025-03-13T17:56:50Z")

</div>

Hi everyone, I’m trying to set up and run a Bitcoin instance (bitcoind) on my Mac, but I’m encountering an error that’s preventing me from proceeding. When I attempt to run bitcoind, I get the following error: "bitcoin…

---

## ["Invalid Certificate" Error](https://forum.dfinity.org/t/invalid-certificate-error/42236)

<div class="topic-metadata">

**Author:** [@nourAhmed123](https://forum.dfinity.org/u/nourAhmed123)\
**Replies:** 1\
**Last updated:** [March 13, 2025, 3:14pm UTC](https://forum.dfinity.org/t/invalid-certificate-error/42236 "2025-03-13T15:14:02Z")

</div>

Hi everyone, I’ve been facing a recurring “Invalid certificate” error when working locally with the KYC actor on the Internet Computer (IC). The issue arises when I try to interact with the KYC actor, such as checking u…

---

## [Error Fetching Username in ICRC Authentication](https://forum.dfinity.org/t/error-fetching-username-in-icrc-authentication/42193)

<div class="topic-metadata">

**Author:** [@jumanaa](https://forum.dfinity.org/u/jumanaa)\
**Replies:** 0\
**Last updated:** [March 12, 2025, 4:02pm UTC](https://forum.dfinity.org/t/error-fetching-username-in-icrc-authentication/42193 "2025-03-12T16:02:37Z")

</div>

Problem Description I am encountering an issue where an error appears once but disappears upon refreshing. The error message is: Error: Error fetching username: AgentQueryError: Error while making call: Invalid certifi…

---

## [What is smart contract in blockchain?](https://forum.dfinity.org/t/what-is-smart-contract-in-blockchain/42133)

<div class="topic-metadata">

**Author:** [@shipfinexfzco](https://forum.dfinity.org/u/shipfinexfzco)\
**Replies:** 0\
**Last updated:** [March 11, 2025, 7:33am UTC](https://forum.dfinity.org/t/what-is-smart-contract-in-blockchain/42133 "2025-03-11T07:33:39Z")

</div>

Hey! Are you interested to explore about smart contract?

---

## [Fetching Liquidation List on ICP Without Spending Cycles](https://forum.dfinity.org/t/fetching-liquidation-list-on-icp-without-spending-cycles/42119)

<div class="topic-metadata">

**Author:** [@jyotirmaygithub](https://forum.dfinity.org/u/jyotirmaygithub)\
**Replies:** 0\
**Last updated:** [March 10, 2025, 5:14pm UTC](https://forum.dfinity.org/t/fetching-liquidation-list-on-icp-without-spending-cycles/42119 "2025-03-10T17:14:14Z")

</div>

What is the best way to fetch a liquidation list of users whose health factor is less than 1 on the Internet Computer (ICP) without consuming cycles? Are there any bots available for this task, or any efficient approache…

---

## [Getting 403 Forbidden on Canister HTTP Calls](https://forum.dfinity.org/t/getting-403-forbidden-on-canister-http-calls/41872)

<div class="topic-metadata">

**Author:** [@Harshal0902](https://forum.dfinity.org/u/Harshal0902)\
**Replies:** 7\
**Last updated:** [March 6, 2025, 10:32am UTC](https://forum.dfinity.org/t/getting-403-forbidden-on-canister-http-calls/41872 "2025-03-06T10:32:04Z")

</div>

While making GET calls from the canister, I am encountering a 403 status error. I have checked possible causes, including: IPv6 Compatibility Rate Limiting The above conditions are already met, and the API endpoint i…

---

## [Canbench: State Persistence, Caller Configuration, and Extended Metrics in canbench for ICP Canisters](https://forum.dfinity.org/t/canbench-state-persistence-caller-configuration-and-extended-metrics-in-canbench-for-icp-canisters/41846)

<div class="topic-metadata">

**Author:** [@vicky0004](https://forum.dfinity.org/u/vicky0004)\
**Replies:** 3\
**Last updated:** [March 5, 2025, 9:52am UTC](https://forum.dfinity.org/t/canbench-state-persistence-caller-configuration-and-extended-metrics-in-canbench-for-icp-canisters/41846 "2025-03-05T09:52:17Z")

</div>

Hi everyone, I’m currently using canbench to benchmark my ICP canisters and have a few questions that I couldn’t find clear answers to: 1. State Persistence If the canister’s state persists between the execution of di…

---

## [Best Practices for Automated & Reliable Swaps on AMMs (ICPSwap, KongSwap, etc.)](https://forum.dfinity.org/t/best-practices-for-automated-reliable-swaps-on-amms-icpswap-kongswap-etc/41859)

<div class="topic-metadata">

**Author:** [@SamurajSelfieSam](https://forum.dfinity.org/u/SamurajSelfieSam)\
**Replies:** 1\
**Last updated:** [March 5, 2025, 9:18am UTC](https://forum.dfinity.org/t/best-practices-for-automated-reliable-swaps-on-amms-icpswap-kongswap-etc/41859 "2025-03-05T09:18:55Z")

</div>

Hey everyone, I’m currently developing a DeFi app that requires executing a large number of automated swaps on ICP-based AMMs (such as ICPSwap, Sonic, KongSwap, ICDex, and ICPex). The goal is to ensure that swaps are fu…

---

## [Black Screen Issue After Deploying dApp on Internet Computer (ICP) – Any Fix?](https://forum.dfinity.org/t/black-screen-issue-after-deploying-dapp-on-internet-computer-icp-any-fix/41822)

<div class="topic-metadata">

**Author:** [@fiwece](https://forum.dfinity.org/u/fiwece)\
**Replies:** 2\
**Last updated:** [March 4, 2025, 7:55pm UTC](https://forum.dfinity.org/t/black-screen-issue-after-deploying-dapp-on-internet-computer-icp-any-fix/41822 "2025-03-04T19:55:44Z")

</div>

Hi Everyone, I recently deployed my dApp on the Internet Computer ICP, but when I visit the URL, the page only shows a black screen. The application was working fine during local development, but after deployment, the U…

---

## [IC0406 CanisterReject Error on Update Calls When Using inspect\_message](https://forum.dfinity.org/t/ic0406-canisterreject-error-on-update-calls-when-using-inspect-message/41854)

<div class="topic-metadata">

**Author:** [@jyotirmaygithub](https://forum.dfinity.org/u/jyotirmaygithub)\
**Replies:** 2\
**Last updated:** [March 4, 2025, 1:14pm UTC](https://forum.dfinity.org/t/ic0406-canisterreject-error-on-update-calls-when-using-inspect-message/41854 "2025-03-04T13:14:54Z")

</div>

I am facing an issue where every update call to my canister gets rejected with the error: The replica returned a rejection error: reject code CanisterReject, reject message Error from Canister avqkn-guaaa-aaaaa-qaaea-c…

---

## [Testing Creation of Canister on a subnet using Cycle Minting Canister with PocketIC](https://forum.dfinity.org/t/testing-creation-of-canister-on-a-subnet-using-cycle-minting-canister-with-pocketic/26906)

<div class="topic-metadata">

**Author:** [@gravity\_vi](https://forum.dfinity.org/u/gravity_vi)\
**Replies:** 21\
**Last updated:** [March 4, 2025, 1:02pm UTC](https://forum.dfinity.org/t/testing-creation-of-canister-on-a-subnet-using-cycle-minting-canister-with-pocketic/26906 "2025-03-04T13:02:27Z")

</div>

We are trying to create canisters on a specific subnet using cycle minting canister. I am testing this scenario using pocket-ic. Getting Error on creation of canisters using CMC canister: Error: value: Refunded { refu…

---

## [Error regarding not enough cycles to deploy canister](https://forum.dfinity.org/t/error-regarding-not-enough-cycles-to-deploy-canister/41666)

<div class="topic-metadata">

**Author:** [@cwaidner64](https://forum.dfinity.org/u/cwaidner64)\
**Replies:** 5\
**Last updated:** [February 28, 2025, 12:42pm UTC](https://forum.dfinity.org/t/error-regarding-not-enough-cycles-to-deploy-canister/41666 "2025-02-28T12:42:22Z")

</div>

I’m following the developer tutorial hosted on ICP’s website and I’m running into an issue about minimum number of cycles when trying to deploy a canister. I have about 3 trillion cycles as indicated by the attached imag…

---

## [PocketIC Version 8.0.0: New Response Types](https://forum.dfinity.org/t/pocketic-version-8-0-0-new-response-types/41687)

<div class="topic-metadata">

**Author:** [@mraszyk](https://forum.dfinity.org/u/mraszyk)\
**Replies:** 1\
**Last updated:** [February 27, 2025, 7:24pm UTC](https://forum.dfinity.org/t/pocketic-version-8-0-0-new-response-types/41687 "2025-02-27T19:24:34Z")

</div>

Pocket IC We have released PocketIC server 8.0.0 and its Rust library 7.0.0. This release contains new response types (announced in a separate forum post) and support for using the PocketIC Rust library in DFX (announced…

---

## [Unable to stop canister](https://forum.dfinity.org/t/unable-to-stop-canister/41670)

<div class="topic-metadata">

**Author:** [@gravity\_vi](https://forum.dfinity.org/u/gravity_vi)\
**Replies:** 4\
**Last updated:** [February 27, 2025, 2:10pm UTC](https://forum.dfinity.org/t/unable-to-stop-canister/41670 "2025-02-27T14:10:33Z")

</div>

To upgrade our fleet of canisters, we typically stop the canister, perform the upgrade, and then restart it. However, we’ve recently encountered issues with stopping the canister due to timeout errors. Is there a more ef…

---

## [Using rust RSA library in ICP](https://forum.dfinity.org/t/using-rust-rsa-library-in-icp/26377)

<div class="topic-metadata">

**Author:** [@agentDPS](https://forum.dfinity.org/u/agentDPS)\
**Replies:** 3\
**Last updated:** [February 27, 2025, 12:05pm UTC](https://forum.dfinity.org/t/using-rust-rsa-library-in-icp/26377 "2025-02-27T12:05:09Z")

</div>

So basically i am trying to create a wallet recovery protocol on ICP . That uses Vet keys and DKIM signatures … Issue is that i found a library called viadkim which does the DKIM verification. Issue with this is that , …

---

## [Black Screen Issue in My Internet Computer dApp – Needd Help"](https://forum.dfinity.org/t/black-screen-issue-in-my-internet-computer-dapp-needd-help/41675)

<div class="topic-metadata">

**Author:** [@cowem](https://forum.dfinity.org/u/cowem)\
**Replies:** 0\
**Last updated:** [February 27, 2025, 9:51am UTC](https://forum.dfinity.org/t/black-screen-issue-in-my-internet-computer-dapp-needd-help/41675 "2025-02-27T09:51:07Z")

</div>

I recently deployed my dApp on the Internet Computer (ICP), but when I try to access it, Iam only seeing a black screen with no content. My backend canisters are running without issues, and there are no errors in the dep…

---

## [Data not reflect correctly](https://forum.dfinity.org/t/data-not-reflect-correctly/41581)

<div class="topic-metadata">

**Author:** [@baolongt](https://forum.dfinity.org/u/baolongt)\
**Replies:** 6\
**Last updated:** [February 25, 2025, 5:06pm UTC](https://forum.dfinity.org/t/data-not-reflect-correctly/41581 "2025-02-25T17:06:28Z")

</div>

Given the code below use ic\_cdk::storage::stable::StableBTreeMap; static STORE: StableBTreeMap\<String, String\> = StableBTreeMap::new(); #\[ic\_cdk::update\] fn update\_and\_get(key: String, new\_value: String) -\> String { …

---

## [Error in fetching balance for ERC20 contracts](https://forum.dfinity.org/t/error-in-fetching-balance-for-erc20-contracts/41096)

<div class="topic-metadata">

**Author:** [@tosynthegeek](https://forum.dfinity.org/u/tosynthegeek)\
**Replies:** 13\
**Last updated:** [February 25, 2025, 2:38pm UTC](https://forum.dfinity.org/t/error-in-fetching-balance-for-erc20-contracts/41096 "2025-02-25T14:38:48Z")

</div>

I am trying to fetch balance of an address for an ERC20 contract using ic-alloy: #\[update(name = "getNetworkTVL")\] async fn get\_network\_tvl(new\_network\_rpc: String, chain\_id: Nat) -\> Result\<Nat, String\> { let (netwo…

---

## [Critical Security Risk: Preventing Unauthorized User Registrations](https://forum.dfinity.org/t/critical-security-risk-preventing-unauthorized-user-registrations/41580)

<div class="topic-metadata">

**Author:** [@jyotirmaygithub](https://forum.dfinity.org/u/jyotirmaygithub)\
**Replies:** 1\
**Last updated:** [February 25, 2025, 5:42am UTC](https://forum.dfinity.org/t/critical-security-risk-preventing-unauthorized-user-registrations/41580 "2025-02-25T05:42:58Z")

</div>

My user registration function allows users to register by retrieving their principal ID. While it blocks anonymous principals, it does not verify whether a principal is genuinely issued by ICP Identity, NFID, or a valid …

---

## [PocketIC concurrency testing: Simulate multiple users performing transactions simultaneously.](https://forum.dfinity.org/t/pocketic-concurrency-testing-simulate-multiple-users-performing-transactions-simultaneously/41449)

<div class="topic-metadata">

**Author:** [@vicky0004](https://forum.dfinity.org/u/vicky0004)\
**Replies:** 1\
**Last updated:** [February 21, 2025, 9:25am UTC](https://forum.dfinity.org/t/pocketic-concurrency-testing-simulate-multiple-users-performing-transactions-simultaneously/41449 "2025-02-21T09:25:47Z")

</div>

I am testing a DeFi application built on ICP using PocketIC. My goal is to simulate multiple users performing transactions (e.g., supply and withdraw) simultaneously to check for concurrency-related issues such as race c…

---

## [Testing tools compatible to be on ICP](https://forum.dfinity.org/t/testing-tools-compatible-to-be-on-icp/41317)

<div class="topic-metadata">

**Author:** [@jyotirmaygithub](https://forum.dfinity.org/u/jyotirmaygithub)\
**Replies:** 1\
**Last updated:** [February 18, 2025, 9:10am UTC](https://forum.dfinity.org/t/testing-tools-compatible-to-be-on-icp/41317 "2025-02-18T09:10:07Z")

</div>

I am currently working on a project using Internet Computer (ICP) and am in the process of preparing for extensive testing. I have identified a few critical areas of testing that are essential for my project. However, I …

---

## [Problem with BTC interaction (example/basic-bitcoin)](https://forum.dfinity.org/t/problem-with-btc-interaction-example-basic-bitcoin/41233)

<div class="topic-metadata">

**Author:** [@ikripaka](https://forum.dfinity.org/u/ikripaka)\
**Replies:** 2\
**Last updated:** [February 17, 2025, 11:54am UTC](https://forum.dfinity.org/t/problem-with-btc-interaction-example-basic-bitcoin/41233 "2025-02-17T11:54:40Z")

</div>

Hi! I’m a newcomer to ICP development, so I’m trying now to run an example with basic-bitcoin. The main issue is that, as I understand from the picture, the canister’s interface is incorrect. I’ve also tried to decompos…

---

## [Announcing the HTTP certification library for Rust](https://forum.dfinity.org/t/announcing-the-http-certification-library-for-rust/29595)

<div class="topic-metadata">

**Author:** [@NathanosDev](https://forum.dfinity.org/u/NathanosDev)\
**Replies:** 13\
**Last updated:** [December 9, 2024, 6:33pm UTC](https://forum.dfinity.org/t/announcing-the-http-certification-library-for-rust/29595 "2024-12-09T18:33:00Z")

</div>

Hello ICP builders :astronaut: Nathan here from the Trust team :waving\_hand: Today I’m happy to announce the HTTP certification library for Rust! Background As a quick reminder, HTTP certification is a procedure that w…

---

## [Wasm module iinvalid import error in Rust canister deployment](https://forum.dfinity.org/t/wasm-module-iinvalid-import-error-in-rust-canister-deployment/40879)

<div class="topic-metadata">

**Author:** [@guangyongyangnz](https://forum.dfinity.org/u/guangyongyangnz)\
**Replies:** 2\
**Last updated:** [February 8, 2025, 8:39am UTC](https://forum.dfinity.org/t/wasm-module-iinvalid-import-error-in-rust-canister-deployment/40879 "2025-02-08T08:39:50Z")

</div>

I’m deploying a Rust-based canister on the IC using dfx deploy, but I’m getting the following error when trying to install the Wasm module: Error: Failed while trying to deploy canisters. Caused by: Failed while trying…

---

## [Alloy\_sol\_macro but for candid](https://forum.dfinity.org/t/alloy-sol-macro-but-for-candid/40945)

<div class="topic-metadata">

**Author:** [@ulan](https://forum.dfinity.org/u/ulan)\
**Replies:** 2\
**Last updated:** [February 7, 2025, 9:44am UTC](https://forum.dfinity.org/t/alloy-sol-macro-but-for-candid/40945 "2025-02-07T09:44:44Z")

</div>

Has anyone tried writing a Rust macro for candid that’s similar to sol! from alloy\_sol\_macro? The idea would be to have something like: can!( icp\_ledger, "../deps/candid/ryjl3-tyaaa-aaaaa-aaaba-cai.did" ); And…

---

## [How to calculate cycles balance not to raise "Couldn't send message"error](https://forum.dfinity.org/t/how-to-calculate-cycles-balance-not-to-raise-couldnt-send-message-error/40940)

<div class="topic-metadata">

**Author:** [@hide-yoshi](https://forum.dfinity.org/u/hide-yoshi)\
**Replies:** 1\
**Last updated:** [February 7, 2025, 8:51am UTC](https://forum.dfinity.org/t/how-to-calculate-cycles-balance-not-to-raise-couldnt-send-message-error/40940 "2025-02-07T08:51:19Z")

</div>

Hello, I am a member of the Chainsight team. I am seeing “Couldn’t send message” error sometimes in a canister that does inter-canister-call multiple times. To investigate the cause of this, we have created the followin…

[Previous page](https://forum.dfinity.org/c/developers/rust/30.md?page=3)

[Next page](https://forum.dfinity.org/c/developers/rust/30.md?page=5)
