Developer Journey: Feedback and discussion

awesome! looking forward to continuing the journey - cycles loaded & ready!

any ETA on this? I can’t move fwd until this gets resolved - if you don’t have time to push an update just point me in direction to resolve the deploy error above

I plan to take a look at this tomorrow. I was attending a conference last week, so I didn’t get a chance to look at it then.

Your error suggests you may need to install the dotenv package. Here’s some resources on dotenv that may help:

1 Like

Thanks for the quick reply. I don’t mean to be pushy - I’m simply excited and motivated to keep the momentum.

I installed dotenv, then got errors for missing webpack. Installed webpack, then npm audit fix (apparently a few vulnerabilities) and only to get this error: (hope this helps reduce your debug/workload with this phase).

Installing code for canister poll_frontend, with canister ID bd3sg-teaaa-aaaaa-qaaba-cai
Error: Failed while trying to deploy canisters.
Caused by: Failed while trying to deploy canisters.
  Failed while trying to install all canisters.
    Failed to install wasm module to canister 'poll_frontend'.
      Failed during wasm installation call: The replica returned a rejection error: reject code CanisterError, reject message Only controllers of canister bd3sg-teaaa-aaaaa-qaaba-cai can call ic00 method install_code, error code Some("IC0512")

Hey @peterkayhi , I was able to get it running following these commands:

git clone https://github.com/jessiemongeon1/dev-journey-poll-dapp.git
cd dev-journey-poll-dapp
npm install
dfx start --clean --background
dfx deploy

Let me know if this works for you. Thanks!

worked great! looks like from the above that the npm install has to be done in the code directory, right? also (note to self) the --clean is important.

I’m excited to be moving on now. thanks so much!

p.s. I did get these while doing the npm install. I know they are only warnings but hope it helps shed more light:

npm warn EBADENGINE Unsupported engine {
npm warn EBADENGINE   package: 'poll_frontend@0.2.0',
npm warn EBADENGINE   required: { node: '^12 || ^14 || ^16 || ^18' },
npm warn EBADENGINE   current: { node: 'v22.2.0', npm: '10.7.0' }
npm warn EBADENGINE }

Hi (again!) Jessie and hope these questions aren’t a pain. I ran into a few problems others will run into with the journey… I spent as much time as I needed to get all the details and document them as best I could - trying to demonstrate that I really tried to figure this out. I put the questions first and then all the details below - hope you can help resolve them or point me where I can go to get answers.

Summary Questions:

Q1: I’m assuming that unless we don’t want to burn through the 10TC, these canisters should be immediately stopped or even perhaps deleted right after they are deployed, correct?

Q2: somehow the id got separated from the frontend canister - how can those get reconnected?

Q3: The example delete canister command errors out on my end both for front and backend.- how do I delete those canisters and at least reclaim xTC?

Q4:Does this using the cycles wallet vs cycles ledger misconfiguration affect the above issues and is there anything I need to change going forward? How do canisters know to pull from one vs the other?

Q1 Details:

It seems the core issue is that completing 1.5 will leave you exposed to burning through your cycles unless you do 1.6 immediately afterwards. I finished 1.5 on June 6 (Thursday) and by the time I resumed on Monday June 10 I was getting “out of cycles” errors. So referring to my Q1: I’m assuming that unless we don’t want to burn through the 10TC, these canisters should be immediately stopped or even perhaps deleted right after they are deployed, correct?

Q2 Details:

So the first odd thing is that the canister status for –all returns an error for frontend, yet backend shows on the status:

Error: Failed to get canister status for 'poll_frontend'.
Caused by: Failed to get canister status for 'poll_frontend'.

But it’s definitely there because I saved the id:
3nstc-cqaaa-aaaak-akuqq-cai

dev-journey-poll-dapp % dfx canister status 3nstc-cqaaa-aaaak-akuqq-cai --network ic
Canister status call result for 3nstc-cqaaa-aaaak-akuqq-cai.
Status: Stopped
Controllers: 7urla-oa5md-du3pu-536e7-oakhx-fm57x-xi4bu-7dvss-2rjgm-fsshm-jae
Memory allocation: 0
Compute allocation: 0
Freezing threshold: 0
Memory Size: Nat(3676424)
Balance: 2_984_938_658_843 Cycles
Reserved: 0 Cycles
Reserved Cycles Limit: 5_000_000_000_000 Cycles
Module hash: 0xc1290ad65e6c9f840928637ed7672b688216a9c1e919eacbacc22af8c904a5e3
Number of queries: 65
Instructions spent in queries: 84_141_304
Total query request paylod size (bytes): 31_499
Total query response payload size (bytes): 456_651

What could have happened here? In reference to my Q2: somehow the id got separated from the frontend canister - how can those get reconnected?

Q3 Details:

I kept going forward, now trying to delete backend and reclaim my cycles:

dev-journey-poll-dapp % dfx canister status poll_backend --network ic
Canister status call result for poll_backend.
Status: Stopped
Controllers: 7urla-oa5md-du3pu-536e7-oakhx-fm57x-xi4bu-7dvss-2rjgm-fsshm-jae
Memory allocation: 0
Compute allocation: 0
Freezing threshold: 0
Memory Size: Nat(3676082)
Balance: 2_994_966_495_511 Cycles
Reserved: 0 Cycles
Reserved Cycles Limit: 5_000_000_000_000 Cycles
Module hash: 0xc1290ad65e6c9f840928637ed7672b688216a9c1e919eacbacc22af8c904a5e3
Number of queries: 0
Instructions spent in queries: 0
Total query request paylod size (bytes): 0
Total query response payload size (bytes): 0

However this attempt returns an error, saying that it’s out of cycles, but the earlier status indicated it’s got a 3TC balance:

dev-journey-poll-dapp % dfx canister delete poll_backend --network ic
Beginning withdrawal of cycles; on failure try --no-wallet --no-withdrawal.
Setting the controller to identity principal.
Installing temporary wallet in canister poll_backend to enable transfer of cycles.
Attempting to transfer 2974312933190 cycles to canister 6tylh-uyaaa-aaaak-afpfq-cai.
Error: Failed to delete canister 'poll_backend'.
Caused by: Failed to delete canister 'poll_backend'.
  Failed to deposit 2974312933190 cycles into 6tylh-uyaaa-aaaak-afpfq-cai.
    Failed to call update function 'deposit_cycles' regarding canister '6tylh-uyaaa-aaaak-afpfq-cai'.
      Update call using wallet failed.
        The replica returned a rejection error: reject code CanisterError, reject message Error from Canister ygefb-eiaaa-aaaak-aku2a-cai: Canister ygefb-eiaaa-aaaak-aku2a-cai is out of cycles, error code None

I confirmed the canister ID is the poll_backend and has the same balance.

Same error when attempting to delete the frontend canister (though I have to use its ID because the name is no longer connected):

dfx canister delete 3nstc-cqaaa-aaaak-akuqq-cai  --network ic
Beginning withdrawal of cycles; on failure try --no-wallet --no-withdrawal.
Setting the controller to identity principal.
Installing temporary wallet in canister 3nstc-cqaaa-aaaak-akuqq-cai to enable transfer of cycles.
Attempting to transfer 2969309996491 cycles to canister 6tylh-uyaaa-aaaak-afpfq-cai.
Error: Failed to delete canister '3nstc-cqaaa-aaaak-akuqq-cai'.
Caused by: Failed to delete canister '3nstc-cqaaa-aaaak-akuqq-cai'.
  Failed to deposit 2969309996491 cycles into 6tylh-uyaaa-aaaak-afpfq-cai.
    Failed to call update function 'deposit_cycles' regarding canister '6tylh-uyaaa-aaaak-afpfq-cai'.
      Update call using wallet failed.
        The replica returned a rejection error: reject code CanisterError, reject message Error from Canister 3nstc-cqaaa-aaaak-akuqq-cai: Canister 3nstc-cqaaa-aaaak-akuqq-cai is out of cycles, error code None

So referencing my Q3: The example delete canister command errors out on my end both for front and backend.- how do I delete those canisters and at least reclaim xTC?

Q4 Details:

Finally, I think there was a mixup in the instructions to claim the coupon. I looks like mine went to the cycles wallet vs the cycles ledger.

dev-journey-poll-dapp % dfx wallet --network=ic balance
0.798 TC (trillion cycles).

% dfx cycles --network=ic balance
0.000 TC (trillion cycles).

Going forward, I can see why it’s easier to use the cycles ledger. In reference to my Q4: Does this using the cycles wallet vs cycles ledger misconfiguration affect the above issues? How do canisters know to pull from one vs the other?

1 Like

Hey Peter, here are some resources for you for these questions:

Q1: You can learn more about what costs cycles and how a canister uses cycles here: Paying for resources in cycles | Internet Computer

Q2: You can specify a canister’s ID in the canister_ids.json file.

Q3: The ‘deposit_cycles’ feature was temporarily disabled last week for some work on the cycles ledger. I’ve confirmed that this has been re-enabled and should work as expected. Please try again and let us know if the behavior is the same.

Q4: @Severin would be the best to answer this question and provide insight.

1 Like

Very helpful, esp the canister_ids.json file. I tried to delete the canister - got identical message. It seems on one hand the backend canister (ygefb—) has a balance but when it attempts to transfer it suddenly has no cycles. What can I try next?

 dfx canister delete poll_backend --network ic
Beginning withdrawal of cycles; on failure try --no-wallet --no-withdrawal.
Setting the controller to identity principal.
Installing temporary wallet in canister poll_backend to enable transfer of cycles.
Attempting to transfer 2969251105624 cycles to canister 6tylh-uyaaa-aaaak-afpfq-cai.
Error: Failed to delete canister 'poll_backend'.
Caused by: Failed to delete canister 'poll_backend'.
  Failed to deposit 2969251105624 cycles into 6tylh-uyaaa-aaaak-afpfq-cai.
    Failed to call update function 'deposit_cycles' regarding canister '6tylh-uyaaa-aaaak-afpfq-cai'.
      Update call using wallet failed.
        The replica returned a rejection error: reject code CanisterError, reject message Error from Canister ygefb-eiaaa-aaaak-aku2a-cai: Canister ygefb-eiaaa-aaaak-aku2a-cai is out of cycles, error code None

Hi @Jessie , I have few doubts related to Motoko ,
Q1. Is it possible to implement /replicate any smart contract written in solidity into Motoko?
Q2. Just like we have send , transfer and call methods in solidity to send data and value, are this methods are also available in Motoko ?If Yes, kindly share me the resources for the same.
Q3. Can I assume that almost everything that can be written in solidity for smart contract like ERC721 contract , ICO token , contract for Uniswap V3 protocol is possible in motoko bcoz I don’t see the concept of contract accounts, message call that we have in solidity.

@Severin Could you help out here?

Hi @CodeBlocker52 , this would be a better conversation targeted at the Motoko team. They would be able to provide better insight than myself. I suggest asking in the Motoko Working Group Thread: Motoko Developer Working Group - #10 by dfx-json

This is more a question of ICP vs Ethereum. There are some fundamental differences between Ethereum smart contracts and ICP smart contracts. In general, ICP smart contracts are much more capable, and so if a Solidity program’s essence can be extracted without reliance on any Ethereum-exclusive capabilities, it can certainly be duplicated in an ICP canister smart contract.

Just like we have send , transfer and call methods in solidity to send data and value, are this methods are also available in Motoko ?If Yes, kindly share me the resources for the same.

In a Motoko program, or any ICP smart contract for that matter, you define the endpoints and business logic that your canister executes.

Can I assume that almost everything that can be written in solidity for smart contract like ERC721 contract , ICO token , contract for Uniswap V3 protocol is possible in motoko bcoz I don’t see the concept of contract accounts, message call that we have in solidity.

We have an example of a canister that implements a DIP-721 interface, which is the ICP equivalent of ERC721. I’d start there.

Thanks Jessie! Looks like it’s a problem still being worked on so Severin doesn’t have to reply here (unless there’s something special for me :slight_smile: - I’ll follow this thread to see it to completion.

Jessie I resolved this situation by just requesting another 10TC which lets me move fwd until the delete canister bug gets resolved. I really really appreciate your attention to all of this. I have (just) 2 things to share FWIW if you are going to make any revisions based on my experience in going up to 1.6 - keep in mind I generally take a ton of time to go through tutorials so that I feel I really understand what’s happening (as opposed to just blindly following the keystroke). That said, my recommendations with humility are:

  1. Add instructions to stop/start canisters at the tail end of 1.5 so that cycles don’t get burned if several days pass before going to 1.6.

  2. Emphasize to not follow the coupon redemption step-by-step as it creates a cycles wallet vs your instructions which use a cycles ledger - this is where I went off the path the 1st time I redeemed the coupon - I followed their instructions, not yours. Along w/ this is the direction/code to set the env variable in the .zshenv/.profile/.whatever so the next time the student logs in they’ll have the right setting.

If this is all I got - I’d say the course so far is pretty damn good and I’m resolved to go all the way through with it - so appreciate the (massive) time you must have spent to produce this and now to deal with PITA responses like mine. Mahalo Nui!

If you have a wallet (and claimed your coupon there) you will stay in the ‘wallet universe’, which is actually what I would suggest for at least another couple weeks. If a wallet is configured, dfx will always automatically prefer the wallet way over the cycles ledger way, e.g. while withdrawing cycles from a canister to be deleted

1 Like

Thanks for the feedback, I really appreciate it! I’ll apply your first suggestion to the docs, and I’ve already chatted with the team behind the coupon regarding updating those instructions once the cycles ledger is the default option :slight_smile: Thanks again!

oh damn - successfully re-applied for 10TC and put them in my cycles ledger. Hopefully the delete canister bugfix will be in production soon (I saw the note about the beta dfx but I’ll hold off for now).

That said, what actually governs what wallet dfx picks when deploying a canister? I’m assuming it looks at the dfxCyclesLedgerSupportEnable env variable, which I’ve set to 1 in my .zshenv

It’s really the least I could do to try and pay back for all your help & attention so far. Looking fwd to continuing the journey!

1 Like

Even if you set the env var if your identity has a wallet configured it will use the wallet. This is so we don’t break anyone’s existing setup. To default to the cycles ledger you’ll need to unset the wallet in ~/.config/dfx/identity/<identity name>/wallets.json

AFAIK the quick fix should get promoted to the latest release next week. The proper solution is quite a bit further away, but it’s making progress