Internet Computer SDK

repository·master·Indexed 41 days ago

https://github.com/dfinity/sdk

A comprehensive toolkit for creating, deploying, and managing canister smart contracts on the Internet Computer (ICP) blockchain. It includes the dfx CLI, dfxvm version manager, and language-specific Canister Development Kits (CDK) for Rust, Python, and TypeScript.

Tokens
90.8K
Snippets
367
Records
467
Agent score
51%

What's inside IC SDK

  1. Overview of dfx sns subcommands

    master

    The dfx sns command suite is used to simulate handing a dapp off to the community for decentralized governance via a Service Nervous System (SNS).

    Subcommands:

    • create: Creates an SNS configuration template.
    • validate: Checks whether the SNS configuration file is valid.
    • deploy: Deploys SNS canisters according to the local configuration.
    • help: Displays usage information for a specified subcommand.
  2. Overview of the dfx command-line tool

    master
    The dfx command-line execution environment is the primary tool for creating, deploying, and managing decentralized applications (dapps) on the Internet Computer platform. It uses a parent command structure where subcommands and flags are used to perform specific operations like canister management, deployment, and identity handling.
  3. Manage cycles with dfx cycles

    master

    The dfx cycles command is used to manage cycles associated with an identity's principal via the cycles ledger.

    Basic syntax:

    dfx cycles [subcommand] [options]

    Available subcommands:

    • approve: Approves a principal to spend cycles on your behalf.
    • balance: Prints the account balance of the current principal.
    • convert: Converts ICP balance into cycles.
    • redeem-faucet-coupon: Redeems a code at the cycles faucet.
    • top-up: Deposits cycles into a canister.
    • transfer: Sends cycles to another account.
    • help: Displays usage information for a subcommand.
  4. What the playground_backend asset contains

    master

    The playground_backend asset is used to build a local Motoko playground for testing playground interactions without relying on the mainnet. To ensure quick deployments, the frontend and other non-essential parts are stripped out.

    It includes two primary canisters:

    1. wasm-utils: Performs instrumentation on deployed WASM (e.g., injecting profiling and stripping forbidden function calls like add_cycles).
    2. backend: Manages playground canisters and handles lending them to users.
  5. Manage cycles wallets with dfx wallet

    master

    The dfx wallet command is used to manage the cycles wallets of your identities. You can use it to modify wallet settings, send cycles to other canisters (including other cycles wallets), and manage controllers and custodians.

    Note: Before using these commands, you must have created a cycles wallet canister tied to an identity using dfx identity deploy-wallet.

  6. Interact with the ICP ledger using dfx ledger

    master

    The dfx ledger command allows you to interact with the ICP token's ledger canister. You can use it to perform ICP utility token transactions between canisters, top up canisters with cycles by converting ICP, check balances, and manage approvals for spending.

    Basic syntax:

    dfx ledger [subcommand] [options]

    Available subcommands:

    • account-id: Prints the selected identity's account identifier.
    • approve: Approves a principal to spend ICP on your behalf (ICRC-2).
    • balance: Prints the account balance of a user.
    • create-canister: Creates a canister using ICP.
    • fabricate-cycles: (Local development only) Generates cycles and deposits them into specified canisters.
    • help: Displays usage information for a subcommand.
    • notify: Notifies the ledger of a send transaction to the cycles minting canister.
    • top-up: Tops up a canister with cycles minted from ICP.
    • transfer: Transfers ICP to a destination account identifier or principal.
    • transfer-from: Transfers ICP from an approved spender to another principal.

    To see help for a specific subcommand, use --help (e.g., dfx ledger transfer --help).

  7. Manage identities with dfx identity

    master

    The dfx identity command is used to manage the identities that execute commands and communicate with the mainnet or local development environment. Creating multiple identities allows you to test user-based access controls.

    Basic Syntax:

    dfx identity [subcommand] [flag]

    Available Subcommands:

    CommandDescription
    deploy-walletInstalls the cycles wallet Wasm to the provided canister id.
    get-principalShows the textual representation of the principal associated with the current identity.
    get-walletShows the canister identifier for the wallet associated with your current identity principal.
    helpDisplays usage information for the command or subcommand.
    exportExports the PEM definition for an identity.
    importCreates a new identity by importing a PEM file or security certificate.
    listLists existing identities.
    newCreates a new identity.
    removeRemoves an existing identity.
    renameRenames an existing identity.
    set-walletSets the wallet canister identifier to use for your current identity principal.
    useSpecifies the identity to use.
    whoamiDisplays the name of the current identity user context.
  8. Use the dfx CLI for ICP development

    master

    The dfx command-line execution environment is the primary tool for creating, deploying, and managing dapps on the Internet Computer (ICP). It follows a parent command structure where you use subcommands and flags to perform specific operations.

    Basic usage:

    dfx [subcommand] [flag]
  9. Use Handlebars in extension canister type definitions

    master

    When defining a canister type in an extension, dfx performs Handlebars string replacement on every string field. This allows you to create dynamic paths and commands based on the canister's configuration.

    Available Handlebar variables:

    • {{canister_name}}: The name of the canister.
    • {{canister.<field>}}: Any field from the canister definition in dfx.json, or from canister_type.defaults in the extension's extension.json.