Enable Canisters to Hold ICP

Are we able to interact with a local ledger canister with “fake ICP” through this API to test ICP transferring with a local replica?

so what do i need to do to generate a new phase code on my old nns wallet address i need to back it up on my laptop now i’m praying my phone doesn’t break :frowning:

Go to https://identity.ic0.app/ on your phone
Type in your identity anchor number
Authenticate with your phone
Click on “Add recovery key” or “Add recovery mechanism” (whatever appears)
Click on “Seed phrase”
Copy the whole thing including the identity anchor number in the beginning and write it down

when i Authenticate with your phone it comes out, now i log in directly to my wallet i don’t see it Click on “Add recovery key” or “Add recovery mechanism

Make sure you’re visiting https://identity.ic0.app/ directly and logging in there, this gives you the account management page where you can add devices and recovery options like the seed phrase.
(This isn’t the same as logging in via an app, eg https://nns.ic0.app , which will instead redirect you back to the app and you won’t see the management page.)

yes i am sure when i login it says unknown identity anchor what should i do

Updated this for you, it should match now!

The identity anchor will be the same one you used to log in above (this is not your old seed phrase, it’s a number, probably 6 digits). If you can log in to the nns app with your phone then use the exact same approach on the identity management page, from there you can generate a new seed phrase.

1 Like

So how can a canister be built to accept ICP from different accounts, for example an ICP-based NFT market? Would that be accomplished with sub-accounts? Like the canister would generate a sub-account unique to the signed-in user? Is there any good docs on how to use sub-accounts in Rust?

Sorry for the late follow-up, but doesn’t this affect all inter-canister calls and not just ICP transfers? I was not aware that every inter-canister update calls incur 2x the latency of ingress update calls. If that’s the case, I think it would be well worth updating the docs to make that clear.

That also would make inter-canister queries even more important IMO.

I am trying to follow the readme, but get The post-build step failed for canister 'rrkah-fqaaa-aaaaa-aaaaq-cai' with an embedded error: No such file or directory (os error 2) when trying to build the ledger canister.

Hi @kevinli !

I assume you’re referring to the readme for the transfer example. The instructions are indeed somewhat incomplete at the moment, I’ll try to improve them in the next few days.
The error message is not entirely clear, my guess is that you don’t have the ledger canister web assembly module yet. I wrote an instruction how to build and install the ledger canister locally: ic/rs/rosetta-api/ledger_canister at 58af48d1f1e5bb20a7f4ae7ef052121187945daf · dfinity/ic · GitHub

1 Like

What is the status on this?

1 Like

Hi there,

If you are asking if Canisters can hold ICP, then the status is “this feature became part of mainnet in November.”

If you are asking something else, please let us know. I may have missed some nuance.

2 Likes

Hello, please tell me what could be the problem? The error crashes when configuring the ledger_canister project

ERROR [4/6] RUN cargo install -f --version 0.3.2 ic-cdk-optimizer 196.3s
[4/6] RUN cargo install -f --version 0.3.2 ic-cdk-optimizer:
#7 0.307 Updating crates.io index
#7 24.03 Downloading crates …
#7 24.84 Downloaded ic-cdk-optimizer v0.3.2
#7 24.94 Installing ic-cdk-optimizer v0.3.2
#7 25.15 Downloading crates …
#7 25.61 Downloaded heck v0.3.3
#7 25.66 Downloaded clap_derive v3.0.0-beta.2
#7 25.70 Downloaded unicode-segmentation v1.8.0
#7 25.71 Downloaded version_check v0.9.4
#7 25.72 Downloaded proc-macro-error-attr v1.0.4
#7 25.72 Downloaded itoa v1.0.1
#7 25.72 Downloaded proc-macro2 v1.0.36
#7 25.73 Downloaded serde_derive v1.0.133
#7 25.75 Downloaded serde v1.0.133
#7 25.77 Downloaded serde_json v1.0.74
#7 25.81 Downloaded textwrap v0.12.1
#7 25.81 Downloaded humansize v1.1.1
#7 25.82 Downloaded wabt v0.10.0
#7 25.83 Downloaded syn v1.0.85
#7 25.84 Downloaded strsim v0.10.0
#7 25.84 Downloaded cmake v0.1.48
#7 25.84 Downloaded ryu v1.0.9
#7 25.84 Downloaded quote v1.0.14
#7 25.84 Downloaded os_str_bytes v2.4.0
#7 25.85 Downloaded clap v3.0.0-beta.2
#7 25.87 Downloaded libc v0.2.112
#7 25.89 Downloaded lazy_static v1.4.0
#7 25.89 Downloaded unicode-width v0.1.9
#7 25.89 Downloaded unicode-xid v0.2.2
#7 25.89 Downloaded memchr v2.4.1
#7 25.90 Downloaded atty v0.2.14
#7 25.90 Downloaded cc v1.0.72
#7 25.91 Downloaded vec_map v0.8.2
#7 25.91 Downloaded regex-syntax v0.6.25
#7 25.93 Downloaded autocfg v1.0.1
#7 25.99 Downloaded aho-corasick v0.7.18
#7 25.99 Downloaded bitflags v1.3.2
#7 25.99 Downloaded wabt-sys v0.8.0
#7 26.14 Downloaded regex v1.5.4
#7 26.14 Downloaded proc-macro-error v1.0.4
#7 26.15 Downloaded indexmap v1.8.0
#7 26.15 Downloaded binaryen v0.12.0
#7 26.15 Downloaded hashbrown v0.11.2
#7 26.15 Downloaded termcolor v1.1.2
#7 26.16 Downloaded binaryen-sys v0.12.0
#7 26.27 Compiling proc-macro2 v1.0.36
#7 26.27 Compiling unicode-xid v0.2.2
#7 26.27 Compiling cc v1.0.72
#7 26.27 Compiling memchr v2.4.1
#7 26.45 Compiling version_check v0.9.4
#7 26.66 Compiling unicode-segmentation v1.8.0
#7 26.66 Compiling syn v1.0.85
#7 26.78 Compiling regex-syntax v0.6.25
#7 26.95 Compiling libc v0.2.112
#7 27.10 Compiling autocfg v1.0.1
#7 27.27 Compiling serde v1.0.133
#7 27.28 Compiling serde_derive v1.0.133
#7 27.46 Compiling serde_json v1.0.74
#7 27.54 Compiling hashbrown v0.11.2
#7 27.56 Compiling ryu v1.0.9
#7 27.78 Compiling itoa v1.0.1
#7 27.87 Compiling unicode-width v0.1.9
#7 27.91 Compiling termcolor v1.1.2
#7 27.95 Compiling strsim v0.10.0
#7 27.97 Compiling os_str_bytes v2.4.0
#7 28.13 Compiling bitflags v1.3.2
#7 28.20 Compiling lazy_static v1.4.0
#7 28.33 Compiling vec_map v0.8.2
#7 28.49 Compiling humansize v1.1.1
#7 28.64 Compiling cmake v0.1.48
#7 28.68 Compiling proc-macro-error-attr v1.0.4
#7 28.96 Compiling proc-macro-error v1.0.4
#7 29.14 Compiling heck v0.3.3
#7 29.20 Compiling indexmap v1.8.0
#7 29.40 Compiling textwrap v0.12.1
#7 29.47 Compiling wabt-sys v0.8.0
#7 30.26 Compiling aho-corasick v0.7.18
#7 30.34 Compiling quote v1.0.14
#7 30.63 Compiling atty v0.2.14
#7 31.60 Compiling regex v1.5.4
#7 36.83 Compiling binaryen-sys v0.12.0
#7 38.24 Compiling clap_derive v3.0.0-beta.2
#7 41.69 Compiling clap v3.0.0-beta.2
#7 120.2 Compiling wabt v0.10.0
#7 195.9 Compiling binaryen v0.12.0
#7 196.0 error[E0308]: mismatched types
#7 196.0 → /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/binaryen-0.12.0/src/tools.rs:11:47
#7 196.0 |
#7 196.0 11 | let raw_module = ffi::translateToFuzz(seed.as_ptr() as *const i8, seed.len(), true);
#7 196.0 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u8, found i8
#7 196.0 |
#7 196.0 = note: expected raw pointer *const u8
#7 196.0 found raw pointer *const i8
#7 196.0
#7 196.0 error[E0308]: mismatched types
#7 196.0 → /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/binaryen-0.12.0/src/tools.rs:23:47
#7 196.0 |
#7 196.0 23 | let raw_module = ffi::translateToFuzz(seed.as_ptr() as *const i8, seed.len(), false);
#7 196.0 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u8, found i8
#7 196.0 |
#7 196.0 = note: expected raw pointer *const u8
#7 196.0 found raw pointer *const i8
#7 196.0
#7 196.0 For more information about this error, try rustc --explain E0308.
#7 196.0 error: could not compile binaryen due to 2 previous errors
#7 196.0 warning: build failed, waiting for other jobs to finish…
#7 196.1 error: failed to compile ic-cdk-optimizer v0.3.2, intermediate artifacts can be found at /tmp/cargo-installlASlrK
#7 196.1
#7 196.1 Caused by:
#7 196.1 build failed
executor failed running [/bin/sh -c cargo install -f --version 0.3.2 ic-cdk-optimizer]: exit code: 101

Hi @Munlite!

Thank you for reporting the issue.
I’ve just tried to re-install Docker and build the image following the instruction, and the build fails for me as well (though with a different error message).

It might be that the base rust:1.55.0 image changed in an incompatible way.
I’ll update the instructions and notify you when they land on master.

2 Likes

Thanks for the answer!

1 Like

Quick update on the ledger build instructions: The documentation PR is on review, you can try using this little script to get the canister and the Candid interfaces for now:

export IC_VERSION=a7058d009494bea7e1d898a3dd7b525922979039
curl -o ledger.wasm.gz https://download.dfinity.systems/ic/${IC_VERSION}/canisters/ledger-canister_notify-method.wasm.gz
gunzip ledger.wasm.gz
curl -o ledger.private.did https://raw.githubusercontent.com/dfinity/ic/${IC_VERSION}/rs/rosetta-api/ledger.did
curl -o ledger.public.did https://raw.githubusercontent.com/dfinity/ic/${IC_VERSION}/rs/rosetta-api/ledger_canister/ledger.did

This script fetches the ledger canister module that our CI pipeline built. This script will replace the Dockerfile in the first step of the instruction. You won’t need to build the canister from scratch anymore.

4 Likes

Yes, it worked. But now the problem is with the ledger-transfer example :grinning:. Are the instructions in the project correct?

1 Like

Indeed, the example was not in sync with the latest Ledger version.
I created a PR to fix that a couple of weeks ago: Update the ledger transfer example by roman-kashitsyn · Pull Request #130 · dfinity/examples · GitHub and I’ve just merged this PR to master. Could you please try the new version?

2 Likes