How to make fake ckUSDT CKBTC locally for testing

Locally for testing we want to AirDrop for each new user about 1000 USD to just for testing so we don’t test with our real money we test with something fake locally.

So any ideas to mock/simulate ckUSDC?

We already have fake Local Internet identity. And we want to do the same with CKUSDc

If I understand correctly, you want to have one or more ICRC ledger deployed locally.

I think this guide is a good reference to understand how to set up local ICRC ledgers.

In my project, here are the relevant steps I followed:

  1. Configure the dfx.json file to pull the candid and Wasm files for the ICRC ledger:
    {
      "canisters": {
        "ckusdc-ledger": {
          "type": "custom",
          "candid": "https://github.com/dfinity/ic/releases/download/ledger-suite-icrc-2025-06-10/ledger.did",
          "wasm": "https://github.com/dfinity/ic/releases/download/ledger-suite-icrc-2025-06-10/ic-icrc1-ledger.wasm.gz",
          "specified_id": "xevnm-gaaaa-aaaar-qafnq-cai"
        }
        // other canisters
      }
      // other dfx settings
    }
    
    As you can see, I use the specified_id config field to deploy the local canister with the same ID as the mainnet canister, so that I can skip configuring my app with different canisters IDs depending on the environment.
    See also the reference from my project.

    Note: you may want to use a more recent release in the future. You can search for them on GitHub

  2. Initialize a local identity that will act as the minter, and get its principal:
    dfx identity new minter
    MINTER_PRINCIPAL=$(dfx identity --identity minter get-principal)
    
  3. Write a custom script that initializes the ledger:
    dfx deploy ckusdc-ledger --argument "(variant {
      Init = record {
        decimals = opt 6;
        token_symbol = \"ckUSDC\";
        token_name = \"ckUSDC\";
        transfer_fee = 10_000;
        metadata = vec {};
        minting_account = record { owner = principal \"$MINTER_PRINCIPAL\"; };
        initial_balances = vec {};
        archive_options = record {
          num_blocks_to_archive = 1000;
          trigger_threshold = 2000;
          max_message_size_bytes = null;
          cycles_for_archive_creation = opt 100_000_000_000_000;
          node_max_memory_size_bytes = opt 3_221_225_472;
          controller_id = principal \"2vxsx-fae\"
        };
        max_memo_length = opt 80;
        feature_flags = opt record { icrc2 = true };
      }
    })"
    
    See also the reference from my project.

    Note: you may need to change this Candid argument in the future, according to the ledger’s Candid file

  4. Transfer some funds to my local backend canister (this step really depends on what your tests/business logic require):
    dfx canister --identity minter call ckusdc-ledger icrc1_transfer "(record {to = record { owner = principal \"$BACKEND_CANISTER_ID\"; }; amount = 100_000_000; })"
    
    See also the reference from my project.
2 Likes

(post deleted by author)

(post deleted by author)