Failed creating canister and lost ICP

Hi everybody,
I hope this is the right category.
I am (obviously) new to to this and to get some experience i tried to deploy my sample project (little changes to the explore_hello project) by following the “Network deployment” (Network deployment :: Internet Computer). Code and results are below.

Steps and thoughts:
I successfully got my principal and ledger id, transfered 0.2 ICP to this adress and started to create a canister for deployment. Then there was the first error and i thought it happened because i wrote 0.2 instead of .2 for the amount (i don’t know, it was written like this in the tutorial). So i changed it and the result was the same. Then i thought i have to use less to pay for the fees. The result was an error again, but with a different balance inside the error message.
The ledger balance after these steps was 0 ICP. Since the .2 ICP had been used up, i thought maybe at least the canister had been created and tried to install the cycles wallet. Again, an error. Verifying the canister resulted in an error too.
Searched for a solution online and found this 403 forbidden error when running command "dfx identity --network ic deploy-wallet <canister-identifer>" - #6 by kpeacock. So i tried the --force command and the wallet was successfully deployed. But the result of trying to install the wallet again was “The wallet canister already exists”. When I checked the wallet’s balance, I was presented with a new error
“Canister […] has no query method ‘wallet_balance’” and the ledger balance is still 0 ICP.

Can someone please tell me what i did wrong and how to solve this?
Thank you in advance!

jan@ubuntu:~/ICP Projects/explore_hello$ dfx ledger --network ic balance
0.20000000 ICP
jan@ubuntu:~/ICP Projects/explore_hello$ dfx ledger --network ic create-canister c7hoy-e3g23-bhl5i-rbbif-eoozk-4cno4-a23ho-nkuex-t32yn-a6hew-yqe --amount 0.2
The Replica returned an error: code 5, message: "Canister ryjl3-tyaaa-aaaaa-aaaba-cai trapped explicitly: Panicked at 'called `Result::unwrap()` on an `Err` value: InsufficientFunds { balance: ICPTs { e8s: 20000000 } }', rosetta-api/ledger_canister/src/main.rs:525:39"
jan@ubuntu:~/ICP Projects/explore_hello$ dfx ledger --network ic create-canister c7hoy-e3g23-bhl5i-rbbif-eoozk-4cno4-a23ho-nkuex-t32yn-a6hew-yqe --amount .2
The Replica returned an error: code 5, message: "Canister ryjl3-tyaaa-aaaaa-aaaba-cai trapped explicitly: Panicked at 'called `Result::unwrap()` on an `Err` value: InsufficientFunds { balance: ICPTs { e8s: 20000000 } }', rosetta-api/ledger_canister/src/main.rs:525:39"
jan@ubuntu:~/ICP Projects/explore_hello$ dfx ledger --network ic create-canister c7hoy-e3g23-bhl5i-rbbif-eoozk-4cno4-a23ho-nkuex-t32yn-a6hew-yqe --amount .1999
Transfer sent at BlockHeight: 2173099
The Replica returned an error: code 5, message: "Canister ryjl3-tyaaa-aaaaa-aaaba-cai trapped explicitly: Panicked at 'Transfer failed: InsufficientFunds { balance: ICPTs { e8s: 0 } }', rosetta-api/ledger_canister/src/lib.rs:1004:10"
jan@ubuntu:~/ICP Projects/explore_hello$ dfx ledger --network ic balance
0.00000000 ICP
jan@ubuntu:~/ICP Projects/explore_hello$ dfx identity --network ic deploy-wallet ryjl3-tyaaa-aaaaa-aaaba-cai
Creating a wallet canister on the ic network.
The replica returned an HTTP Error: Http Error: status 403 Forbidden, content type "", content: Requested canister rejected the message
jan@ubuntu:~/ICP Projects/explore_hello$ dfx identity --network ic get-wallet
Creating a wallet canister on the ic network.
The replica returned an HTTP Error: Http Error: status 404 Not Found, content type "text/html", content: <html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.21.3</center>
</body>
</html>

jan@ubuntu:~/ICP Projects/explore_hello$ dfx identity --network ic set-wallet ryjl3-tyaaa-aaaaa-aaaba-cai --force
Skipping verification of availability of the canister on the network due to --force...
Setting wallet for identity 'default' on network 'ic' to id 'ryjl3-tyaaa-aaaaa-aaaba-cai'
Wallet set successfully.
jan@ubuntu:~/ICP Projects/explore_hello$ dfx identity --network ic deploy-wallet ryjl3-tyaaa-aaaaa-aaaba-cai
The wallet canister "ryjl3-tyaaa-aaaaa-aaaba-cai" already exists for user "default" on "ic" network.
jan@ubuntu:~/ICP Projects/explore_hello$ dfx identity --network ic get-wallet
ryjl3-tyaaa-aaaaa-aaaba-cai
jan@ubuntu:~/ICP Projects/explore_hello$ dfx wallet --network ic balance
The Replica returned an error: code 3, message: "IC0302: Canister ryjl3-tyaaa-aaaaa-aaaba-cai has no query method 'wallet_balance'"
jan@ubuntu:~/ICP Projects/explore_hello$ dfx ledger --network ic balance
0.00000000 ICP
2 Likes

Unfortunately creating a canister and then initialize it with cycles requires multiple steps. So the fee is more than 0.0001. (I think it is 0.0002 but I could be wrong since I’ve not verified myself)

You might need to add some ICP balance to your ledger account first, and then call “notify” manually:

HEIGHT=2173099
dfx ledger --network=ic notify $HEIGHT $(dfx identity get-principal)

But then, this has to be done within 24 hours… hope it helps!

1 Like

Thank you for your fast response!

Unfortunately, it did not work. Charging the canister with new cycles also did not worked before. It eats the ICP, but does not give me cycles…

jan@ubuntu:~/ICP Projects/hello$ dfx ledger --network ic top-up ryjl3-tyaaa-aaaaa-aaaba-cai --amount .0025
Transfer sent at BlockHeight: 2200941
The Replica returned an error: code 5, message: "Canister ryjl3-tyaaa-aaaaa-aaaba-cai trapped explicitly: Panicked at 'Transfer failed: InsufficientFunds { balance: ICPTs { e8s: 0 } }', rosetta-api/ledger_canister/src/lib.rs:1004:10"

Btw it seems like there are 100000000000 cycles necessary for creating a canister. So with an ICP price of 22,45$ about 0,0069 ICP. But maybe that is just because of my mistakes… so can’t confirm this 100%.

jan@ubuntu:~/ICP Projects/hello$ dfx ledger --network ic create-canister <principal> --amount .005
Transfer sent at BlockHeight: 2200564
Refunded at block height 2200584 with message :Creating canister in subnet cv73p-6v7zi-u67oy-7jc3h-qspsz-g5lrj-4fn7k-xrax3-thek2-sl46v-jae failed with code 4: Creating a canister requires a fee of 100000000000 that is deducted from the canister's initial balance but only 72666500000 cycles were received with the create_canister request.

Anyways… I started again from scratch and created a new project. But at the latest in the “deploy-wallet” step, the system always refers back to the first canister, even though I explicitly address the new one.

jan@ubuntu:~/ICP Projects/hello$ dfx identity --network ic deploy-wallet 3olcv-bqaaa-aaaam-qabta-cai
The wallet canister "ryjl3-tyaaa-aaaaa-aaaba-cai" already exists for user "default" on "ic" network.

So i tried to delete the old canister with

$ dfx canister --network ic delete <CANISTER_ID>

but the error was

Stopping code for canister ryjl3-tyaaa-aaaaa-aaaba-cai, with canister_id ryjl3-tyaaa-aaaaa-aaaba-cai
The Replica returned an error: code 3, message: "Canister ryjl3-tyaaa-aaaaa-aaaba-cai has no update method 'wallet_call'"

Is there any other way to get rid of this canister?
Thank you in advance!

You can manually edit ~/.config/dfx/identity/default/wallets.json and remove ryjl3-tyaaa-aaaaa-aaaba-cai. Then try doing deploy-wallet 3olcv-bqaaa-aaaam-qabta-cai again.

If that is successful, you can use dfx to delete ryjl3-tyaaa-aaaaa-aaaba-cai to reclaim its remaining cycles afterwards.

2 Likes

I just went through the steps here and think I ran into the same problem:

dfx ledger --network ic create-canister <my principal> --amount .25
Please enter a passphrase for your identity: [hidden]
Decryption complete.
Transfer sent at block height 4380420
Error: Processing

I tried again and got the same thing:

dfx ledger --network ic create-canister <my principal> --amount .25
Please enter a passphrase for your identity: [hidden]
Decryption complete.
Transfer sent at block height 4380434
Error: Processing

Calling notify manually appears to have fixed both of them:

dfx ledger --network ic notify create-canister 4380420 <my principal>
Please enter a passphrase for your identity: [hidden]
Decryption complete.
Canister created with id: <canister id>
dfx ledger --network ic notify create-canister 4380434 <my principal>
Please enter a passphrase for your identity: [hidden]
Decryption complete.
Canister created with id: <canister id>

This seems to happen consistently and I imagine it’s very off-putting for people wanting to try out the platform.

I think this workaround is helpful but shouldn’t be the answer.

@domwoe hoping you can help raise this with the right people.

2 Likes

Agreed, dfx can do the workaround by itself. It shouldn’t be on the user (especially newbies) to find the workaround. Added this to our backlog.

(Internal ticket link so I can find the status easier if someone asks for an update. This is not publicly visible.)

3 Likes