Creating a canister through the HTTPS api without the nns-ui?

Hi,
Which specific calls to which canister do I make to create a canister through the https-api and an agent without using the nns-ui? I know the send_dfx method can send icp and there is a method to check the icp balance on the ledger. Is it something like i send icp to the cycles_mint-canister’s-icp-id? but then how do i get the new canister’s-principal?

I’d start here:
https://sdk.dfinity.org/docs/quickstart/network-quickstart.html#net-ledger-id

Im looking for the specific canister methods and parameters that get called with those dfx commands, ill find it in the dfx-source

Is dfx open-source ?

What is the Ledger .minting_account_id ?

I found the minting_account_id, it is the icp account-identifier of the governance-cansiter’s-principal without a subaccount.
082ecf2e3f647ac600f43f38a68342fba5b8e68b085f02592b77f39808a8d2b5
But how to use it to create a canister?
I see that the cycles_minting canister takes a transaction_notification method but in the code it says only the ledger-canister can call it. i see the cycles_mint canister gives back a cycles response with a possible new canister id , but it gives back this data to the ledger canister. When i try to first create a burn transaction and get the block_height of the burn, then call the notify_dfx method on the ledger-canister with the to_canister field as the cycles_mint-canister with the to_subaccount field as my principal , I get an error: Canister ryjl3-tyaaa-aaaaa-aaaba-cai trapped explicitly: Panicked at ‘Deserialization Failed: “Unsupported op_code -24 in type table”’, /builds/dfinity-lab/dfinity/rs/rust_canisters/dfn_core/src/endpoint.rs:172:21.
The PrincipalReference candid-type opcode is -24 and the .did of the ledger says that the to_canister field of the notifycanisterargs takes a PrincipalReference

type NotifyCanisterArgs = record {
  block_height: BlockHeight;
  max_fee: ICPTs;
  from_subaccount: opt SubAccount;
  to_canister: principal;
  to_subaccount: opt SubAccount;
};

Dfx is not yet open-source. We need to reconfigure the e2e tests so that they can run in the open from external PR’s like agent-js still.

It would just be using the Rust agent though, so it could only be a rough reference for your http call project

The code i see in the rust-agent to create a canister calls the management-canister’s create_canister method but when I call the management canister’s create_canister method with this api-point: https://ic0.app/api/v2/canister/aaaaa-aa/call with this cbor map:

55799({“content”: {“request_type”: “call”, “canister_id”: h’’, “method_name”: “create_canister”, “arg”: h’4449444C016C000100’, “sender”: h’17CA138133EE7F5E62AE030EF747F2D5A7AEDCCF703220EC6A9AF12902’, “nonce”: h’0101000101010000010001000101000000010101000001010001000001’, “ingress_expiry”: 1629221383357000000}, “sender_pubkey”: h’302A300506032B65700321003C1A4E1DF6334D65CEE347C2066109E5A133CF626728822B3DD9577C9523913E’, “sender_sig”: h’F76D4123A4A5E970FF0B0669A3E213893FBD9C26DC326E659E29AE9C0D68B87CF5D231E6DEFBCE3934B43EBA727C7BD9AD50B121E80A22A6906E08AB0C209805’})

It gives this back: Exception: 404, with the body:

404 Not Found

404 Not Found


nginx/1.19.10

anyone know why?

The solution is here: Is the Management-Canister blocked from https calls from the outside? How to create a canister with an agent from the outside? - #20 by levi

2 Likes

Glad you found a solution. Shameless self-plug Want to use makefile but not dfx? You are not alone! - Developers / Command Line Tools - Internet Computer Developer Forum (dfinity.org)

Notably the code that creates canister is ic-utils/canister-ledger at main · ninegua/ic-utils · GitHub. The preferred way of talking to the ledger canister is still protobuf. Hopefully we’ll see candid API brought up to par.

3 Likes